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

[netCDF #PAM-528913]: nc_open handle values



> Hi,
> 
> We have noticed in the 4.0.1 library and 4.1.1 RC2 library that the
> values returned by the nc_open increment by 0x10000 or 65536.
> 
> Is this normal behaviour? We noticed this as an error report when we
> opened more than 32767 files as on the 32768th invocation, the file
> handle reaches 0x80000000, which as
> a four byte signed integer in 2's complement form is -2147483648.
> 
> The tests were conducted with netCDF built with hdf5-1.8.4 and
> zlib-1.2.4.
> 
> The test code was written in C  and opens and closes the same file in a
> loop.
> 
> regards
> Andrew Munslow
> 
> 
> Andrew Munslow   Senior Software Engineer
> Met Office FitzRoy Road  Exeter  Devon  EX1 3PB  United Kingdom
> Tel: +44 (0)1392 884470  Fax: +44 (0)1392 885681
> Email: address@hidden
> Website: www.metoffice.gov.uk
> 

Howdy Andrew!

Yes, that limitation is built into the ncid.

The ncid actually contains two pieces of information, the file and also the 
group within the file. As I had 32 bits in the ncid, I took 16 for each.

Do you really need to open over 32 thousand files at the same time? Why are you 
doing such a thing? 

As a workaround, each file may also contain 32 thousand groups. Perhaps you 
could use groups instead of files in some cases, when you need to open more 
than 32 thousand netCDF files? Each group functions like a file - it can have 
global attributes, variables, and dimensions.

But then you still hit the limit of 32K groups in each of 32K files, so a total 
number of netCDF file-like containers of only 10**9 total. ;-)

Thanks!

Ed

Ticket Details
===================
Ticket ID: PAM-528913
Department: Support netCDF
Priority: Normal
Status: Closed