3.9 Find a Group by Name: nc_inq_grp_ncid
Given a group name an an ncid, find the ncid of the group id.
Usage
int nc_inq_grp_ncid(int ncid, const char *grp_name, int *grp_ncid);
ncid
- The group id to look in.
grp_name
- The name of the group that should be found.
grp_ncid
- A pointer to int which will get the group id, if it is found.
Return Codes
The following return codes may be returned by this function.
NC_NOERR
- No error.
NC_EBADID
- Bad group id.
NC_EINVAL
- No name provided or name longer than NC_MAX_NAME.
NC_ENOGRP
- Named group not found.
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 test program libsrc4/tst_grps.c.
/* Reopen and recheck. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_grp_ncid(ncid, SCI_FI, &g1id)) ERR;