Go to the previous, next section.
ncdimid
(or NCDID
for FORTRAN) returns the ID
of a netCDF dimension, given the name of the dimension. If ndims
is the number of dimensions defined for a netCDF file, each dimension
has an ID between 0
and ndims-1
(or 1
and
ndims
for FORTRAN).
In case of an error, ncdimid
returns -1; NCDID
returns a
nonzero value in rcode
. Possible causes of errors include:
int ncdimid(int ncid, const char* name);
ncid
ncopen
or nccreate
.
name
Here is an example using ncdimid
to determine the dimension ID of
a dimension named lat
, assumed to have been defined previously in
an existing netCDF file named `foo.nc':
#include "netcdf.h" ... int ncid, latid; ... ncid = ncopen("foo.nc", NC_NOWRITE); /* open for reading */ ... latid = ncdimid(ncid, "lat");
INTEGER FUNCTION NCDID (INTEGER NCID, + CHARACTER*(*) DIMNAME, + INTEGER RCODE)
NCID
NCOPN
or NCCRE
.
DIMNAME
RCODE
Here is an example using NCDID
to determine the dimension ID of
a dimension named lat
, assumed to have been defined previously in
an existing netCDF file named `foo.nc':
INCLUDE 'netcdf.inc' ... INTEGER NCID, RCODE, LATID ... NCID = NCOPN('foo.nc', NCNOWRIT, RCODE) ... LATID = NCDID(NCID, 'lat', RCODE)
Go to the previous, next section.