R raster package: memory shortage when using “getValuesFocal” function -



R raster package: memory shortage when using “getValuesFocal” function -

i have raster (1300 1400 cells) 3 layers , create focal calculations using info 3 layers. illustration 1 of layers land cover map , utilize in calculations these pixels in focal window have same land cover type central pixel of window. suppose not possible “focal” function in raster bundle why tried extract info 3 layers every moving window extent “getvaluesfocal”. after doing thought loop through rows of array resulting “getvaluesfocal”. array big , not fit memory error message:

dataraster <- stack(classification, layer2, layer3) info <- getvaluesfocal(dataraster, ngb=11, names=true, padvalue=na, array=true) error: cannot allocate vector of size 1.7 gb in addition: warning messages: 1: in `rownames<-`(`*tmp*`, value = 1:1879200) : reached total allocation of 8008mb: see help(memory.size)

i know packages ff , bigmemory allow handling big datasets how can utilize them when dataset cannot created. using 64-bit r , have 8gb ram. there way write result of “getvaluesfocal” in file? grateful help.

you can read info in chuncks using row , nrows arguments. example

library(raster) r <- raster(nr=5, nc=5, crs='+proj=utm +zone=12') r[] <- 1:25 as.matrix(r) getvaluesfocal(r, row=1, nrows=2, ngb=3, names=true)

r r-raster

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -