[R-sig-Geo] raster package memory management

Oliver Soong osoong+r at gmail.com
Tue Feb 7 22:16:10 CET 2012


Hi,

I'm putting together a package to do some analysis that uses the great
features provided by raster package.  I'm anticipating reading a large
number of rasters (tens of thousands in my test case), lined up into a
single rasterStack.  At any given time, I only need to operate on a
few layers, but I'm constantly accessing different layers.  Is the
raster package smart enough to manage memory usage of the entire
stack?  In other words, will it release data read into memory but
backed by a file in order to read in new data?  I'm willing to
tradeoff speed for functionality.

If I had to read separate rasterLayers, (say each layer had different
extents), would the raster package manage memory across the collection
of raster* objects?

Lastly, since this sort of memory management seems complex enough that
I'm guessing it hasn't been implemented, should I use clearValues to
do this manually?  Can I apply clearValues to specific elements of a
rasterStack?

Thanks for reading.  The raster package has made things much easier
already, so I'm hoping to be pleasantly surprised.

Oliver



More information about the R-sig-Geo mailing list