Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

Next: , Previous: NF_INQ_VAR_ENDIAN, Up: Variables


6.14 Get a Variable ID from Its Name: NF_INQ_VARID

The function NF_INQ_VARID returns the ID of a netCDF variable, given its name.

Usage

     INTEGER FUNCTION NF_INQ_VARID(INTEGER NCID, CHARACTER*(*) NAME,
                                   INTEGER varid)
NCID
NetCDF ID, from a previous call to NF_OPEN or NF_CREATE.
NAME
Variable name for which ID is desired.
varid
Returned variable ID.

Errors

NF_INQ_VARID 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_VARID to find out the ID of a variable named rh in an existing netCDF dataset named foo.nc:

     INCLUDE 'netcdf.inc'
        ...
     INTEGER  STATUS, NCID, RHID
        ...
     STATUS = NF_OPEN ('foo.nc', NF_NOWRITE, NCID)
     IF (STATUS .NE. NF_NOERR) CALL HANDLE_ERR(STATUS)
        ...
     STATUS = NF_INQ_VARID (NCID, 'rh', RHID)
     IF (STATUS .NE. NF_NOERR) CALL HANDLE_ERR(STATUS)
 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690