mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
Refactor macro _FillValue to NC_FillValue in support of https://github.com/Unidata/netcdf-c/issues/2858
This commit is contained in:
parent
fc02ef4e75
commit
c26f7eabf4
@ -110,7 +110,7 @@ extern "C" {
|
||||
* the same type as the variable and this reserved name. The value you
|
||||
* give the attribute will be used as the fill value for that
|
||||
* variable. */
|
||||
#define _FillValue "_FillValue"
|
||||
#define NC_FillValue "_FillValue"
|
||||
#define NC_FILL 0 /**< Argument to nc_set_fill() to clear NC_NOFILL */
|
||||
#define NC_NOFILL 0x100 /**< Argument to nc_set_fill() to turn off filling of data. */
|
||||
|
||||
|
@ -564,7 +564,7 @@ nc4_put_att(NC_GRP_INFO_T* grp, int varid, const char *name, nc_type file_type,
|
||||
* Since fill mismatch is no longer required, we need to convert the
|
||||
* att's type to the vars's type as part of storing.
|
||||
*/
|
||||
if (!strcmp(att->hdr.name, _FillValue) && varid != NC_GLOBAL)
|
||||
if (!strcmp(att->hdr.name, NC_FillValue) && varid != NC_GLOBAL)
|
||||
{
|
||||
/* Fill value must have exactly one value */
|
||||
if (len != 1)
|
||||
|
@ -673,17 +673,17 @@ nc_def_var_extra(int ncid, int varid, int *shuffle, int *unused1,
|
||||
var->hdr.name));
|
||||
|
||||
/* If there's a _FillValue attribute, delete it. */
|
||||
retval = NC4_HDF5_del_att(ncid, varid, _FillValue);
|
||||
retval = NC4_HDF5_del_att(ncid, varid, NC_FillValue);
|
||||
if (retval && retval != NC_ENOTATT)
|
||||
return retval;
|
||||
|
||||
/* Create a _FillValue attribute; will also fill in var->fill_value */
|
||||
if ((retval = nc_put_att(ncid, varid, _FillValue, var->type_info->hdr.id,
|
||||
if ((retval = nc_put_att(ncid, varid, NC_FillValue, var->type_info->hdr.id,
|
||||
1, fill_value)))
|
||||
return retval;
|
||||
} else if (var->fill_value && no_fill && (*no_fill)) { /* Turning off fill value? */
|
||||
/* If there's a _FillValue attribute, delete it. */
|
||||
retval = NC4_HDF5_del_att(ncid, varid, _FillValue);
|
||||
retval = NC4_HDF5_del_att(ncid, varid, NC_FillValue);
|
||||
if (retval && retval != NC_ENOTATT) return retval;
|
||||
if((retval = NC_reclaim_data_all(h5->controller,var->type_info->hdr.id,var->fill_value,1))) return retval;
|
||||
var->fill_value = NULL;
|
||||
|
@ -581,7 +581,7 @@ ncz_put_att(NC_GRP_INFO_T* grp, int varid, const char *name, nc_type file_type,
|
||||
* copy the value to the fill_value pointer of the NC_VAR_INFO_T
|
||||
* struct for this var. (But ignore a global _FillValue
|
||||
* attribute). Also kill the cache fillchunk as no longer valid */
|
||||
if (!strcmp(att->hdr.name, _FillValue) && varid != NC_GLOBAL)
|
||||
if (!strcmp(att->hdr.name, NC_FillValue) && varid != NC_GLOBAL)
|
||||
{
|
||||
/* Fill value must have exactly one value */
|
||||
if (len != 1)
|
||||
@ -991,12 +991,12 @@ ncz_create_fillvalue(NC_VAR_INFO_T* var)
|
||||
/* Make sure _FillValue does not exist */
|
||||
for(i=0;i<ncindexsize(var->att);i++) {
|
||||
fv = (NC_ATT_INFO_T*)ncindexith(var->att,i);
|
||||
if(strcmp(fv->hdr.name,_FillValue)==0) break;
|
||||
if(strcmp(fv->hdr.name,NC_FillValue)==0) break;
|
||||
fv = NULL;
|
||||
}
|
||||
if(fv == NULL) {
|
||||
/* Create it */
|
||||
if((stat = ncz_makeattr((NC_OBJ*)var,var->att,_FillValue,var->type_info->hdr.id,1,var->fill_value,&fv)))
|
||||
if((stat = ncz_makeattr((NC_OBJ*)var,var->att,NC_FillValue,var->type_info->hdr.id,1,var->fill_value,&fv)))
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
@ -727,19 +727,19 @@ ncz_def_var_extra(int ncid, int varid, int *shuffle, int *unused1,
|
||||
var->hdr.name));
|
||||
|
||||
/* If there's a _FillValue attribute, delete it. */
|
||||
retval = NCZ_del_att(ncid, varid, _FillValue);
|
||||
retval = NCZ_del_att(ncid, varid, NC_FillValue);
|
||||
if (retval && retval != NC_ENOTATT)
|
||||
goto done;
|
||||
|
||||
/* Create a _FillValue attribute; will also fill in var->fill_value */
|
||||
if ((retval = nc_put_att(ncid, varid, _FillValue, var->type_info->hdr.id,
|
||||
if ((retval = nc_put_att(ncid, varid, NC_FillValue, var->type_info->hdr.id,
|
||||
1, fill_value)))
|
||||
goto done;
|
||||
/* Reclaim any existing fill_chunk */
|
||||
if((retval = NCZ_reclaim_fill_chunk(zvar->cache))) goto done;
|
||||
} else if (var->fill_value && no_fill && (*no_fill)) { /* Turning off fill value? */
|
||||
/* If there's a _FillValue attribute, delete it. */
|
||||
retval = NCZ_del_att(ncid, varid, _FillValue);
|
||||
retval = NCZ_del_att(ncid, varid, NC_FillValue);
|
||||
if (retval && retval != NC_ENOTATT) return retval;
|
||||
if((retval = NCZ_reclaim_fill_value(var))) return retval;
|
||||
}
|
||||
|
@ -1726,7 +1726,7 @@ NC3_inq_var_fill(const NC_var *varp, void *fill_value)
|
||||
/*
|
||||
* find fill value
|
||||
*/
|
||||
attrpp = NC_findattr(&varp->attrs, _FillValue);
|
||||
attrpp = NC_findattr(&varp->attrs, NC_FillValue);
|
||||
if ( attrpp != NULL ) {
|
||||
const void *xp;
|
||||
/* User defined fill value */
|
||||
|
@ -156,7 +156,7 @@ fill_NC_var(NC3_INFO* ncp, const NC_var *varp, long long varsize, size_t recno)
|
||||
/*
|
||||
* Set up fill value
|
||||
*/
|
||||
attrpp = NC_findattr(&varp->attrs, _FillValue);
|
||||
attrpp = NC_findattr(&varp->attrs, NC_FillValue);
|
||||
if( attrpp != NULL )
|
||||
{
|
||||
/* User defined fill value */
|
||||
|
@ -720,7 +720,7 @@ NC3_inq_var(int ncid,
|
||||
if (no_fillp != NULL) *no_fillp = varp->no_fill;
|
||||
|
||||
if (fill_valuep != NULL) {
|
||||
status = nc_get_att(ncid, varid, _FillValue, fill_valuep);
|
||||
status = nc_get_att(ncid, varid, NC_FillValue, fill_valuep);
|
||||
if (status != NC_NOERR && status != NC_ENOTATT)
|
||||
return status;
|
||||
if (status == NC_ENOTATT) {
|
||||
@ -854,12 +854,12 @@ NC3_def_var_fill(int ncid,
|
||||
if (fill_value != NULL && !varp->no_fill) {
|
||||
|
||||
/* If there's a _FillValue attribute, delete it. */
|
||||
status = NC3_del_att(ncid, varid, _FillValue);
|
||||
status = NC3_del_att(ncid, varid, NC_FillValue);
|
||||
if (status != NC_NOERR && status != NC_ENOTATT)
|
||||
return status;
|
||||
|
||||
/* Create/overwrite attribute _FillValue */
|
||||
status = NC3_put_att(ncid, varid, _FillValue, varp->type, 1, fill_value, varp->type);
|
||||
status = NC3_put_att(ncid, varid, NC_FillValue, varp->type, 1, fill_value, varp->type);
|
||||
if (status != NC_NOERR) return status;
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ static const char * const reqattr[] = {
|
||||
"SCALEMIN",
|
||||
"SCALEMAX",
|
||||
"FIELDNAM",
|
||||
_FillValue
|
||||
NC_FillValue
|
||||
};
|
||||
#define NUM_RATTRS 6
|
||||
|
||||
@ -399,9 +399,9 @@ main(int argc, char *argv[])
|
||||
{
|
||||
int ifill = -1; double dfill = -9999;
|
||||
assert( nc_put_att_int(id, Long_id,
|
||||
_FillValue, NC_INT, 1, &ifill) == NC_NOERR);
|
||||
NC_FillValue, NC_INT, 1, &ifill) == NC_NOERR);
|
||||
assert( nc_put_att_double(id, Double_id,
|
||||
_FillValue, NC_DOUBLE, 1, &dfill) == NC_NOERR);
|
||||
NC_FillValue, NC_DOUBLE, 1, &dfill) == NC_NOERR);
|
||||
}
|
||||
|
||||
#ifdef REDEF
|
||||
|
@ -36,7 +36,7 @@ main(int argc, char **argv)
|
||||
|
||||
/* try put attribute _FillValue and expect NC_ELATEFILL */
|
||||
fillv = 9;
|
||||
err = nc_put_att_int(ncid, varid, _FillValue, NC_INT, 1, &fillv);
|
||||
err = nc_put_att_int(ncid, varid, NC_FillValue, NC_INT, 1, &fillv);
|
||||
if (err != NC_ELATEFILL)
|
||||
printf("line %d expecting NC_ELATEFILL but got %d\n",__LINE__,err);
|
||||
err = nc_close(ncid); ERR_CHK;
|
||||
|
@ -360,14 +360,14 @@ main()
|
||||
|
||||
/* Write to the variable's fill-value */
|
||||
vlstr = NULL;
|
||||
if (nc_put_att(ncid, varid, _FillValue, NC_STRING, 1, &vlstr)) ERR;
|
||||
if (nc_put_att(ncid, varid, NC_FillValue, NC_STRING, 1, &vlstr)) ERR;
|
||||
|
||||
vlstr = malloc(10);
|
||||
*vlstr = '\0';
|
||||
if (nc_put_att(ncid, varid, _FillValue, NC_STRING, 1, &vlstr)) ERR;
|
||||
if (nc_put_att(ncid, varid, NC_FillValue, NC_STRING, 1, &vlstr)) ERR;
|
||||
|
||||
strcpy(vlstr, "foo");
|
||||
if (nc_put_att(ncid, varid, _FillValue, NC_STRING, 1, &vlstr)) ERR;
|
||||
if (nc_put_att(ncid, varid, NC_FillValue, NC_STRING, 1, &vlstr)) ERR;
|
||||
free(vlstr);
|
||||
|
||||
|
||||
|
@ -1005,9 +1005,9 @@ main(int argc, char **argv)
|
||||
if (nc_create(FILE_NAME, mode, &ncid)) ERR;
|
||||
if (nc_def_dim(ncid, DIM_NAME_1, DIM_LEN_5, &dimid)) ERR;
|
||||
if (nc_def_var(ncid, VAR_NAME_1, NC_FLOAT, NDIM1, &dimid, &varid1)) ERR;
|
||||
if (nc_put_att_float(ncid, varid1, _FillValue, NC_FLOAT, 1, &custom_fill_float)) ERR;
|
||||
if (nc_put_att_float(ncid, varid1, NC_FillValue, NC_FLOAT, 1, &custom_fill_float)) ERR;
|
||||
if (nc_def_var(ncid, VAR_NAME_2, NC_DOUBLE, NDIM1, &dimid, &varid2)) ERR;
|
||||
if (nc_put_att_double(ncid, varid2, _FillValue, NC_DOUBLE, 1, &custom_fill_double)) ERR;
|
||||
if (nc_put_att_double(ncid, varid2, NC_FillValue, NC_DOUBLE, 1, &custom_fill_double)) ERR;
|
||||
|
||||
/* Turn on quantize for both vars. */
|
||||
if (nc_def_var_quantize(ncid, varid1, quantize_mode[q], NSD_3)) ERR;
|
||||
|
@ -450,7 +450,7 @@ main(int argc, char **argv)
|
||||
/* Create a scalar variable for the empty string. */
|
||||
if (nc_def_var(ncid, VAR_NAME2, NC_STRING, 0, NULL, &varid2)) ERR;
|
||||
if (dim_combo == 3)
|
||||
if (nc_put_att(ncid, varid, _FillValue, NC_STRING, 1, my_string_fill)) ERR;
|
||||
if (nc_put_att(ncid, varid, NC_FillValue, NC_STRING, 1, my_string_fill)) ERR;
|
||||
|
||||
/* Check some stuff. */
|
||||
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
|
||||
|
@ -1080,9 +1080,9 @@ main(int argc, char **argv)
|
||||
if (nc_def_var(ncid, VAR7_NAME, NC_USHORT, NDIMS, dimids, &varid)) ERR;
|
||||
if (nc_def_var(ncid, VAR8_NAME, NC_USHORT, NDIMS, dimids, &varid2)) ERR;
|
||||
if (nc_def_var(ncid, VAR9_NAME, NC_USHORT, NDIMS, dimids, &varid3)) ERR;
|
||||
if (nc_put_att(ncid, varid3, _FillValue, NC_USHORT, 1, &my_fill_value2)) ERR;
|
||||
if (nc_put_att(ncid, varid3, NC_FillValue, NC_USHORT, 1, &my_fill_value2)) ERR;
|
||||
if (nc_def_var(ncid, VAR10_NAME, NC_USHORT, NDIMS, dimids, &varid4)) ERR;
|
||||
if (nc_put_att(ncid, varid4, _FillValue, NC_USHORT, 1, &my_fill_value2)) ERR;
|
||||
if (nc_put_att(ncid, varid4, NC_FillValue, NC_USHORT, 1, &my_fill_value2)) ERR;
|
||||
|
||||
/* Check stuff. */
|
||||
if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims, dimids_in,
|
||||
|
@ -87,11 +87,11 @@ main(int argc, char **argv)
|
||||
if (nc_create(FILE_NAME2, cmode, &ncid)) ERR;
|
||||
if (nc_def_dim(ncid, VAR_NAME, TEST_VAL_42, &dimid)) ERR;
|
||||
if (nc_def_var(ncid, VAR_NAME, NC_BYTE, 1, &dimid, &varid)) ERR;
|
||||
if (nc_put_att_schar(ncid, varid, _FillValue, NC_BYTE, 1, &fill_value)) ERR;
|
||||
if (nc_put_att_schar(ncid, varid, NC_FillValue, NC_BYTE, 1, &fill_value)) ERR;
|
||||
if (nc_enddef(ncid)) ERR;
|
||||
if (nc_put_var1(ncid, varid, index, &schar_data)) ERR;
|
||||
if (nc_redef(ncid)) ERR;
|
||||
if (nc_put_att_schar(ncid, varid, _FillValue, NC_BYTE, 1,
|
||||
if (nc_put_att_schar(ncid, varid, NC_FillValue, NC_BYTE, 1,
|
||||
&fill_value) != expected_ret) ERR;
|
||||
if (nc_close(ncid)) ERR;
|
||||
|
||||
@ -101,9 +101,9 @@ main(int argc, char **argv)
|
||||
if (nvars_in != 1 || varids_in[0] != 0) ERR;
|
||||
if (nc_inq_varname(ncid, 0, name_in)) ERR;
|
||||
if (strcmp(name_in, VAR_NAME)) ERR;
|
||||
if (nc_inq_att(ncid, varid, _FillValue, &xtype_in, &len_in)) ERR;
|
||||
if (nc_inq_att(ncid, varid, NC_FillValue, &xtype_in, &len_in)) ERR;
|
||||
if (xtype_in != NC_BYTE || len_in != 1) ERR;
|
||||
if (nc_get_att(ncid, varid, _FillValue, &fill_value_in)) ERR;
|
||||
if (nc_get_att(ncid, varid, NC_FillValue, &fill_value_in)) ERR;
|
||||
if (fill_value_in != fill_value) ERR;
|
||||
if (nc_close(ncid)) ERR;
|
||||
}
|
||||
@ -119,7 +119,7 @@ main(int argc, char **argv)
|
||||
if (nc_create(FILE_NAME, cmode, &ncid)) ERR;
|
||||
if (nc_def_dim(ncid, DIM1_NAME, DIM1_LEN, &dimids[0])) ERR;
|
||||
if (nc_def_var(ncid, VAR_NAME, NC_BYTE, NUM_DIMS, dimids, &varid)) ERR;
|
||||
if (nc_put_att_schar(ncid, varid, _FillValue, NC_BYTE, 1, &fill_value)) ERR;
|
||||
if (nc_put_att_schar(ncid, varid, NC_FillValue, NC_BYTE, 1, &fill_value)) ERR;
|
||||
if (nc_enddef(ncid)) ERR;
|
||||
|
||||
/* Write the second record. */
|
||||
@ -154,9 +154,9 @@ main(int argc, char **argv)
|
||||
if (strcmp(name_in, VAR_NAME)) ERR;
|
||||
|
||||
/* Check fill value att. */
|
||||
if (nc_inq_att(ncid, varid, _FillValue, &xtype_in, &len_in)) ERR;
|
||||
if (nc_inq_att(ncid, varid, NC_FillValue, &xtype_in, &len_in)) ERR;
|
||||
if (xtype_in != NC_BYTE || len_in != 1) ERR;
|
||||
if (nc_get_att(ncid, varid, _FillValue, &fill_value_in)) ERR;
|
||||
if (nc_get_att(ncid, varid, NC_FillValue, &fill_value_in)) ERR;
|
||||
if (fill_value_in != fill_value) ERR;
|
||||
|
||||
/* Read the first record, it should be the fill value. */
|
||||
@ -185,7 +185,7 @@ main(int argc, char **argv)
|
||||
if (nc_def_dim(ncid, DIM1_NAME, DIM1_LEN, &dimids[0])) ERR;
|
||||
if (nc_def_var(ncid, VAR_NAME, NC_BYTE, NUM_DIMS, dimids, &varid)) ERR;
|
||||
if (nc_put_att_int(ncid, varid, LOSSES_NAME, NC_INT, 1, &losses_value)) ERR;
|
||||
if (nc_put_att_schar(ncid, varid, _FillValue, NC_BYTE, 1, &fill_value)) ERR;
|
||||
if (nc_put_att_schar(ncid, varid, NC_FillValue, NC_BYTE, 1, &fill_value)) ERR;
|
||||
if (nc_close(ncid)) ERR;
|
||||
|
||||
/* Open the file and check. */
|
||||
@ -194,13 +194,13 @@ main(int argc, char **argv)
|
||||
if (xtype_in != NC_INT || len_in != 1) ERR;
|
||||
if (nc_get_att(ncid, 0, LOSSES_NAME, &losses_value_in)) ERR;
|
||||
if (losses_value_in != losses_value) ERR;
|
||||
if (nc_inq_att(ncid, 0, _FillValue, &xtype_in, &len_in)) ERR;
|
||||
if (nc_inq_att(ncid, 0, NC_FillValue, &xtype_in, &len_in)) ERR;
|
||||
if (xtype_in != NC_BYTE || len_in != 1) ERR;
|
||||
if (nc_get_att(ncid, 0, _FillValue, &fill_value_in)) ERR;
|
||||
if (nc_get_att(ncid, 0, NC_FillValue, &fill_value_in)) ERR;
|
||||
if (fill_value_in != fill_value) ERR;
|
||||
if (nc_inq_attid(ncid, 0, LOSSES_NAME, &attnum_in)) ERR;
|
||||
if (attnum_in != 0) ERR;
|
||||
if (nc_inq_attid(ncid, 0, _FillValue, &attnum_in)) ERR;
|
||||
if (nc_inq_attid(ncid, 0, NC_FillValue, &attnum_in)) ERR;
|
||||
if (attnum_in != 1) ERR;
|
||||
if (nc_close(ncid)) ERR;
|
||||
}
|
||||
@ -223,7 +223,7 @@ main(int argc, char **argv)
|
||||
if (nc_def_var(ncid, VAR_NAME, NC_BYTE, NUM_DIMS, dimids, &varid)) ERR;
|
||||
for (a = 0; a < NUM_LEADERS; a++)
|
||||
if (nc_put_att_short(ncid, varid, leader[a], NC_SHORT, 1, &hair_length[a])) ERR;
|
||||
if (nc_put_att_schar(ncid, varid, _FillValue, NC_BYTE, 1, &fill_value)) ERR;
|
||||
if (nc_put_att_schar(ncid, varid, NC_FillValue, NC_BYTE, 1, &fill_value)) ERR;
|
||||
if (nc_close(ncid)) ERR;
|
||||
|
||||
/* Open the file. */
|
||||
@ -241,9 +241,9 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Check our fill value attribute. */
|
||||
if (nc_inq_att(ncid, 0, _FillValue, &xtype_in, &len_in)) ERR;
|
||||
if (nc_inq_att(ncid, 0, NC_FillValue, &xtype_in, &len_in)) ERR;
|
||||
if (xtype_in != NC_BYTE || len_in != 1) ERR;
|
||||
if (nc_get_att(ncid, 0, _FillValue, &fill_value_in)) ERR;
|
||||
if (nc_get_att(ncid, 0, NC_FillValue, &fill_value_in)) ERR;
|
||||
if (fill_value_in != fill_value) ERR;
|
||||
|
||||
if (nc_close(ncid)) ERR;
|
||||
@ -302,7 +302,7 @@ main(int argc, char **argv)
|
||||
/* Now add a fill value. This will acutually cause HDF5 to
|
||||
* destroy the dataset and recreate it, recreating also the
|
||||
* three attributes that are attached to it. */
|
||||
if (nc_put_att(ncid, varid, _FillValue, NC_FLOAT,
|
||||
if (nc_put_att(ncid, varid, NC_FillValue, NC_FLOAT,
|
||||
1, &fill_value)) ERR;
|
||||
|
||||
/* Check to ensure the atts have their expected attnums. */
|
||||
@ -319,7 +319,7 @@ main(int argc, char **argv)
|
||||
if (attnum_in != 0) ERR;
|
||||
if (nc_inq_attid(ncid, 0, UNITS, &attnum_in)) ERR;
|
||||
if (attnum_in != 1) ERR;
|
||||
if (nc_inq_attid(ncid, 0, _FillValue, &attnum_in)) ERR;
|
||||
if (nc_inq_attid(ncid, 0, NC_FillValue, &attnum_in)) ERR;
|
||||
if (attnum_in != 2) ERR;
|
||||
|
||||
if (nc_close(ncid)) ERR;
|
||||
@ -388,14 +388,14 @@ main(int argc, char **argv)
|
||||
/* Now add a fill value. This will acutually cause HDF5 to
|
||||
* destroy the dataset and recreate it, recreating also the
|
||||
* three attributes that are attached to it. */
|
||||
ncattput(ncid, varid, _FillValue, NC_FLOAT, 1, &fill_value);
|
||||
ncattput(ncid, varid, NC_FillValue, NC_FLOAT, 1, &fill_value);
|
||||
|
||||
/* Check to ensure the atts have their expected attnums. */
|
||||
if (nc_inq_attid(ncid, 0, LONG_NAME, &attnum_in)) ERR;
|
||||
if (attnum_in != 0) ERR;
|
||||
if (nc_inq_attid(ncid, 0, UNITS, &attnum_in)) ERR;
|
||||
if (attnum_in != 1) ERR;
|
||||
if (nc_inq_attid(ncid, 0, _FillValue, &attnum_in)) ERR;
|
||||
if (nc_inq_attid(ncid, 0, NC_FillValue, &attnum_in)) ERR;
|
||||
if (attnum_in != 2) ERR;
|
||||
|
||||
ncclose(ncid);
|
||||
@ -406,7 +406,7 @@ main(int argc, char **argv)
|
||||
if (attnum_in != 0) ERR;
|
||||
if (nc_inq_attid(ncid, 0, UNITS, &attnum_in)) ERR;
|
||||
if (attnum_in != 1) ERR;
|
||||
if (nc_inq_attid(ncid, 0, _FillValue, &attnum_in)) ERR;
|
||||
if (nc_inq_attid(ncid, 0, NC_FillValue, &attnum_in)) ERR;
|
||||
if (attnum_in != 2) ERR;
|
||||
ncclose(ncid);
|
||||
}
|
||||
|
@ -779,7 +779,7 @@ pr_att(
|
||||
printf ("\t\t");
|
||||
#ifdef USE_NETCDF4
|
||||
if (is_user_defined_type(att.type) || att.type == NC_STRING
|
||||
|| (formatting_specs.xopt_filltype && varid != NC_GLOBAL && strcmp(_FillValue,att.name)==0))
|
||||
|| (formatting_specs.xopt_filltype && varid != NC_GLOBAL && strcmp(NC_FillValue,att.name)==0))
|
||||
#else
|
||||
if (is_user_defined_type(att.type))
|
||||
#endif
|
||||
@ -1511,11 +1511,11 @@ get_fill_info(int ncid, int varid, ncvar_t *vp)
|
||||
vp->has_fillval = 1; /* by default, but turn off for bytes */
|
||||
|
||||
/* get _FillValue attribute */
|
||||
nc_status = nc_inq_att(ncid,varid,_FillValue,&att.type,&att.len);
|
||||
nc_status = nc_inq_att(ncid,varid,NC_FillValue,&att.type,&att.len);
|
||||
fillvalp = ecalloc(vp->tinfo->size + 1);
|
||||
if(nc_status == NC_NOERR &&
|
||||
att.type == vp->type && att.len == 1) {
|
||||
NC_CHECK(nc_get_att(ncid, varid, _FillValue, fillvalp));
|
||||
NC_CHECK(nc_get_att(ncid, varid, NC_FillValue, fillvalp));
|
||||
} else {
|
||||
switch (vp->type) {
|
||||
case NC_BYTE:
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "isnan.h"
|
||||
|
||||
#define FILE8_NAME "tst_nans.nc"
|
||||
#define FV_NAME _FillValue /* defined in netcdf.h */
|
||||
#define FV_NAME NC_FillValue /* defined in netcdf.h */
|
||||
#define FV_NVALS 1
|
||||
#define ATT_NAME "att"
|
||||
#define NDIMS 1
|
||||
|
@ -2264,13 +2264,13 @@ void equalatt(void)
|
||||
/* shrink space down to what was really needed */
|
||||
att_space = erealloc(att_space, valnum*nctypesize(valtype));
|
||||
atts[natts].val = att_space;
|
||||
if (STREQ(atts[natts].name, _FillValue) &&
|
||||
if (STREQ(atts[natts].name, NC_FillValue) &&
|
||||
atts[natts].var != NC_GLOBAL) {
|
||||
nc_putfill(atts[natts].type,atts[natts].val,
|
||||
&vars[atts[natts].var].fill_value);
|
||||
if(atts[natts].type != vars[atts[natts].var].type) {
|
||||
derror("variable %s: %s type mismatch",
|
||||
vars[atts[natts].var].name, _FillValue);
|
||||
vars[atts[natts].var].name, NC_FillValue);
|
||||
}
|
||||
}
|
||||
natts++;
|
||||
|
Loading…
Reference in New Issue
Block a user