Members of the NF_INQ family of functions return information about an open netCDF dataset, given its netCDF ID. Dataset inquire functions may be called from either define mode or data mode. The first function, NF_INQ, returns values for the number of dimensions, the number of variables, the number of global attributes, and the dimension ID of the dimension defined with unlimited length, if any. The other functions in the family each return just one of these items of information.
For FORTRAN, these functions include NF_INQ, NF_INQ_NDIMS, NF_INQ_NVARS, NF_INQ_NATTS, and NF_INQ_UNLIMDIM. An additional function, NF_INQ_FORMAT, returns the (rarely needed) format version.
No I/O is performed when these functions are called, since the required information is available in memory for each open netCDF dataset.
INTEGER FUNCTION NF_INQ (INTEGER NCID, INTEGER ndims, INTEGER nvars,INTEGER ngatts, INTEGER unlimdimid) INTEGER FUNCTION NF_INQ_NDIMS (INTEGER NCID, INTEGER ndims) INTEGER FUNCTION NF_INQ_NVARS (INTEGER NCID, INTEGER nvars) INTEGER FUNCTION NF_INQ_NATTS (INTEGER NCID, INTEGER ngatts) INTEGER FUNCTION NF_INQ_UNLIMDIM (INTEGER NCID, INTEGER unlimdimid) INTEGER FUNCTION NF_INQ_FORMAT (INTEGER NCID, INTEGER format)
NCID
ndims
nvars
ngatts
unlimdimid
format
All members of the NF_INQ family return the value NF_NOERR if no errors occurred. Otherwise, the returned status indicates an error. Possible causes of errors include:
Here is an example using NF_INQ to find out about a netCDF dataset named foo.nc:
INCLUDE 'netcdf.inc' ... INTEGER STATUS, NCID, NDIMS, NVARS, NGATTS, UNLIMDIMID ... STATUS = NF_OPEN('foo.nc', NF_NOWRITE, NCID) IF (STATUS .NE. NF_NOERR) CALL HANDLE_ERR(STATUS) ... STATUS = NF_INQ(NCID, NDIMS, NVARS, NGATTS, UNLIMDIMID) IF (STATUS .NE. NF_NOERR) CALL HANDLE_ERR(STATUS)