Displaying 1 result from an estimated 1 matches for "cells2".
Did you mean:
cells
2010 Oct 06
1
R getting slower until it breaks...
...reen <- ifelse(Type=="red",2,3)
list1 <- unstack(object)
rast1 <- list1[[1]]
rast2 <- list1[[redorgreen]]
NAvalue(rast1)<- -99999
NAvalue(rast2)<- -99999
cells1 <- getValuesBlock(rast1,row=VALUE[[2]],nrow=VALUE[[3]],col=VALUE[[1]],ncol=VALUE[[3]])
cells2 <- getValuesBlock(rast2,row=VALUE[[2]],nrow=VALUE[[3]],col=VALUE[[1]],ncol=VALUE[[3]])
cells1[is.na(cells1)]<-0;
cells2[is.na(cells2)]<-0;
calculNDVI <-(cells1 - cells2) / (cells1 + cells2)
NDVImatrix <- matrix(calculNDVI,nrow=VALUE[[3]],ncol=VALUE[[3]], byrow=TRUE)
ND...