3.3 Find all the Variables in a Group: nc_inq_varids
Find all varids for a location.
Usage
nc_inq_varids(int ncid, int *nvars, int *varids);
ncid
- The group id for this operation.
nvars
- The integer pointed to by this parameter will get the number of
variable IDs found.
varids
- An already allocated array to store the list of varids. Ignored if
NULL.
Errors
NC_NOERR
- No error.
NC_EBADID
- Bad group id.
NC_ENOTNC4
- Attempting a netCDF-4 operation on a netCDF-3 file. NetCDF-4
operations can only be performed on files defined with a create mode
which includes flag HDF5. (see nc_open).
NC_ESTRICTNC3
- This file was created with the strict netcdf-3 flag, therefore
netcdf-4 operations are not allowed. (see nc_open).
NC_EHDFERR
- An error was reported by the HDF5 layer.
Example
This example is from libsrc4/tst_vars.c.
int nvars_in, varids_in[2];
...
/* Open the file and make sure nc_inq_varids yeilds correct
* result. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_varids(ncid, &nvars_in, varids_in)) ERR;