6.9 Learn About Fill Parameters for a Variable: nc_inq_var_fill
The function nc_inq_var_fill returns the fill settings for a
variable in a netCDF-4 file.
Usage
int nc_inq_var_fill(int ncid, int varid, int *no_fill, void *fill_value);
ncid- NetCDF ID, from a previous call to nc_open or nc_create.
varid- Variable ID.
*no_fill- Pointer to an integer which will get a 1 if no_fill mode is set for
this variable. See nc_def_var_fill. This parameter will be ignored
if it is NULL.
*fill_value- A pointer which will get the fill value for this variable. This
parameter will be ignored if it is NULL.
Return Codes
NC_NOERR- No error.
NC_BADID- Bad ncid.
NC_ENOTNC4- Not a netCDF-4 file.
NC_ENOTVAR- Can't find this variable.
Example
This example is from libsrc4/tst_vars.c
int dimids[NDIMS];
size_t index[NDIMS];
int varid;
int no_fill;
unsigned short ushort_data = 42, ushort_data_in, fill_value_in;
/* Create a netcdf-4 file with one dim and 1 NC_USHORT var. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_def_dim(ncid, DIM7_NAME, DIM7_LEN, &dimids[0])) ERR;
if (nc_def_var(ncid, VAR7_NAME, NC_USHORT, NDIMS, dimids,
&varid)) ERR;
if (nc_def_var_fill(ncid, varid, 1, NULL)) ERR;
/* Check stuff. */
if (nc_inq_var_fill(ncid, varid, &no_fill, &fill_value_in)) ERR;
if (!no_fill) ERR;