Reputation: 143
I have two Large Rasterstack (6000 each ). I would like to do some simple calculations such as
NewRasterStack = RasterStack_1 + RasterStack2*(-3)
Could you be kind to help me to suggest working code to do this calculation ? All the data is processed using R raster package, so I am looking for raster calc function.
Thank you in advance!
Upvotes: 1
Views: 792
Reputation: 47091
If the stacks have the same extent and resolution this should work:
NewRasterStack = RasterStack_1 + RasterStack2*(-3)
This might be bit more efficient:
nr <- overlay(RasterStack_1, RasterStack2, fun=function(x,y) x - 3 * y)
Upvotes: 1