This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
>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