[R-sig-Geo] NA values with r.neighbors GRASS

alexandre villers alexandre.villers at cebc.cnrs.fr
Sat Aug 29 12:12:54 CEST 2009


Good morning,

There is something obscure with r.neighbors.
Here is the code

execGRASS("r.in.gdal", flags=c("o"), parameters=list(input=paste(getwd(), "/", listASC[i], sep=""), output="temp"))      
execGRASS("r.null",parameters=list(map="temp",setnull=c("-9999")))#to make sure that NA values (data on the Atlantic ocean) from the ASCII file are interpreted correctly 
execGRASS("r.neighbors", flags="c", parameters=list(input="ref", output="tempL", method="average", size=as.integer(9)))

when checking the output file (either with r.out.gdal or readRAST6), NA values got the value -2999 after the r.neighbors routine and, which is more annoying, cells at the edge (on the coast) were averaged with those value of -2999.

I suppose r.neighbors can not average pixel value when surrounding pixels are empty but could someone confirm me this is really the case ?
Is there a way to keep NA values as NAs (and not -2999) or do I need to modify those values after r.neighbors?

I looked through the r.neighbors documentation but there is nothing, unless I missed it, on the handling of NAs for this routine.

Thanks for your help.

Alex

Alexandre Villers
PhD. Student
Team Biodiversity
CEBC CNRS
79360 Beauvoir sur Niort


__________ Information from ESET Mail Security, version of virus signature database 4378 (20090828) __________

The message was checked by ESET Mail Security.
http://www.eset.com



More information about the R-sig-Geo mailing list