[GRASS-stats] r.mapcalc, median and NULL

Agustin Lobo Agustin.Lobo at ija.csic.es
Thu Feb 12 12:58:58 EST 2009


Hi!
The grass doc is very clear on the behavior of r.mpacalc regarding NULL:
"NULL-values in function arguments should result in NULL"

I have to calculate the median of a set of 12 monthly layers, i.e.
mean(l1,l2,l3,...l12)

the problem is that some layers have some NULL values. I can
replace NULL by, for example, 0, but this will be having a large effect
in the value of the mean. Is not there any way of setting something
like the na.rm=T of R?

Alternatively, could I calculate (in GRASS) a raster of the number of
months with NULL value present
for each i, j position? In that way I could replace NULL by 0 but then add up
the layers and divide by a raster that would be 12 in most cells, 11 in those
having 1 NULL, 10 in those having 2 NULL etc

Not sure if I explain myself clearly. Would be easily done in R, but
the raster layers are large. Perhaps a problem for the R raster
package?

Agus


-- 
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
e-mail Agustin.Lobo at ija.csic.es
http://www.ija.csic.es/gt/obster


More information about the grass-stats mailing list