Next: , Previous: , Up: Variables   [Index]


4.5 Inquire Fill Mode Settings of a Variable: ncmpi_inq_var_fill

The API ncmpi_inq_var_fill returns the fill mode settings for a variable. This API is only available in version 1.6.1 and later.

Operational Mode

This API is an independent subroutine.

This API can be called while the file is in either define or data mode.

Usage

int ncmpi_inq_var_fill(int   ncid,
                       int   varid,
                       int  *no_fill,
                       void *fill_value);
ncid

NetCDF ID, from a previous call to ncmpi_open or ncmpi_create.

varid

Variable ID. Different MPI processes may use different variable IDs.

no_fill

Pointer to an integer which will get a 1 if no_fill mode is set for this variable, 0 if no_fill mode is false. See ncmpi_def_var_fill for turning on and off the fill mode for a variable. This argument will be ignored if it is NULL.

fill_value

A pointer which will get the fill value for this variable. This argument will be ignored if it is NULL.

Return Error Codes

ncmpi_inq_var_fill returns the value NC_NOERR if no errors occurred. Otherwise, the returned status indicates an error. Possible causes of errors include:

Example

Here is an example using ncmpi_def_var to create a variable named rh of type double with three dimensions. Calling ncmpi_def_var_fill to turn on the variable’s fill mode with the PnetCDF default fill value. Later in data mode, it calls ncmpi_inq_var_fill to inquire the fill mode settings of the variable.

#include <pnetcdf.h>

int    no_fill;
double fill_value_in;

    ...  /* create a file */
    ...  /* define dimensions */

status = ncmpi_def_var(ncid, "rh", NC_DOUBLE, 3, dimids, &varid);
if (status != NC_NOERR) handle_error(status);

status = ncmpi_def_var_fill(ncid, varid, 0, NULL);
if (status != NC_NOERR) handle_error(status);

status = ncmpi_enddef(ncid);
if (status != NC_NOERR) handle_error(status);
    ...

/* check fill mode settings for variable "rh" */
status = ncmpi_inq_var_fill(ncid, varid, &no_fill, &fill_value_in);
if (status != NC_NOERR) handle_error(status);

Full example C program


Next: , Previous: , Up: Variables   [Index]