Hi,
I wrote a code which uses clusterR to run a function on multiple CPUs to
process MODIS 16 day dataset. The function converts a brick to dataframe.
The existing commands to do this in package raster is very slow on large
datasets, therefore I'm attempting to use the multicore option to speed up
the process.
I get the following error
Error in clusterR(n1, qckextract) : cluster error
I would appreciate your advice on to fix the function. Thanks!
library(raster)
n1<-brick("ndvih25v08masked.grd")
beginCluster(nice=20)
nodes <- length(getCluster())
bs <- blockSize(n1, minblocks=nodes*4)
qckextract <- function(i) {
for (i in 1:length(bs$n)) {
e<- extent(xmin(x), xmax(x), yFromRow(x, bs$row[i]+bs$nrows[i]-1) - 0.5
* yres(x), yFromRow(x, bs$row[i])+0.5 * yres(x))
n <- cellsFromExtent(x,e)
v <- (getValues(x, bs$row[i], bs$nrows[i]))/10000
v<-as.data.frame(v)
v<- as.data.frame(cbind(n,v))
}
return(v)
}
nx<-clusterR(n1,qckextract)
endCluster()
--
Srinivas Vaidyanathan
Senior Research Fellow
Foundation for Ecological Research, Advocacy & Learning
India.
Web:www.feralindia.org