[netcdfgroup] inquire number of dims visible from a group

Hello netcdf group,

I'm running into odd behavior when trying to determine the number of dims
visible from a group.

The file has 2 dims defined in the root group, then a sub-group with a var
that uses those 2 dims. When processing the file, I need to be able to
determine how many dims are visible from the sub-group (in this case, 2).

The documentation for routine

int nc_inq_dimids(int ncid, int *ndims, int *dimids, int include_parents)

Says:
dimidsAn 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<http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-c/nc_005finq-Family.html#nc_005finq-Family>).
However, when I actually use nc_inq_ndims, passing in the group ID, it
doesn't return 2 (the number of dims visible from that group), it returns 0
(the number of dims defined in that group). There doesn't seem to be any
member of the nc_inq family of calls that takes an "include_ parents"
parameter, which would handle this case.

So, it seems like either:

1) The documentation is a bit off, but in that case, how are you supposed
to figure out the number of dims visible from a group? (I will note that
this could easily be handled if nc_inq_dimids did not attempt to fill array
dimids if dimids==NULL).

2) The documentation is describing what the code is supposed to be doing,
but the code doesn't actually implement this correctly.

I'm using netcdf library version 4.2.1.1.

Any suggestions?

Regards,

--Dave

-- 
David W. Pierce
Division of Climate, Atmospheric Science, and Physical Oceanography
Scripps Institution of Oceanography, La Jolla, California, USA
(858) 534-8276 (voice)  /  (858) 534-8561 (fax)    dpierce@xxxxxxxx
  • 2012 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: