Does anyone already paralleled mosaic function for rasters in R?
It seems that snow
still doesn´t deal with this on an automatic way.
The idea is something like this:
r1<-stack("fit__test23KLR.img")
r2<-stack("fit__test23KKR.img")
r3<-stack("fit__test23KKS.img")
r4<-stack("fit__test23KLS.img")
ff <- function(x1, x2, x3, x4) mosaic(x1, x2, x3, x4, fun="mean")
beginCluster(35)
cl <-getCluster()
m1 <- clusterR(r1, r2, r3, r4, fun = ff, export="mosaic")
endCluster()
Each stack r1, r2.... are:
dimensions : 2516, 412, 1036592, 93 (nrow, ncol, ncell, nlayers)
resolution : 30, 30 (x, y)
range between: -2.5 to 2.5
mosaic(r1,r2,r3,r4)
asmosaic(mosaic(r1,r2),mosaic(r3,r4))
and you could do the inner mosaics in parallel.