Skip to content

Commit

Permalink
Merge pull request #2911 from WardF/refactor_fillvalue_macro.wif
Browse files Browse the repository at this point in the history
  • Loading branch information
WardF authored Apr 24, 2024
2 parents fc02ef4 + 2b0b18b commit 73b9f18
Show file tree
Hide file tree
Showing 19 changed files with 54 additions and 53 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This file contains a high-level description of this package's evolution. Release

## 4.9.3 - TBD

* Refactor macro `_FillValue` to `NC_FillValue` to avoid conflict with libc++ headers. See [Github #2858](https://github.com/Unidata/netcdf-c/issues/2858) for more information.
* Changed `cmake` build options to be prefaced with `NETCDF`, to bring things in to line with best practices. This will permit a number of overall quality of life improvements to netCDF, in terms of allowing it to be more easily integrated with upstream projects via `FetchContent()`, `subdirectory()`, etc. Currently, the naming convention in use thus far will still work, but will result in warning messages about deprecation, and instructions on how to update your workflow. See [Github #2895](https://github.com/Unidata/netcdf-c/pull/2895) for more information.
* Fix some problems in handling S3 urls with missing regions. See [Github #2819](https://github.com/Unidata/netcdf-c/pull/2819).
* Incorporate a more modern look and feel to user documentation generated by Doxygen. See [Doxygen Awesome CSS](https://github.com/jothepro/doxygen-awesome-css) and [Github #2864](https://github.com/Unidata/netcdf-c/pull/2864) for more information.
Expand Down
2 changes: 1 addition & 1 deletion include/netcdf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */

Expand Down
2 changes: 1 addition & 1 deletion libhdf5/hdf5attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions libhdf5/hdf5var.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions libnczarr/zattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
}
Expand Down
6 changes: 3 additions & 3 deletions libnczarr/zvar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion libsrc/nc3internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion libsrc/putget.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
6 changes: 3 additions & 3 deletions libsrc/var.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions nc_test/t_nc.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static const char * const reqattr[] = {
"SCALEMIN",
"SCALEMAX",
"FIELDNAM",
_FillValue
NC_FillValue
};
#define NUM_RATTRS 6

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion nc_test4/tst_elatefill.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions nc_test4/tst_h_scalar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);


Expand Down
4 changes: 2 additions & 2 deletions nc_test4/tst_quantize.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion nc_test4/tst_strings.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions nc_test4/tst_vars.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
38 changes: 19 additions & 19 deletions nc_test4/tst_vars2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
}
Expand All @@ -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. */
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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. */
Expand All @@ -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;
}
Expand All @@ -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. */
Expand All @@ -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;
Expand Down Expand Up @@ -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. */
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
Expand Down
6 changes: 3 additions & 3 deletions ncdump/ncdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion ncdump/tst_nans.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 73b9f18

Please sign in to comment.