Next: , Previous: NF90_DEF_VAR, Up: Variables


6.4 Define Fill Parameters for a Variable: nf90_def_var_fill

The function NF90_DEF_VAR_FILL sets the fill parameters for a variable in a netCDF-4 file.

This function must be called after the variable is defined, but before NF90_ENDDEF is called.

Usage

     NF90_DEF_VAR_FILL(INTEGER NCID, INTEGER VARID, INTEGER NO_FILL, FILL_VALUE);
NCID
NetCDF ID, from a previous call to NF90_OPEN or NF90_CREATE.
VARID
Variable ID.
NO_FILL
Set to non-zero value to set no_fill mode on a variable. When this mode is on, fill values will not be written for the variable. This is helpful in high performance applications. For netCDF-4/HDF5 files (whether classic model or not), this may only be changed after the variable is defined, but before it is committed to disk (i.e. before the first NF90_ENDDEF after the NF90_DEF_VAR.) For classic and 64-bit offset file, the no_fill mode may be turned on and off at any time.
FILL_VALUE
A value which will be used as the fill value for the variable. Must be the same type as the variable. This will be written to a _FillValue attribute, created for this purpose. If NULL, this argument will be ignored.

Return Codes

NF90_NOERR
No error.
NF90_BADID
Bad ncid.
NF90_ENOTNC4
Not a netCDF-4 file.
NF90_ENOTVAR
Can't find this variable.
NF90_ELATEDEF
This variable has already been the subject of a NF90_ENDDEF call. In netCDF-4 files NF90_ENDDEF will be called automatically for any data read or write. Once enddef has been called, it is impossible to set the fill for a variable.
NF90_ENOTINDEFINE
Not in define mode. This is returned for netCDF classic or 64-bit offset files, or for netCDF-4 files, when they were been created with NF90_STRICT_NC3 flag. (see NF90_CREATE).
NF90_EPERM
Attempt to create object in read-only file.

Example