11 #include "netcdf_filter.h"
12 #include "ncdispatch.h"
13 #include "nc4internal.h"
15 #include "nc4internal.h"
213 int ndims,
const int *dimidsp,
int *varidp)
218 if ((stat = NC_check_id(ncid, &ncp)))
221 return ncp->dispatch->def_var(ncid, name, xtype, ndims,
307 int stat = NC_check_id(ncid,&ncp);
316 return ncp->dispatch->def_var_fill(ncid,varid,no_fill,fill_value);
459 int stat = NC_check_id(ncid,&ncp);
461 return ncp->dispatch->def_var_deflate(ncid,varid,shuffle,deflate,deflate_level);
505 int stat = NC_check_id(ncid,&ncp);
507 return ncp->dispatch->def_var_fletcher32(ncid,varid,fletcher32);
625 int stat = NC_check_id(ncid, &ncp);
627 return ncp->dispatch->def_var_chunking(ncid, varid, storage,
703 int stat = NC_check_id(ncid,&ncp);
705 return ncp->dispatch->def_var_endian(ncid,varid,endian);
763 unsigned int params[2];
764 params[0] = options_mask;
765 params[1] = pixels_per_block;
766 if ((ret = nc_def_var_filter(ncid, varid, HDF5_FILTER_SZIP, 2, params)))
842 int stat = NC_check_id(ncid, &ncp);
845 return ncp->dispatch->rename_var(ncid, varid, name);
859 NC_is_recvar(
int ncid,
int varid,
size_t* nrecs)
870 if(ndims == 0)
return 0;
873 status =
nc_inq_dim(ncid,dimset[0],NULL,nrecs);
875 return (dimset[0] == unlimid ? 1: 0);
904 NC_inq_recvar(
int ncid,
int varid,
int* nrecdimsp,
int *is_recdim)
914 if(status !=
NC_NOERR)
return status;
916 for(dim = 0; dim < nvardims; dim++)
919 if(status !=
NC_NOERR)
return status;
920 if(unlimid == -1)
return status;
927 if(status !=
NC_NOERR)
return status;
928 if(nunlimdims == 0)
return status;
930 if (!(unlimids = malloc(nunlimdims *
sizeof(
int))))
942 for (dim = 0; dim < nvardims; dim++) {
943 for(recdim = 0; recdim < nunlimdims; recdim++) {
944 if(dimset[dim] == unlimids[recdim]) {
954 if(status !=
NC_NOERR)
return status;
955 if(dimset[0] == unlimid) {
960 if(nrecdimsp) *nrecdimsp = nrecdims;
986 return ((
int)
sizeof(
char));
988 return ((
int)
sizeof(
signed char));
990 return ((
int)
sizeof(
short));
992 return ((
int)
sizeof(
int));
994 return ((
int)
sizeof(
float));
996 return ((
int)
sizeof(
double));
1000 return ((
int)
sizeof(
unsigned char));
1002 return ((
int)(
sizeof(
unsigned short)));
1004 return ((
int)
sizeof(
unsigned int));
1006 return ((
int)
sizeof(
signed long long));
1008 return ((
int)
sizeof(
unsigned long long));
1011 return ((
int)
sizeof(
char*));
1028 NC_atomictypelen(
nc_type xtype)
1032 case NC_NAT: sz = 0;
break;
1033 case NC_BYTE: sz =
sizeof(
signed char);
break;
1034 case NC_CHAR: sz =
sizeof(char);
break;
1035 case NC_SHORT: sz =
sizeof(short);
break;
1036 case NC_INT: sz =
sizeof(int);
break;
1037 case NC_FLOAT: sz =
sizeof(float);
break;
1038 case NC_DOUBLE: sz =
sizeof(double);
break;
1039 case NC_INT64: sz =
sizeof(
signed long long);
break;
1040 case NC_UBYTE: sz =
sizeof(
unsigned char);
break;
1041 case NC_USHORT: sz =
sizeof(
unsigned short);
break;
1042 case NC_UINT: sz =
sizeof(
unsigned int);
break;
1043 case NC_UINT64: sz =
sizeof(
unsigned long long);
break;
1045 case NC_STRING: sz =
sizeof(
char*);
break;
1061 NC_atomictypename(
nc_type xtype)
1065 case NC_NAT: nm =
"undefined";
break;
1066 case NC_BYTE: nm =
"byte";
break;
1067 case NC_CHAR: nm =
"char";
break;
1068 case NC_SHORT: nm =
"short";
break;
1069 case NC_INT: nm =
"int";
break;
1070 case NC_FLOAT: nm =
"float";
break;
1072 case NC_INT64: nm =
"int64";
break;
1073 case NC_UBYTE: nm =
"ubyte";
break;
1075 case NC_UINT: nm =
"uint";
break;
1103 NC_getshape(
int ncid,
int varid,
int ndims,
size_t* shape)
1111 for(i = 0; i < ndims; i++)
1143 NC_check_nulls(
int ncid,
int varid,
const size_t *start,
size_t **count,
1153 if (!start && varndims)
1159 if (!(*count = malloc(varndims *
sizeof(
size_t))))
1161 if ((stat = NC_getshape(ncid, varid, varndims, *count)))
1171 if (stride && !*stride)
1175 if (!(*stride = malloc(varndims *
sizeof(ptrdiff_t))))
1177 for (i = 0; i < varndims; i++)
1209 for (i = 0; i < len; i++)
1288 int stat = NC_check_id(ncid, &ncp);
1290 return ncp->dispatch->set_var_chunk_cache(ncid, varid, size,
1291 nelems, preemption);
1329 int stat = NC_check_id(ncid, &ncp);
1331 return ncp->dispatch->get_var_chunk_cache(ncid, varid, sizep,
1332 nelemsp, preemptionp);