Dear list,
I am extracting data from thousands of NetCDF files, using the raster
library to read in each file as follows:

nclist <- list.files(nc.dir)
for(iFile in 1:length(nclist)) {
  r <- raster(nclist[iFile], varname = "myvar")
  # extract data here....
}  # end loop.

I reach the file handler limit at around 1000 and receive the following
error message:
error: too many open files.

I then move to the ncdf4 library, using nc_open() to open each file,
retrieve the data I need, and then use nc_close() when I'm finished.
However, I see the same error message after approximately 1000 files.

The file handle limit on this system is more than 6 million, so I'm unsure
why I'm seeing this error.
Can anyone advise me on why this is occurring, and how I can avoid this
problem?

thanks in advance for any suggestions.

 R session info:
R version 3.0 x86_64-redhat-linux-gnu

	[[alternative HTML version deleted]]

