[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 970609: netCDF question/bug?
- Subject: Re: 970609: netCDF question/bug?
- Date: Tue, 10 Jun 1997 14:24:47 -0600
>From: address@hidden (Matthew H. Savoie)
>Organization: NOAA/FSL
>Keywords: 199706092015.OAA03230 netCDF
Hi Matt,
> Got a question, I'm trying to get the number of global attributes from
> an existing netcdf file.
>
>
> status = nc_inq_varnatts(oldID, NC_GLOBAL, &nattsp)
>
> The documentation about attributes says that you can use NC_GLOBAL as
> a psuedo-variable id, but I can't get the above statement to return
> anything except -49 (variable not found).
>
> Is there a way to get the number of global attributes? If not should
> there be?
Sorry to take so long to answer this, it "slipped through the cracks".
The documented way to find the number of global attributes in the
netcdf-3 interface is
status = nc_inq_natts(oldID, &nattsp);
I've just checked and this works as intended.
I was surprised that the way you tried, using NC_GLOBAL, did not also
work, but the documentation appears to be correct also in this case.
It appears that the only use for the NC_GLOBAL attribute is to put and
get values of a global attribute.
I think I'll treat this as a documentation bug; the User's Guide should
be more explicit about the uses for NC_GLOBAL and should have a
cross-reference to nc_inq_atts under nc_inq_varnatts.
But we'll also look at whether we should extend the functionality of
nc_inq_varnatts() so it does what you expect when NC_GLOBAL is the
variable ID, just because that's the way the netcdf-2 interface worked
and other users may trip on the same problem.
--Russ
_____________________________________________________________________
Russ Rew UCAR Unidata Program
address@hidden http://www.unidata.ucar.edu