Next: , Previous: NF90_DEF_DIM, Up: Dimensions


3.3 NF90_INQ_DIMID

The function NF90_INQ_DIMID returns (as an argument) the ID of a netCDF dimension, given the name of the dimension. If ndims is the number of dimensions defined for a netCDF dataset, each dimension has an ID between 1 and ndims.

Usage

      function nf90_inq_dimid(ncid, name, dimid)
        integer,             intent( in) :: ncid
        character (len = *), intent( in) :: name
        integer,             intent(out) :: dimid
        integer                          :: nf90_inq_dimid
ncid
NetCDF ID, from a previous call to NF90_OPEN or NF90_CREATE.
name
Dimension name, a character string beginning with a letter and followed by any sequence of letters, digits, or underscore ('_') characters. Case is significant in dimension names.
dimid
Returned dimension ID.

Errors

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

Example

Here is an example using NF90_INQ_DIMID to determine the dimension ID of a dimension named lat, assumed to have been defined previously in an existing netCDF dataset named foo.nc:

      use netcdf
      implicit none
      integer :: ncid, status, LatDimID
      ...
      status = nf90_open("foo.nc", nf90_nowrite, ncid)
      if (status /= nf90_noerr) call handle_err(status)
      ...
      status = nf90_inq_dimid(ncid, "Lat", LatDimID)
      if (status /= nf90_noerr) call handle_err(status)