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

Re: 970829: NetCDF 3.3.1 problem



>cc: address@hidden
>From: address@hidden (Andrew Robertson)
>Subject: NetCDF 3.3.1 problem
>Organization: UCLA
>Keywords: 199708291752.LAA10060 netCDF 3.3.1

Hi Andy,

> Re: NetCDF ID numbers with NetCDF 3.3.1 on antero.ucar.edu
> 
> With the updated NetCDF, I'm getting very large NetCDF ID numbers,
> which are causing my program to crash, because it expects
> small nonnegative integers. 
> 
> eg: ncid   = nccre  ('test.nc', NCCLOB, irc)
> 
> returns ncid=741295.
> 
> Is this a known problem?

Yes, but we didn't think it would a problem, since we assumed programs
would not rely on the actual values of netCDF IDs.  They are documented
as "opaque handles", which means you can get them from a function call
and use them in other function calls, but you aren't supposed to change
their values or make anything depend on their values.  The netCDF
documentation says that a netCDF ID is a

    small nonnegative integer returned when you create or open the
    file.  A netCDF ID is much like a file descriptor in C or a logical
    unit number in FORTRAN.  In any single program, the netCDF IDs of
    distinct open netCDF files are distinct.

but it doesn't say what "small" is.  In netCDF version 3, the netCDF ID
is the same as the file descriptor, which in the case of Cray's FFIO can
apparently be pretty large.

If you need to keep a table of open netCDF files, it would be better to
store them with their IDs than to try to use the ID as an index into the
table, since you can't rely on the values being small.  Sorry about that
...

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu