Go to the previous, next section.
The function ncinquire
(NCINQ
for FORTRAN) returns
information about an open netCDF file, given its netCDF ID. It can be
called from either define mode or data mode. It returns values for the
number of dimensions, the number of variables, the number of global
attributes, and the dimension ID of the dimension defined with
unlimited size, if any. No I/O is required when this or any other
`inquire' function in the netCDF interface is called, since the
functions merely return information that is stored in a table for each
open netCDF file.
In case of an error, ncinquire
returns -1; NCINQ
returns a
nonzero value in rcode
. Possible cause of errors includes:
int ncinquire(int ncid, int* ndims, int* nvars, int* ngatts, int* recdim);
ncid
ncopen
or nccreate
.
ndims
nvars
ngatts
recdim
recdim
. If this parameter is given as
`(int *) 0', the record dimension ID will not be returned so no
variable to hold this information needs to be declared.
Here is an example using ncinquire
to find out about a netCDF
file named `foo.nc':
#include "netcdf.h" ... int ncid, ndims, nvars, ngatts, recdim; ... ncid = ncopen("foo.nc", NC_NOWRITE); ... ncinquire(ncid, &ndims, &nvars, &ngatts, &recdim);
SUBROUTINE NCINQ(INTEGER NCID, INTEGER NDIMS, INTEGER NVARS, * INTEGER NGATTS, INTEGER RECDIM, INTEGER RCODE)
NCID
NCOPN
or NCCRE
.
NDIMS
NVARS
NGATTS
RECDIM
RECDIM
.
RCODE
Here is an example using NCINQ
to find out about a netCDF
file named `foo.nc':
INCLUDE 'netcdf.inc' ... INTEGER NCID, NDIMS, NVARS, NATTS, RECDIM, RCODE ... NCID = NCOPN('foo.nc', NCNOWRIT, RCODE) ... CALL NCINQ(NCID, NDIMS, NVARS, NATTS, RECDIM, RCODE)
Go to the previous, next section.