Next: , Previous: NF_DEF_DIM, Up: Dimensions


3.3 NF_INQ_DIMID

The function NF_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

     INTEGER FUNCTION NF_INQ_DIMID (INTEGER NCID, CHARACTER*(*) NAME,
                                    INTEGER dimid)
NCID
NetCDF ID, from a previous call to NF_OPEN or NF_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

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

Example

Here is an example using NF_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:

     INCLUDE 'netcdf.inc'
        ...
     INTEGER STATUS, NCID, LATID
        ...
     STATUS = NF_OPEN('foo.nc', NF_NOWRITE, NCID)
     IF (STATUS .NE. NF_NOERR) CALL HANDLE_ERR(STATUS)
        ...
     STATUS = NF_INQ_DIMID(NCID, 'lat', LATID)
     IF (STATUS .NE. NF_NOERR) CALL HANDLE_ERR(STATUS)