Displaying 2 results from an estimated 2 matches for "getvaluesblock".
Did you mean:
getvalueinblock
2010 Oct 06
1
R getting slower until it breaks...
...ixel et largeur #####
calculate_NDVI<- function(Type, object, VALUE) {
redorgreen <- 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)
NDVIma...
2010 Jul 28
2
Beginner stucked with raster + geoR package.
...unction (geoR package)
1. First I created a Raster Layer object
r <- raster() # Default values are ok
2. Then I set some values to test how if setValues worked
r <- setValues(r,1:ncell(r)/100) # Every cell of the RasterLayer takes as data
its cell number/100.
3. Tested that 2 works with
getValuesBlock(r,1,nrow(r),1,ncol(r))
4. Then I tried to generate a Gaussian random field for given covariance
parameters using grf.
temp <- grf(1,nx=nrow(r),ny=ncol(r), cov.pars=c(1, .25)) # Note: The first input
parameter in grf is locations. At first I tried nrow(r)*ncol(y) but I got the
ouput that this...