[GRASS-user] calculate mode value on moving window (with mapalgebra) with null value cells

G. Allegri giohappy at gmail.com
Tue Jun 19 01:15:13 PDT 2012


I need to assign values to a the cells on the "border" of a raster. The
inside and the outside are distinguished by having or not having null
values assigned.
I also need to keep the other cell values (internals) untouched.
I thought to use a mapcalc expression like the following (knowing the the
external cells have value 9999)

if(A==9999,max(A[1,1],A[1,0],A[1,-1],A[0,-1],A[-1,-1],A[-1,0],A[-1,1],A[0,1]),A)

In this case I'm using max, and I alwasy obtain null values as result, as
if nulls (from the cells surrounding the external side of the border) were
considered maximum values respect to numeric values (of the internal cells).
I could substiture null values for the external cells with a very low
negative value, but I would prefer being able to exlude (or manage somehow)
null values in my filter.
Any suggestion?

giovanni
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20120619/ffd3f319/attachment.html>


More information about the grass-user mailing list