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: address@hidden >From: Douglas Rotman <address@hidden> >Subject: NetCDF open >Organization: . >Keywords: 199707221748.LAA03880 Hi Doug, Sorry to take so long to answer your question; it got lost in my mail queue. > I am running a computer model that opens and closes many netCDF files. > > I believe the code is following this pattern, > > Open NetCDF file > Use data > Close NetCDF file > Open next file. ...... > > I.E., I think I am closing one before I open the next. > > However, it appears that upon trying to open the nth NetCDF file, > it says it can not find that file. (Am not exactly sure what n is, > still looking into it). > > I know the file is there. It has opened it before. > > Am I hitting a hard limit of how many opens/closes I am allowed?? > > If so, can I change that?? > > Any other ideas of possible mistakes my me?? There is no netCDF-specific limit on how many opens/closes are allowed. Your system only permits sysconf(_SC_OPEN_MAX) open files, so it's possible you are running into that limit, if the closes are not getting executed. However, that would not cause a "file not found" error. I don't think the problem is netCDF-related, but you can determine whether it is or not by trying to open the same file with a different I/O library function, such as fopen(), when you get the failure from nc_open(). If fopen() works but nc_open() fails, please send us details, or a small program that demonstrates the problem. Thanks. --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu