[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 950302: Getting Informations about Attributes



>Keywords: 199503021330.AA14268

Hi Mechthild,

> how can I get the names and values of the attributes in a netCDF-file
> - -if I know only the ncid- using the C-Interface?

There is a section in the User's Guide named "Reading a netCDF File with
Unknown Names" that describes the sequence of calls.  For example if you
wanted only the global attributes, you would call ncinquire to find out how
many there were, and then call ncattinq and ncattget in a loop to get the
name, type, length, and value of each attribute.  To get information about
global attributes, you use the same interface as for variable attributes,
except that you use NC_GLOBAL instead of the variable ID.

For an example of how this is done, you can look at the source code for the
ncdump program, which determines everything about a netCDF file using only
the C interface.

______________________________________________________________________________

Russ Rew                                                UCAR Unidata Program
address@hidden                                          P.O. Box 3000
http://www.unidata.ucar.edu/                          Boulder, CO 80307-3000
______________________________________________________________________________