Next: NF90_SYNC, Previous: NF90_CLOSE, Up: Datasets
The NF90_INQUIRE subroutine returns information about an open netCDF dataset, given its netCDF ID. The subroutine can be called from either define mode or data mode, and returns values for any or all of the following: 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. An additional function, NF90_INQ_FORMAT, returns the (rarely needed) format version.
No I/O is performed when NF90_INQUIRE is called, since the required information is available in memory for each open netCDF dataset.
function nf90_inquire(ncid, nDimensions, nVariables, nAttributes, & unlimitedDimId, formatNum) integer, intent( in) :: ncid integer, optional, intent(out) :: nDimensions, nVariables, & nAttributes, unlimitedDimId, & formatNum integer :: nf90_inquire
ncid
nDimensions
nVariables
nAttributes
unlimitedDimID
format
Function NF90_INQUIRE returns the value NF90_NOERR if no errors occurred. Otherwise, the returned status indicates an error. Possible causes of errors include:
Here is an example using NF90_INQUIRE to find out about a netCDF dataset named foo.nc:
use netcdf implicit none integer :: ncid, status, nDims, nVars, nGlobalAtts, unlimDimID ... status = nf90_open("foo.nc", nf90_nowrite, ncid) if (status /= nf90_noerr) call handle_err(status) ... status = nf90_inquire(ncid, nDims, nVars, nGlobalAtts, unlimdimid) if (status /= nf90_noerr) call handle_err(status) status = nf90_inquire(ncid, nDimensions = nDims, & unlimitedDimID = unlimdimid) if (status /= nf90_noerr) call handle_err(status)