NF90_INQUIRE_VARIABLE returns information about a netCDF variable given its ID. Information about a variable includes its name, type, number of dimensions, a list of dimension IDs describing the shape of the variable, and the number of variable attributes that have been assigned to the variable.
All parameters after nAtts are optional, and only supported if netCDF was built with netCDF-4 features enabled, and if the variable is in a netCDF-4/HDF5 file.
function nf90_inquire_variable(ncid, varid, name, xtype, ndims, dimids, nAtts, & contiguous, chunksizes, deflate_level, shuffle, fletcher32, endianness) integer, intent(in) :: ncid, varid character (len = *), optional, intent(out) :: name integer, optional, intent(out) :: xtype, ndims integer, dimension(:), optional, intent(out) :: dimids integer, optional, intent(out) :: nAtts logical, optional, intent(out) :: contiguous integer, optional, dimension(:), intent(out) :: chunksizes integer, optional, intent(out) :: deflate_level logical, optional, intent(out) :: shuffle, fletcher32 integer, optional, intent(out) :: endianness integer :: nf90_inquire_variable
ncid
varid
name
xtype
ndims
dimids
natts
contiguous
chunksizes
shuffle
deflate_level
fletcher32
endianness
These functions return 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_INQ_VAR to find out about a variable named rh in an existing netCDF dataset named foo.nc:
use netcdf implicit none integer :: status, ncid, & RhVarId & numDims, numAtts integer, dimension(nf90_max_var_dims) :: rhDimIds ... status = nf90_open("foo.nc", nf90_NoWrite, ncid) if(status /= nf90_NoErr) call handle_error(status) ... status = nf90_inq_varid(ncid, "rh", RhVarId) if(status /= nf90_NoErr) call handle_err(status) status = nf90_inquire_variable(ncid, RhVarId, ndims = numDims, natts = numAtts) if(status /= nf90_NoErr) call handle_err(status) status = nf90_inquire_variable(ncid, RhVarId, dimids = rhDimIds(:numDims)) if(status /= nf90_NoErr) call handle_err(status)