Hi Aseem, I ran into this problem some time ago and posted my solution to the r-sig-geo list. This was on a Linux server. I'm not sure what the default upper file limit is on windows, but this may give you some clues. Also, I saw several other posts and responses with the same problem, I've pasted a link to one of those threads below.
HTH, Zack # my solution http://r-sig-geo.2731867.n2.nabble.com/solved-raster-ncdf4-error-too-many-open-files-td7583723.html # a similar post http://r-sig-geo.2731867.n2.nabble.com/raster-rgdal-problem-Too-many-open-files-Linux-td7584338.html On Tue, Mar 11, 2014 at 10:27 AM, Aseem Sharma <[email protected]>wrote: > hi, > i have big netCDF file that archive daily climate data since 1950-01-01 to > 2010-12-31. I want to extract this CDF file so that new will have same data > only starting from 1980-01-01 ( i e recent 30 years only). > I tried with subset function of raster package. after overnight running, > it gives me error of too many files. > > So how can i extract only recent years netCDF. > > My code so far: > subset(data,10592:22280, drop=TRUE,filename="data_19800101_20101231.nc > ",overwrite=TRUE) > > where > data is my netCDF with data from 1950-01-01 and 10592:22280 is the no of > days between 1980-01-01 to 2010-12-31. > > Error ( after more than 12 hours running ) > > Error in R_nc_open: Too many open files > Error in open.ncdf(x@file@name) : > Error in open.ncdf trying to open file Z:\Thesis\Data\CCC > Data\Tmn_19500101_20101231.nc > > Traceback after error > > traceback() > 13: stop(paste("Error in open.ncdf trying to open file", con)) > 12: open.ncdf(x@file@name) > 11: .openConnection(x, ...) > 10: readStart(x@layers[[i]], con.check = 103, ...) > 9: readStart(x@layers[[i]], con.check = 103, ...) > 8: readStart(x, ...) > 7: readStart(x, ...) > 6: .local(x, filename, ...) > 5: writeRaster(x, filename, ...) > 4: writeRaster(x, filename, ...) > 3: .local(x, ...) > 2: subset(Tmin, 10592:22280, drop = TRUE, filename = > "Tmn_19800101_20101231.nc", > overwrite = TRUE) > > Session info > > sessionInfo() > R version 3.0.2 (2013-09-25) > Platform: x86_64-w64-mingw32/x64 (64-bit) > > locale: > [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United > States.1252 > [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C > > [5] LC_TIME=English_United States.1252 > > attached base packages: > [1] grid stats graphics grDevices utils datasets methods > base > > other attached packages: > [1] zyp_0.10-1 Kendall_2.2 scales_0.2.3 plyr_1.8 > ggplot2_0.9.3.1 > [6] reshape2_1.2.2 zoo_1.7-10 rasterVis_0.27 > hexbin_1.26.3 latticeExtra_0.6-26 > [11] RColorBrewer_1.0-5 lattice_0.20-23 ncdf_1.6.6 > raster_2.2-12 sp_1.0-14 > > loaded via a namespace (and not attached): > [1] boot_1.3-9 colorspace_1.2-4 dichromat_2.0-0 digest_0.6.4 > gtable_0.1.2 > [6] labeling_0.2 MASS_7.3-29 munsell_0.4.2 proto_0.3-10 > stringr_0.6.2 > [11] tools_3.0.2 > > > I couldn't attache the exact data. One smaller version of same data is > here<https://www.dropbox.com/s/yx9q09iek593f81/obs1.nc> > . > > Thank you, > a > > ---- > > [[alternative HTML version deleted]] > > _______________________________________________ > R-sig-Geo mailing list > [email protected] > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list [email protected] https://stat.ethz.ch/mailman/listinfo/r-sig-geo
