【发布时间】:2022-12-28 01:59:18
【问题描述】:
Having a large stack of timeserie rasters I would like to create another rasterstack which represents 5-day rolling sum per each pixel across the layers. Given the size of the raster stack, the raster::calc runs endlessly for this task, and I was therefore wondering if this operation could be implemented faster using the terra::lapp. However:
library(terra)
stack_A<-rast(nlyrs=10)
rollsum<-function(x){data.table::frollsum(x,n=5)}
stack_B<-lapp(stack_A, fun=rollsum)
returns an error:
"Error in (function (x) :
unused arguments (c(0, 0,...
or: [lapp] I do not like 'fun' :("
Id be gratefull if somebody could suggest where the mistake is, or maybe suggest another implementation (stars::?)
【问题讨论】:
标签: r r-raster rolling-computation terra