Oliver,

On Tue, Feb 7, 2012 at 1:16 PM, Oliver Soong <osoong+r@gmail.com> wrote:

> 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.
>

Yes, If you create a RasterStack from RasterLayer objects that point to
cell values in files (as opposed to cell values in memory) you should be
able to make 1000s of objects; they are small.



> 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?
>


If the different RasterLayer objects have different extents, you cannot put
them in the same RasterStack; I would put them in a list (a RasterStack is
in essence a list of RasterLayer objects; but with the constraint that they
must all have the same extent and resolution).


>
> 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?
>

There should be no need to that.

Best, Robert


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

Oliver
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]

