diff --git a/libdispatch/var.c b/libdispatch/var.c index 54ce97c16..d59fc570f 100644 --- a/libdispatch/var.c +++ b/libdispatch/var.c @@ -847,220 +847,202 @@ nc_get_vara(int ncid, int varid, int nc_get_var(int ncid, int varid, void *value) { - return NC_get_var(ncid,varid,value,NC_NAT); + return NC_get_var(ncid, varid, value, NC_NAT); } int nc_put_var(int ncid, int varid, const void *value) { - return NC_put_var(ncid,varid,value,NC_NAT); + return NC_put_var(ncid, varid, value, NC_NAT); } int nc_get_var1(int ncid, int varid, const size_t *coord, void *value) { - return NC_get_var1(ncid,varid,coord,value,NC_NAT); + return NC_get_var1(ncid, varid, coord, value, NC_NAT); } int nc_put_var1(int ncid, int varid, const size_t *coord, const void *value) { - return NC_put_var1(ncid,varid,coord,value,NC_NAT); + return NC_put_var1(ncid, varid, coord, value, NC_NAT); } int -nc_get_varm( - int ncid, - int varid, - const size_t * start, - const size_t * edges, - const ptrdiff_t * stride, - const ptrdiff_t * imapp, - void *value) +nc_get_varm(int ncid, int varid, const size_t * start, + const size_t * edges, const ptrdiff_t * stride, + const ptrdiff_t * imapp, void *value) { - return NC_get_varm (ncid, varid, start, edges, stride, imapp, - value, NC_NAT); + return NC_get_varm(ncid, varid, start, edges, stride, imapp, + value, NC_NAT); } int -nc_put_varm ( - int ncid, - int varid, - const size_t * start, - const size_t * edges, - const ptrdiff_t * stride, - const ptrdiff_t * imapp, - const void *value) +nc_put_varm (int ncid, int varid, const size_t * start, + const size_t * edges, const ptrdiff_t * stride, + const ptrdiff_t * imapp, const void *value) { - return NC_put_varm (ncid, varid, start, edges, stride, imapp, - value, NC_NAT); + return NC_put_varm(ncid, varid, start, edges, stride, imapp, + value, NC_NAT); } int -nc_get_vars( - int ncid, - int varid, - const size_t * start, - const size_t * edges, - const ptrdiff_t * stride, - void *value) +nc_get_vars(int ncid, int varid, const size_t * start, + const size_t * edges, const ptrdiff_t * stride, + void *value) { - return nc_get_varm (ncid, varid, start, edges, - stride, NULL, value); + return nc_get_varm(ncid, varid, start, edges, + stride, NULL, value); } int -nc_put_vars ( - int ncid, - int varid, - const size_t * start, - const size_t * edges, - const ptrdiff_t * stride, - const void *value) +nc_put_vars (int ncid, int varid, const size_t * start, + const size_t * edges, const ptrdiff_t * stride, + const void *value) { - return nc_put_varm (ncid, varid, start, edges, - stride, NULL, value); + return nc_put_varm(ncid, varid, start, edges, + stride, NULL, value); } int nc_get_var1_text(int ncid, int varid, const size_t *coord, char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_get_var1(ncid,varid,coord,(void*)value,NC_CHAR); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_get_var1(ncid, varid, coord, (void*)value, NC_CHAR); } int nc_get_var1_schar(int ncid, int varid, const size_t *coord, signed char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_get_var1(ncid, varid, coord, (void*)value, NC_BYTE); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_get_var1(ncid, varid, coord, (void*)value, NC_BYTE); } int nc_get_var1_uchar(int ncid, int varid, const size_t *coord, unsigned char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_get_var1(ncid,varid,coord,(void*)value, NC_UBYTE); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_get_var1(ncid, varid, coord, (void*)value, NC_UBYTE); } int nc_get_var1_short(int ncid, int varid, const size_t *coord, short *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_get_var1(ncid,varid,coord,(void*)value, NC_SHORT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_get_var1(ncid, varid, coord, (void*)value, NC_SHORT); } int nc_get_var1_int(int ncid, int varid, const size_t *coord, int *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_get_var1(ncid,varid,coord,(void*)value, NC_INT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_get_var1(ncid, varid, coord, (void*)value, NC_INT); } int nc_get_var1_long(int ncid, int varid, const size_t *coord, long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_get_var1(ncid,varid,coord,(void*)value, longtype); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_get_var1(ncid,varid,coord,(void*)value, longtype); } int nc_get_var1_float(int ncid, int varid, const size_t *coord, float *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_get_var1(ncid,varid,coord,(void*)value, NC_FLOAT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_get_var1(ncid,varid,coord,(void*)value, NC_FLOAT); } int nc_get_var1_double(int ncid, int varid, const size_t *coord, double *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_get_var1(ncid,varid,coord,(void*)value, NC_DOUBLE); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_get_var1(ncid,varid,coord,(void*)value, NC_DOUBLE); } int nc_get_var1_ubyte(int ncid, int varid, const size_t *coord, unsigned char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_get_var1(ncid,varid,coord,(void*)value, NC_UBYTE); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_get_var1(ncid,varid,coord,(void*)value, NC_UBYTE); } int nc_get_var1_ushort(int ncid, int varid, const size_t *coord, unsigned short *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_get_var1(ncid,varid,coord,(void*)value, NC_USHORT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_get_var1(ncid,varid,coord,(void*)value, NC_USHORT); } int nc_get_var1_uint(int ncid, int varid, const size_t *coord, unsigned int *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_get_var1(ncid,varid,coord,(void*)value, NC_INT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_get_var1(ncid,varid,coord,(void*)value, NC_INT); } int nc_get_var1_longlong(int ncid, int varid, const size_t *coord, long long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_get_var1(ncid,varid,coord,(void*)value, NC_INT64); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_get_var1(ncid,varid,coord,(void*)value, NC_INT64); } int nc_get_var1_ulonglong(int ncid, int varid, const size_t *coord, unsigned long long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_get_var1(ncid,varid,coord,(void*)value, NC_UINT64); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_get_var1(ncid,varid,coord,(void*)value, NC_UINT64); } #ifdef USE_NETCDF4 int nc_get_var1_string(int ncid, int varid, const size_t *coord, char* *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_get_var1(ncid,varid,coord,(void*)value, NC_STRING); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_get_var1(ncid,varid,coord,(void*)value, NC_STRING); } #endif /*USE_NETCDF4*/ @@ -1068,142 +1050,142 @@ nc_get_var1_string(int ncid, int varid, const size_t *coord, char* *value) int nc_put_var1_text(int ncid, int varid, const size_t *coord, const char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_put_var1(ncid,varid,coord,(void*)value, NC_CHAR); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_put_var1(ncid,varid,coord,(void*)value, NC_CHAR); } int nc_put_var1_schar(int ncid, int varid, const size_t *coord, const signed char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_put_var1(ncid,varid,coord,(void*)value, NC_BYTE); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_put_var1(ncid,varid,coord,(void*)value, NC_BYTE); } int nc_put_var1_uchar(int ncid, int varid, const size_t *coord, const unsigned char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_put_var1(ncid,varid,coord,(void*)value, NC_UBYTE); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_put_var1(ncid,varid,coord,(void*)value, NC_UBYTE); } int nc_put_var1_short(int ncid, int varid, const size_t *coord, const short *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_put_var1(ncid,varid,coord,(void*)value, NC_SHORT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_put_var1(ncid,varid,coord,(void*)value, NC_SHORT); } int nc_put_var1_int(int ncid, int varid, const size_t *coord, const int *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_put_var1(ncid,varid,coord,(void*)value, NC_INT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_put_var1(ncid,varid,coord,(void*)value, NC_INT); } int nc_put_var1_long(int ncid, int varid, const size_t *coord, const long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_put_var1(ncid,varid,coord,(void*)value, longtype); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_put_var1(ncid,varid,coord,(void*)value, longtype); } int nc_put_var1_float(int ncid, int varid, const size_t *coord, const float *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_put_var1(ncid,varid,coord,(void*)value, NC_FLOAT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_put_var1(ncid,varid,coord,(void*)value, NC_FLOAT); } int nc_put_var1_double(int ncid, int varid, const size_t *coord, const double *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_put_var1(ncid,varid,coord,(void*)value, NC_DOUBLE); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_put_var1(ncid,varid,coord,(void*)value, NC_DOUBLE); } int nc_put_var1_ubyte(int ncid, int varid, const size_t *coord, const unsigned char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_put_var1(ncid,varid,coord,(void*)value, NC_UBYTE); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_put_var1(ncid,varid,coord,(void*)value, NC_UBYTE); } int nc_put_var1_ushort(int ncid, int varid, const size_t *coord, const unsigned short *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_put_var1(ncid,varid,coord,(void*)value, NC_SHORT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_put_var1(ncid,varid,coord,(void*)value, NC_SHORT); } int nc_put_var1_uint(int ncid, int varid, const size_t *coord, const unsigned int *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_put_var1(ncid,varid,coord,(void*)value, NC_UINT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_put_var1(ncid,varid,coord,(void*)value, NC_UINT); } int nc_put_var1_longlong(int ncid, int varid, const size_t *coord, const long long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_put_var1(ncid,varid,coord,(void*)value, NC_INT64); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_put_var1(ncid,varid,coord,(void*)value, NC_INT64); } int nc_put_var1_ulonglong(int ncid, int varid, const size_t *coord, const unsigned long long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_put_var1(ncid,varid,coord,(void*)value, NC_UINT64); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_put_var1(ncid,varid,coord,(void*)value, NC_UINT64); } #ifdef USE_NETCDF4 int nc_put_var1_string(int ncid, int varid, const size_t *coord, const char* *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - INITCOORD1; - return NC_put_var1(ncid, varid, coord, (void*)value, NC_STRING); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + INITCOORD1; + return NC_put_var1(ncid, varid, coord, (void*)value, NC_STRING); } #endif /*USE_NETCDF4*/ @@ -1211,128 +1193,128 @@ nc_put_var1_string(int ncid, int varid, const size_t *coord, const char* *value) int nc_get_var_text(int ncid, int varid, char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_var(ncid, varid, (void*)value, NC_CHAR); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_var(ncid, varid, (void*)value, NC_CHAR); } int nc_get_var_schar(int ncid, int varid, signed char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_var(ncid,varid,(void*)value, NC_BYTE); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_var(ncid,varid,(void*)value, NC_BYTE); } int nc_get_var_uchar(int ncid, int varid, unsigned char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_var(ncid,varid,(void*)value, NC_UBYTE); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_var(ncid,varid,(void*)value, NC_UBYTE); } int nc_get_var_short(int ncid, int varid, short *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_var(ncid,varid,(void*)value, NC_SHORT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_var(ncid,varid,(void*)value, NC_SHORT); } int nc_get_var_int(int ncid, int varid, int *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_var(ncid,varid,(void*)value, NC_INT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_var(ncid,varid,(void*)value, NC_INT); } int nc_get_var_long(int ncid, int varid, long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_var(ncid,varid,(void*)value, longtype); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_var(ncid,varid,(void*)value, longtype); } int nc_get_var_float(int ncid, int varid, float *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_var(ncid,varid,(void*)value, NC_FLOAT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_var(ncid,varid,(void*)value, NC_FLOAT); } int nc_get_var_double(int ncid, int varid, double *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_var(ncid,varid,(void*)value, NC_DOUBLE); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_var(ncid,varid,(void*)value, NC_DOUBLE); } int nc_get_var_ubyte(int ncid, int varid, unsigned char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_var(ncid,varid,(void*)value, NC_UBYTE); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_var(ncid,varid,(void*)value, NC_UBYTE); } int nc_get_var_ushort(int ncid, int varid, unsigned short *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_var(ncid,varid,(void*)value, NC_USHORT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_var(ncid,varid,(void*)value, NC_USHORT); } int nc_get_var_uint(int ncid, int varid, unsigned int *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_var(ncid,varid,(void*)value, NC_UINT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_var(ncid,varid,(void*)value, NC_UINT); } int nc_get_var_longlong(int ncid, int varid, long long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_var(ncid,varid,(void*)value, NC_INT64); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_var(ncid,varid,(void*)value, NC_INT64); } int nc_get_var_ulonglong(int ncid, int varid, unsigned long long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_var(ncid,varid,(void*)value,NC_UINT64); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_var(ncid,varid,(void*)value,NC_UINT64); } #ifdef USE_NETCDF4 int nc_get_var_string(int ncid, int varid, char* *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_var(ncid,varid,(void*)value,NC_STRING); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_var(ncid,varid,(void*)value,NC_STRING); } #endif /*USE_NETCDF4*/ @@ -1340,1099 +1322,1097 @@ nc_get_var_string(int ncid, int varid, char* *value) int nc_put_var_text(int ncid, int varid, const char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_var(ncid,varid,(void*)value,NC_CHAR); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_var(ncid,varid,(void*)value,NC_CHAR); } int nc_put_var_schar(int ncid, int varid, const signed char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_var(ncid,varid,(void*)value,NC_BYTE); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_var(ncid,varid,(void*)value,NC_BYTE); } int nc_put_var_uchar(int ncid, int varid, const unsigned char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_var(ncid,varid,(void*)value,T_uchar); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_var(ncid,varid,(void*)value,T_uchar); } int nc_put_var_short(int ncid, int varid, const short *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_var(ncid,varid,(void*)value,NC_SHORT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_var(ncid,varid,(void*)value,NC_SHORT); } int nc_put_var_int(int ncid, int varid, const int *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_var(ncid,varid,(void*)value,NC_INT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_var(ncid,varid,(void*)value,NC_INT); } int nc_put_var_long(int ncid, int varid, const long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_var(ncid,varid,(void*)value,T_long); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_var(ncid,varid,(void*)value,T_long); } int nc_put_var_float(int ncid, int varid, const float *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_var(ncid,varid,(void*)value,T_float); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_var(ncid,varid,(void*)value,T_float); } int nc_put_var_double(int ncid, int varid, const double *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_var(ncid,varid,(void*)value,T_double); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_var(ncid,varid,(void*)value,T_double); } int nc_put_var_ubyte(int ncid, int varid, const unsigned char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_var(ncid,varid,(void*)value,T_ubyte); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_var(ncid,varid,(void*)value,T_ubyte); } int nc_put_var_ushort(int ncid, int varid, const unsigned short *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_var(ncid,varid,(void*)value,T_ushort); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_var(ncid,varid,(void*)value,T_ushort); } int nc_put_var_uint(int ncid, int varid, const unsigned int *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_var(ncid,varid,(void*)value,T_uint); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_var(ncid,varid,(void*)value,T_uint); } int nc_put_var_longlong(int ncid, int varid, const long long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_var(ncid,varid,(void*)value,T_longlong); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_var(ncid,varid,(void*)value,T_longlong); } int nc_put_var_ulonglong(int ncid, int varid, const unsigned long long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_var(ncid,varid,(void*)value,NC_UINT64); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_var(ncid,varid,(void*)value,NC_UINT64); } #ifdef USE_NETCDF4 int nc_put_var_string(int ncid, int varid, const char* *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_var(ncid,varid,(void*)value,NC_STRING); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_var(ncid,varid,(void*)value,NC_STRING); } #endif /*USE_NETCDF4*/ int -nc_put_vara_text(int ncid, int varid, - const size_t *start, const size_t *edges, const char *value) +nc_put_vara_text(int ncid, int varid, const size_t *start, + const size_t *edges, const char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vara(ncid,varid,start,edges,(void*)value,NC_CHAR); + return NC_put_vara(ncid, varid, start, edges, + (void*)value, NC_CHAR); } int nc_put_vara_schar(int ncid, int varid, - const size_t *start, const size_t *edges, const signed char *value) + const size_t *start, const size_t *edges, const signed char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vara(ncid,varid,start,edges,(void*)value,NC_BYTE); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vara(ncid,varid,start,edges,(void*)value,NC_BYTE); } int nc_put_vara_uchar(int ncid, int varid, - const size_t *start, const size_t *edges, const unsigned char *value) + const size_t *start, const size_t *edges, const unsigned char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vara(ncid,varid,start,edges,(void*)value,T_uchar); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vara(ncid,varid,start,edges,(void*)value,T_uchar); } int nc_put_vara_short(int ncid, int varid, - const size_t *start, const size_t *edges, const short *value) + const size_t *start, const size_t *edges, const short *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vara(ncid,varid,start,edges,(void*)value,NC_SHORT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vara(ncid,varid,start,edges,(void*)value,NC_SHORT); } int nc_put_vara_int(int ncid, int varid, - const size_t *start, const size_t *edges, const int *value) + const size_t *start, const size_t *edges, const int *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vara(ncid,varid,start,edges,(void*)value,NC_INT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vara(ncid,varid,start,edges,(void*)value,NC_INT); } int nc_put_vara_long(int ncid, int varid, - const size_t *start, const size_t *edges, const long *value) + const size_t *start, const size_t *edges, const long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vara(ncid,varid,start,edges,(void*)value,T_long); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vara(ncid,varid,start,edges,(void*)value,T_long); } int nc_put_vara_float(int ncid, int varid, - const size_t *start, const size_t *edges, const float *value) + const size_t *start, const size_t *edges, const float *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vara(ncid,varid,start,edges,(void*)value,T_float); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vara(ncid,varid,start,edges,(void*)value,T_float); } int nc_put_vara_double(int ncid, int varid, - const size_t *start, const size_t *edges, const double *value) + const size_t *start, const size_t *edges, const double *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vara(ncid,varid,start,edges,(void*)value,T_double); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vara(ncid,varid,start,edges,(void*)value,T_double); } int nc_put_vara_ubyte(int ncid, int varid, - const size_t *start, const size_t *edges, const unsigned char *value) + const size_t *start, const size_t *edges, const unsigned char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vara(ncid,varid,start,edges,(void*)value,T_ubyte); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vara(ncid,varid,start,edges,(void*)value,T_ubyte); } int nc_put_vara_ushort(int ncid, int varid, - const size_t *start, const size_t *edges, const unsigned short *value) + const size_t *start, const size_t *edges, const unsigned short *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vara(ncid,varid,start,edges,(void*)value,T_ushort); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vara(ncid,varid,start,edges,(void*)value,T_ushort); } int nc_put_vara_uint(int ncid, int varid, - const size_t *start, const size_t *edges, const unsigned int *value) + const size_t *start, const size_t *edges, const unsigned int *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vara(ncid,varid,start,edges,(void*)value,T_uint); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vara(ncid,varid,start,edges,(void*)value,T_uint); } int nc_put_vara_longlong(int ncid, int varid, - const size_t *start, const size_t *edges, const long long *value) + const size_t *start, const size_t *edges, const long long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vara(ncid,varid,start,edges,(void*)value,T_longlong); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vara(ncid,varid,start,edges,(void*)value,T_longlong); } int nc_put_vara_ulonglong(int ncid, int varid, - const size_t *start, const size_t *edges, const unsigned long long *value) + const size_t *start, const size_t *edges, const unsigned long long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vara(ncid,varid,start,edges,(void*)value,NC_UINT64); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vara(ncid,varid,start,edges,(void*)value,NC_UINT64); } #ifdef USE_NETCDF4 int nc_put_vara_string(int ncid, int varid, - const size_t *start, const size_t *edges, const char* *value) + const size_t *start, const size_t *edges, const char* *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vara(ncid,varid,start,edges,(void*)value,NC_STRING); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vara(ncid,varid,start,edges,(void*)value,NC_STRING); } #endif /*USE_NETCDF4*/ int nc_get_vara_text(int ncid, int varid, - const size_t *start, const size_t *edges, char *value) + const size_t *start, const size_t *edges, char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vara(ncid,varid,start,edges,(void*)value,NC_CHAR); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vara(ncid,varid,start,edges,(void*)value,NC_CHAR); } int nc_get_vara_schar(int ncid, int varid, - const size_t *start, const size_t *edges, signed char *value) + const size_t *start, const size_t *edges, signed char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vara(ncid,varid,start,edges,(void*)value,NC_BYTE); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vara(ncid,varid,start,edges,(void*)value,NC_BYTE); } int nc_get_vara_uchar(int ncid, int varid, - const size_t *start, const size_t *edges, unsigned char *value) + const size_t *start, const size_t *edges, unsigned char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vara(ncid,varid,start,edges,(void*)value,T_uchar); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vara(ncid,varid,start,edges,(void*)value,T_uchar); } int nc_get_vara_short(int ncid, int varid, - const size_t *start, const size_t *edges, short *value) + const size_t *start, const size_t *edges, short *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vara(ncid,varid,start,edges,(void*)value,NC_SHORT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vara(ncid,varid,start,edges,(void*)value,NC_SHORT); } int nc_get_vara_int(int ncid, int varid, - const size_t *start, const size_t *edges, int *value) + const size_t *start, const size_t *edges, int *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vara(ncid,varid,start,edges,(void*)value,NC_INT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vara(ncid,varid,start,edges,(void*)value,NC_INT); } int nc_get_vara_long(int ncid, int varid, - const size_t *start, const size_t *edges, long *value) + const size_t *start, const size_t *edges, long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vara(ncid,varid,start,edges,(void*)value,T_long); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vara(ncid,varid,start,edges,(void*)value,T_long); } int nc_get_vara_float(int ncid, int varid, - const size_t *start, const size_t *edges, float *value) + const size_t *start, const size_t *edges, float *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vara(ncid,varid,start,edges,(void*)value,T_float); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vara(ncid,varid,start,edges,(void*)value,T_float); } int nc_get_vara_double(int ncid, int varid, - const size_t *start, const size_t *edges, double *value) + const size_t *start, const size_t *edges, double *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vara(ncid,varid,start,edges,(void*)value,T_double); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vara(ncid,varid,start,edges,(void*)value,T_double); } int nc_get_vara_ubyte(int ncid, int varid, - const size_t *start, const size_t *edges, unsigned char *value) + const size_t *start, const size_t *edges, unsigned char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vara(ncid,varid,start,edges,(void*)value,T_ubyte); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vara(ncid,varid,start,edges,(void*)value,T_ubyte); } int nc_get_vara_ushort(int ncid, int varid, - const size_t *start, const size_t *edges, unsigned short *value) + const size_t *start, const size_t *edges, unsigned short *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vara(ncid,varid,start,edges,(void*)value,T_ushort); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vara(ncid,varid,start,edges,(void*)value,T_ushort); } int nc_get_vara_uint(int ncid, int varid, - const size_t *start, const size_t *edges, unsigned int *value) + const size_t *start, const size_t *edges, unsigned int *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vara(ncid,varid,start,edges,(void*)value,T_uint); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vara(ncid,varid,start,edges,(void*)value,T_uint); } int nc_get_vara_longlong(int ncid, int varid, - const size_t *start, const size_t *edges, long long *value) + const size_t *start, const size_t *edges, long long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vara(ncid,varid,start,edges,(void*)value,T_longlong); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vara(ncid,varid,start,edges,(void*)value,T_longlong); } int nc_get_vara_ulonglong(int ncid, int varid, - const size_t *start, const size_t *edges, unsigned long long *value) + const size_t *start, const size_t *edges, unsigned long long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vara(ncid,varid,start,edges,(void*)value,NC_UINT64); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vara(ncid,varid,start,edges,(void*)value,NC_UINT64); } #ifdef USE_NETCDF4 int nc_get_vara_string(int ncid, int varid, - const size_t *start, const size_t *edges, char* *value) + const size_t *start, const size_t *edges, char* *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vara(ncid,varid,start,edges,(void*)value,NC_STRING); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vara(ncid,varid,start,edges,(void*)value,NC_STRING); } #endif /*USE_NETCDF4*/ int nc_put_varm_text(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - const char *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + const char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_CHAR); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_CHAR); } int nc_put_varm_schar(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - const signed char *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + const signed char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_BYTE); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_BYTE); } int nc_put_varm_uchar(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - const unsigned char *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + const unsigned char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_uchar); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_uchar); } int nc_put_varm_short(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - const short *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + const short *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_SHORT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_SHORT); } int nc_put_varm_int(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - const int *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + const int *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_INT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_INT); } int nc_put_varm_long(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - const long *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + const long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_long); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_long); } int nc_put_varm_float(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - const float *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + const float *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_float); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_float); } int nc_put_varm_double(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - const double *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + const double *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_double); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_double); } int nc_put_varm_ubyte(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - const unsigned char *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + const unsigned char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_ubyte); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_ubyte); } int nc_put_varm_ushort(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - const unsigned short *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + const unsigned short *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_ushort); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_ushort); } int nc_put_varm_uint(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - const unsigned int *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + const unsigned int *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_uint); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_uint); } int nc_put_varm_longlong(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - const long long *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + const long long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_longlong); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_longlong); } int nc_put_varm_ulonglong(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - const unsigned long long *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + const unsigned long long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_UINT64); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_UINT64); } #ifdef USE_NETCDF4 int nc_put_varm_string(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - const char* *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + const char* *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_STRING); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_STRING); } #endif /*USE_NETCDF4*/ int nc_get_varm_text(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - char *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_CHAR); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_CHAR); } int nc_get_varm_schar(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - signed char *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + signed char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_BYTE); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_BYTE); } int nc_get_varm_uchar(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - unsigned char *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + unsigned char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_uchar); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_uchar); } int nc_get_varm_short(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - short *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + short *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_SHORT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_SHORT); } int nc_get_varm_int(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - int *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + int *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_INT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_INT); } int nc_get_varm_long(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - long *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_long); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_long); } int nc_get_varm_float(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - float *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + float *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_float); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_float); } int nc_get_varm_double(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - double *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + double *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_double); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_double); } int nc_get_varm_ubyte(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - unsigned char *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + unsigned char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_ubyte); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_ubyte); } int nc_get_varm_ushort(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - unsigned short *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + unsigned short *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_ushort); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_ushort); } int nc_get_varm_uint(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - unsigned int *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + unsigned int *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_uint); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_uint); } int nc_get_varm_longlong(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - long long *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + long long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_longlong); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,T_longlong); } int nc_get_varm_ulonglong(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - unsigned long long *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + unsigned long long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_UINT64); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_UINT64); } #ifdef USE_NETCDF4 int nc_get_varm_string(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, const ptrdiff_t * imapp, - char* *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, const ptrdiff_t * imapp, + char* *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_STRING); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_varm(ncid,varid,start,edges,stride,imapp,(void*)value,NC_STRING); } #endif /*USE_NETCDF4*/ int nc_put_vars_text(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - const char *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + const char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,NC_CHAR); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,NC_CHAR); } int nc_put_vars_schar(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - const signed char *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + const signed char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,NC_BYTE); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,NC_BYTE); } int nc_put_vars_uchar(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - const unsigned char *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + const unsigned char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,T_uchar); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,T_uchar); } int nc_put_vars_short(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - const short *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + const short *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,NC_SHORT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,NC_SHORT); } int nc_put_vars_int(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - const int *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + const int *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,NC_INT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,NC_INT); } int nc_put_vars_long(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - const long *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + const long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,T_long); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,T_long); } int nc_put_vars_float(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - const float *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + const float *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,T_float); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,T_float); } int nc_put_vars_double(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - const double *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + const double *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,T_double); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,T_double); } int nc_put_vars_ubyte(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - const unsigned char *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + const unsigned char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,T_ubyte); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,T_ubyte); } int nc_put_vars_ushort(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - const unsigned short *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + const unsigned short *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,T_ushort); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,T_ushort); } int nc_put_vars_uint(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - const unsigned int *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + const unsigned int *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,T_uint); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,T_uint); } int nc_put_vars_longlong(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - const long long *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + const long long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,T_longlong); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,T_longlong); } int nc_put_vars_ulonglong(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - const unsigned long long *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + const unsigned long long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,NC_UINT64); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,NC_UINT64); } #ifdef USE_NETCDF4 int nc_put_vars_string(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - const char* *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + const char* *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,NC_STRING); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_put_vars(ncid,varid,start,edges,stride,(void*)value,NC_STRING); } #endif /*USE_NETCDF4*/ int nc_get_vars_text(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - char *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,NC_CHAR); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,NC_CHAR); } int nc_get_vars_schar(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - signed char *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + signed char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,NC_BYTE); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,NC_BYTE); } int nc_get_vars_uchar(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - unsigned char *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + unsigned char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,T_uchar); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,T_uchar); } int nc_get_vars_short(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - short *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + short *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,NC_SHORT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,NC_SHORT); } int nc_get_vars_int(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - int *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + int *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,NC_INT); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,NC_INT); } int nc_get_vars_long(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - long *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,T_long); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,T_long); } int nc_get_vars_float(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - float *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + float *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,T_float); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,T_float); } int nc_get_vars_double(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - double *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + double *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,T_double); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,T_double); } int nc_get_vars_ubyte(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - unsigned char *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + unsigned char *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,T_ubyte); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,T_ubyte); } int nc_get_vars_ushort(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - unsigned short *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + unsigned short *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,T_ushort); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,T_ushort); } int nc_get_vars_uint(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - unsigned int *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + unsigned int *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,T_uint); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,T_uint); } int nc_get_vars_longlong(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - long long *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + long long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,T_longlong); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,T_longlong); } int nc_get_vars_ulonglong(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - unsigned long long *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + unsigned long long *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,NC_UINT64); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,NC_UINT64); } #ifdef USE_NETCDF4 int nc_get_vars_string(int ncid, int varid, - const size_t *start, const size_t *edges, - const ptrdiff_t * stride, - char* *value) + const size_t *start, const size_t *edges, + const ptrdiff_t * stride, + char* *value) { - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,NC_STRING); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + if(stat != NC_NOERR) return stat; + return NC_get_vars(ncid,varid,start,edges,stride,(void*)value,NC_STRING); } #endif /*USE_NETCDF4*/ diff --git a/libsrc4/nc4file.c b/libsrc4/nc4file.c index 85ae3ad88..c94f7ed1a 100755 --- a/libsrc4/nc4file.c +++ b/libsrc4/nc4file.c @@ -1726,8 +1726,7 @@ get_name_by_idx(NC_HDF5_FILE_INFO_T *h5, hid_t hdf_grpid, int i, obj_name, size+1, H5P_DEFAULT) < 0) return NC_EHDFERR; - LOG((4, "get_name_by_idx: encountered HDF5 object obj_class %d obj_name %s", - obj_class, obj_name)); + LOG((4, "get_name_by_idx: encountered HDF5 object obj_name %s", obj_name)); return NC_NOERR; } diff --git a/libsrc4/nc4hdf.c b/libsrc4/nc4hdf.c index 184392fe1..a00e58cc3 100644 --- a/libsrc4/nc4hdf.c +++ b/libsrc4/nc4hdf.c @@ -1192,6 +1192,7 @@ write_netcdf4_dimid(hid_t datasetid, int dimid) #endif /* Does the attribute already exist? If so, don't try to create it. */ + if ((num = H5Aget_num_attrs(datasetid)) < 0) return NC_EHDFERR; for (a = 0; a < num && !found_it; a++) @@ -1229,7 +1230,8 @@ write_netcdf4_dimid(hid_t datasetid, int dimid) #endif if (H5Aclose(dimid_attid) < 0) return NC_EHDFERR; - LOG((4, "write_dim: wrote secret dimid attribute with value %d", dimid)); + LOG((4, "write_netcdf4_dimid: wrote secret dimid attribute with value %d", + dimid)); return NC_NOERR; } @@ -2237,15 +2239,6 @@ write_dim(NC_DIM_INFO_T *dim, NC_GRP_INFO_T *grp, int write_dimid) if (H5DSset_scale(dim->hdf_dimscaleid, dimscale_wo_var) < 0) BAIL(NC_EHDFERR); - /* If desired, write the secret dimid. This will be used - * instead of the dimid that the dimension would otherwise - * receive based on creation order. This can be necessary - * when dims and their coordinate variables were created in - * different order. */ - if (write_dimid) - if ((retval = write_netcdf4_dimid(dim->hdf_dimscaleid, - dim->dimid))) - BAIL(retval); } dim->dirty = 0; } @@ -2308,6 +2301,15 @@ write_dim(NC_DIM_INFO_T *dim, NC_GRP_INFO_T *grp, int write_dimid) strcpy(dim->old_name, ""); } + /* If desired, write the secret dimid. This will be used instead of + * the dimid that the dimension would otherwise receive based on + * creation order. This can be necessary when dims and their + * coordinate variables were created in different order. */ + if (write_dimid && dim->hdf_dimscaleid) + if ((retval = write_netcdf4_dimid(dim->hdf_dimscaleid, + dim->dimid))) + BAIL(retval); + return NC_NOERR; exit: return retval; @@ -2333,20 +2335,16 @@ nc4_rec_write_metadata(NC_GRP_INFO_T *grp) if ((retval = write_attlist(grp->att, NC_GLOBAL, grp))) return retval; - /* For some stupid reason, the dim list is stored backwards! Get to - * the back of the list. */ - for (dim = grp->dim; dim && dim->next; dim = dim->next) - ; - /* If the user writes coord vars in a different order then he * defined their dimensions, then, when the file is reopened, the * order of the dimids will change to match the order of the coord * vars. Detect if this is about to happen. */ for (var = grp->var; var; var = var->next) { - if (var->ndims) + LOG((5, "checking %s for out of order coord var", var->name)); + if (var->ndims && var->dimscale) { - if (var->dimscale && var->dimids[0] < last_dimid) + if (var->dimids[0] < last_dimid) { bad_coord_order++; break; @@ -2354,7 +2352,25 @@ nc4_rec_write_metadata(NC_GRP_INFO_T *grp) last_dimid = var->dimids[0]; } } + + /* Did the user define a dimension, end define mode, reenter define + * mode, and then define a coordinate variable for that dimension? + * If so, dimensions will be out of order. */ + for (var = grp->var; var; var = var->next) + if (var->dirty && !var->created && var->ndims) + for (dim = grp->dim; dim && dim->next; dim = dim->next) + if (strcmp(dim->name, var->name) && !dim->dirty) + { + LOG((5, "coord var defined after enddef/redef")); + bad_coord_order++; + } + + /* For some stupid reason, the dim list is stored backwards! Get to + * the back of the list. */ + for (dim = grp->dim; dim && dim->next; dim = dim->next) + ; + /* Set the pointer to the beginning of the list of vars in this * group. */ var = grp->var; diff --git a/libsrc4/tst_vars3.c b/libsrc4/tst_vars3.c index d49f57b60..b411e45e0 100644 --- a/libsrc4/tst_vars3.c +++ b/libsrc4/tst_vars3.c @@ -27,8 +27,127 @@ main(int argc, char **argv) { printf("\n*** Testing netcdf-4 variable functions, some more.\n"); - printf("**** testing endianness of compound type variable..."); + printf("**** testing definition of coordinate variable after endef/redef..."); + { +#define NX 6 +#define NY 36 +#define D1_NAME "zD1" +#define D2_NAME "D2" + int ncid, x_dimid, y_dimid, varid2; + char name_in[NC_MAX_NAME + 1]; + + /* Create file with two dims, two 1D vars. */ + if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR; + if (nc_def_dim(ncid, D1_NAME, NX, &x_dimid)) ERR; + if (nc_def_dim(ncid, D2_NAME, NY, &y_dimid)) ERR; + if (nc_enddef(ncid)) ERR; + + /* Go back into define mode and add a coordinate variable. Now + * dimensions will be out of order. Thanks for confusing my poor + * library. Why can't you just make up your bloody mind? */ + if (nc_redef(ncid)) ERR; + if (nc_def_var(ncid, D1_NAME, NC_DOUBLE, NDIMS1, &x_dimid, &varid2)) ERR; + if (nc_close(ncid)) ERR; + + /* Reopen file and check the name of the first dimension. Even + * though you've changed the order after doing a redef, you will + * still expect to get D1_NAME. I sure hope you appreciate how + * hard you are making life for a poor C library, just trying to + * do its best in a demanding world. Next time, why don't you + * try and be a little bit more considerate? Jerk. */ + if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR; + if (nc_inq_dimname(ncid, 0, name_in)) ERR; + if (strcmp(name_in, D1_NAME)) ERR; + if (nc_inq_dimname(ncid, 1, name_in)) ERR; + if (strcmp(name_in, D2_NAME)) ERR; + if (nc_close(ncid)) ERR; + } + SUMMARIZE_ERR; + printf("**** testing definition of coordinate variable with some data..."); + { +#define NX 6 +#define NY 36 +#define V1_NAME "V1" +#define D1_NAME "D1" +#define D2_NAME "D2" + + int ncid, x_dimid, y_dimid, varid1, varid2; + int nvars, ndims, ngatts, unlimdimid, dimids_in[2], natts; + double data_outx[NX], data_outy[NY]; + int x, y, retval; + size_t len_in; + char name_in[NC_MAX_NAME + 1]; + nc_type xtype_in; + + /* Create some pretend data. */ + for (x = 0; x < NX; x++) + data_outx[x] = x; + for (y = 0; y < NY; y++) + data_outy[y] = y; + + /* Create file with two dims, two 1D vars. */ + if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR; + if (nc_def_dim(ncid, D1_NAME, NX, &x_dimid)) ERR; + if (nc_def_dim(ncid, D2_NAME, NY, &y_dimid)) ERR; + if (nc_def_var(ncid, V1_NAME, NC_DOUBLE, NDIMS1, &y_dimid, &varid1)) ERR; + if (nc_enddef(ncid)) ERR; + if (nc_redef(ncid)) ERR; + if (nc_def_var(ncid, D1_NAME, NC_DOUBLE, NDIMS1, &x_dimid, &varid2)) ERR; + +/* if (nc_put_var_double(ncid, varid1, &data_outy[0])) ERR; */ +/* if (nc_put_var_double(ncid, varid2, &data_outx[0])) ERR; */ +/* if (nc_sync(ncid)) ERR; */ + + /* Check the file. */ + if (nc_inq(ncid, &ndims, &nvars, &ngatts, &unlimdimid)) ERR; + if (nvars != 2 || ndims != 2 || ngatts != 0 || unlimdimid != -1) ERR; + + /* Check the dimensions. */ + if (nc_inq_dimids(ncid, &ndims, dimids_in, 1)) ERR; + if (ndims != 2 || dimids_in[0] != x_dimid || dimids_in[1] != y_dimid) ERR; + if (nc_inq_dim(ncid, dimids_in[0], name_in, &len_in)) ERR; + if (strcmp(name_in, D1_NAME) || len_in != NX) ERR; + if (nc_inq_dim(ncid, dimids_in[1], name_in, &len_in)) ERR; + if (strcmp(name_in, D2_NAME) || len_in != NY) ERR; + + /* Check the variables. */ + if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims, dimids_in, &natts)) ERR; + if (strcmp(name_in, V1_NAME) || xtype_in != NC_DOUBLE || ndims != 1 || + natts != 0 || dimids_in[0] != y_dimid) ERR; + if (nc_inq_var(ncid, 1, name_in, &xtype_in, &ndims, dimids_in, &natts)) ERR; + if (strcmp(name_in, D1_NAME) || xtype_in != NC_DOUBLE || ndims != 1 || + natts != 0 || dimids_in[0] != x_dimid) ERR; + + /* Close the file. */ + if (nc_close(ncid)) ERR; + + /* Reopen and check the file. */ + if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR; + if (nc_inq(ncid, &ndims, &nvars, &ngatts, &unlimdimid)) ERR; + if (nvars != 2 || ndims != 2 || ngatts != 0 || unlimdimid != -1) ERR; + + /* Check the dimensions. */ + if (nc_inq_dimids(ncid, &ndims, dimids_in, 1)) ERR; + if (ndims != 2 || dimids_in[0] != x_dimid || dimids_in[1] != y_dimid) ERR; + if (nc_inq_dim(ncid, dimids_in[0], name_in, &len_in)) ERR; + if (strcmp(name_in, D1_NAME) || len_in != NX) ERR; + if (nc_inq_dim(ncid, dimids_in[1], name_in, &len_in)) ERR; + if (strcmp(name_in, D2_NAME) || len_in != NY) ERR; + + /* Check the variables. */ + if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims, dimids_in, &natts)) ERR; + if (strcmp(name_in, V1_NAME) || xtype_in != NC_DOUBLE || ndims != 1 || + natts != 0 || dimids_in[0] != y_dimid) ERR; + if (nc_inq_var(ncid, 1, name_in, &xtype_in, &ndims, dimids_in, &natts)) ERR; + if (strcmp(name_in, D1_NAME) || xtype_in != NC_DOUBLE || ndims != 1 || + natts != 0 || dimids_in[0] != x_dimid) ERR; + + if (nc_close(ncid)) ERR; + + } + SUMMARIZE_ERR; + printf("**** testing endianness of compound type variable..."); { #define COMPOUND_NAME "Billy-Bob" #define BILLY "Billy" @@ -67,10 +186,8 @@ main(int argc, char **argv) natts_in != 0) ERR; if (nc_close(ncid)) ERR; } - SUMMARIZE_ERR; printf("**** testing that fixed vars with no filter end up being contiguous..."); - { #define VAR_NAME2 "Yoman_of_the_Guard" #define NDIMS 2 @@ -159,7 +276,6 @@ main(int argc, char **argv) if (nc_close(ncid)) ERR; } - SUMMARIZE_ERR; printf("**** testing large number of vars with unlimited dimension..."); { @@ -189,7 +305,7 @@ main(int argc, char **argv) if (nvars != NUM_VARS || ndims != 1 || ngatts != 0 || unlimdimid != 0) ERR; if (nc_close(ncid)) ERR; } - SUMMARIZE_ERR; + SUMMARIZE_ERR; /* #ifdef USE_SZIP */ /* printf("**** testing that szip works..."); */ /* { */