3.1 Find a Group ID: nc_inq_ncid
Given an ncid and group name (NULL or "" gets root group), return
ncid of the named group.
Usage
int nc_inq_ncid(int ncid, char *name, int *grp_ncid);
ncid- The group id for this operation.
name- A char array that holds the name of the desired group.
grp_ncid- An int pointer that will receive the group id, if the group is found.
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
int root_ncid, child_ncid;
char file[] = "nc4_test.nc";
/* Open the file. */
if ((res = nc_open(file, NC_NOWRITE, &root_ncid)))
return res;
/* Get the ncid of an existing group. */
if ((res = nc_inq_ncid(root_ncid, "group1", &child_ncid)))
return res;