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.
>To: Unidata Support <address@hidden> >cc: support-netcdf <address@hidden> >From: psanhuez <address@hidden> >Subject: RE: 20020607: netCDF error -31 >Organization: UCAR/Unidata >Keywords: 200206121857.g5CIvCJ16085 Hi Pedro, > netcdf.h indicate that error number -31 is a system error (no much > explanation), but netcdf.inc says that error ?31 means too many netcdfs open. > I have no idea when I have to change the number of netcdf open? (what > files/parameters). NetCDF 2.4.3 and earlier versions had a limit of 32 on the number of netCDF files you could have open at once , but no version released since 1996 has any such limit other than what the underlying operating system allows. These earlier versions may have used the error code "-31" to indicate you had exceeded the 32-file limit for open netCDF files. In the current versions, the error code -31 does not correspond to any netCDF error, but instead indicates a system error occurred during a netCDF call, such as writing a file too large for the file system. > Looking at these files I found that there is a parameter called FILELONG that > is set to 2,147,483,647, and the program that I am running stop when the > output file reach 2,147,482,896, so is possible that this is my problem. I > modified this limit to 4 GB (also in the posixio.c file) and recompiled > netcdf > again, but the problem is still the same. > > I modified 5 files (where the FILELONG is): > > ../src/libsrc/netcdf.h > ../src/fortran/netcdf.inc > ../include/netcdf.h > ../include/netcdf.inc > ../src/libsrc/posixio.c > > My question is, am I missing something here? > > How can I set netcdf to write a file longer than 2 GB? > How can modify (increase) the number of open netcdf files (files and > parameters) It doesn't help to modify FILELONG, that is not the problem. The 2.147 Gbyte limit is as large as a file can be on systems that use 32-bit signed integers for file offsets. In order for a file system to support files larger than about 2 Gbytes, it may have to be configured properly when you create the disk partition for the file system. You can test this by trying to write a larger file with a simple program that doesn't use netCDF but just writes the same bytes in a loop, to see if your file system supports large files. Even if you have large file support in the file system, you may still have to compile the netCDF library with the right flags to permit large netCDF files (over 2Gbytes) to be written. There are examples in the installation instructions at http://www.unidata.ucar.edu/packages/netcdf/INSTALL.html for Large File Support for IBM AIX, HPUX, IRIX64, Linux 2.4 on i686, and Solaris/SPARC. Other systems with Large File Support may work similarly. Also see the Frequently Asked Question on Large File Support in the netCDF FAQ: http://www.unidata.ucar.edu/packages/netcdf/faq.html#lfs which refers to a new "Large File Support" section in the User's Guide that provides more details on constraints on writing netCDF files larger than 2 Gbytes. --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu