[netcdfgroup] What does nc_open returning 24 mean?

Dave Allured dave.allured at noaa.gov
Fri Oct 26 16:12:36 MDT 2007


Thanks, Russ.  This is a fine explanation, but it would help to have 
the on-line documentation a bit more explicit about this.  Perhaps a 
note along the lines of your paragraph 2 below would be good at the 
top of the error code pages.  The tip about using nc_strerror for 
unknown codes is especially helpful.

http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-c/Error-Codes.html

It would also be helpful to have error code pages in the Fortran docs.

--Dave

Russ Rew wrote:
> Hi Nate,
> 
> You wrote:
>> The error code 24 is a POSIX error code that is happening at a lower
>> level than NetCDF, that is all I can say, i.e. the operating system is
>> generating an error not NetCDF.
> 
> Right, the netCDF C library returns negative error codes for
> netCDF-specific errors and positive error codes (corresponding to what's
> defined in /usr/include/errno.h) for system-level errors.  If you call
> the nc_strerror() function (or NF_STRERROR for F77 or NF90_STRERROR for
> F90) with the error code as argument, it returns an error message.  This
> works for either kind of error, so you don't have to know whether it's
> netCDF-specific or systems-level.
> 
> The reason there are both netCDF-specific and systems-level errors for
> too many open files is historical.  An earlier implementation of the
> library put limits on the number of open netCDF files that were more
> restrictive than the operating system's open file limit, but that is no
> longer the case.
> 
> --Russ
> 
>> On 10/23/07, Dave Allured <dave.allured at noaa.gov> wrote:
>>> All,
>>>
>>> According to the docs for the Netcdf C interface, Nate's error code
>>> for too many files open should be -34, not 24.  24 is not listed.
>>>
>>> http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-c/Error-Codes.html
>>>
>>> Does anyone know the reason for this discrepancy?  I ask for
>>> reference only.  Thanks.
>>>
>>> --Dave A.
>>> CU/CIRES Climate Diagnostics Center (CDC)
>>> NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
>>> http://www.cdc.noaa.gov
>>>
>>> Nathaniel Nutter wrote:
>>>> OK, for those who encounter this later it is because despite the files
>>>> being open read only they do need to be closed. Thanks to: giuliani,
>>>> Hannes, and Timothy for point this out to me so quickly. :-)
>>>>
>>>> I'm brand new at this stuff so I appreciate the help immensely!
>>>>
>>>> On 10/22/07, Nathaniel Nutter <iam at nnutter.com> wrote:
>>>>> I'm having a hard time searching for this on the mailing list archive
>>>>> and Google due to the unhelpfully constraining nature of a number and
>>>>> 'return'.
>>>>>
>>>>> I am running a program that reads in data every 'month' and it goes
>>>>> through many years and then mysteriously returns non-zero after
>>>>> opening the same files dozens of times.
>>>>>
>>>>> Every time prior (again dozens) it returns zero. The file is being
>>>>> opened read-only, no changes are being made to it.
>>>>>
>>>>> Debugging info from my program:
>>>>> nc_open status = 24
>>>>> filename = dat/ts.nc
>>>>>
>>>>> Nate Nutter
>>>>> iam at nnutter.com
>>>>>
>>>> _______________________________________________
>>>> netcdfgroup mailing list
>>>> netcdfgroup at unidata.ucar.edu
>>>> For list information or to unsubscribe,  visit: http://www.unidata.ucar.e
>> du/mailing_lists/
>>> _______________________________________________
>>> netcdfgroup mailing list
>>> netcdfgroup at unidata.ucar.edu
>>> For list information or to unsubscribe,  visit: http://www.unidata.ucar.edu
>> /mailing_lists/
>> _______________________________________________
>> netcdfgroup mailing list
>> netcdfgroup at unidata.ucar.edu
>> For list information or to unsubscribe,  visit: http://www.unidata.ucar.edu/m
>> ailing_lists/ 




More information about the netcdfgroup mailing list