Next: , Previous: nc_inq_varids, Up: Groups


3.4 Find all Dimensions Visible in a Group: nc_inq_dimids

Find all dimids for a location. This finds all dimensions in a group, or any of its parents.

Usage

     int nc_inq_dimids(int ncid, int *ndims, int *dimids, int include_parents);
ncid
The group id for this operation.
dimids
An already allocated array of ints when the dimids of the visible dimensions will be stashed. Use nc_inq_ndims to find out how many dims are visible from this group. (see nc_inq Family).
include_parents
If non-zero then all the dimensions in all parent groups will also be retrieved.

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_dims.c.

           int ncid, dimid;
           int ndims_in, dimids_in[MAX_DIMS];
     
           ...
     
           /* Open the file and make sure nc_inq_dimids yeilds correct
            * result. */
           if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
           if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
           if (ndims_in != 1 || dimids_in[0] != 0) ERR;