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

G. Allegri giohappy at gmail.com
Tue Jun 19 09:13:39 PDT 2012


Hi Moritz,
this is a partial solution (as assigning unlikely high/low values to the
null cells), but it doesn't solve, for example, the mode() function.
Anyway, this was the way I already followed ;)

giovanni

2012/6/19 Moritz Lennert <mlennert at club.worldonline.be>

> On 19/06/12 10:15, G. Allegri wrote:
>
>> 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)
>>
>
> How about using an isnull() function on each cell, i.e.:
>
> if(A==9999,max(if(isnull(A[1,**1]),0,A[1,1]),if(isnull(A[1,0]**),0,A[1,0]),
> etc, ),A)
>
> ?
>
> Moritz
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20120619/c268643d/attachment.html>


More information about the grass-user mailing list