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

Marcello Gorini gorini at gmail.com
Tue Jun 19 04:18:55 PDT 2012


OK, sorry for that. So your problem is the famous edge effect that affects
us all.

Well, I think you have a real problem there.

If you find a good solution, please share.

Best,
Marcello.






On Tue, Jun 19, 2012 at 11:39 AM, G. Allegri <giohappy at gmail.com> wrote:

> Hi Marcello,
> thanks, but my problem is not finding the border. I already have it (with
> its own category) but assigning it the value from the surrounding (not
> null) value, e.g. max/min/etc.
> The problem with kernel filters/moving windows is that they do not filter
> out null values...
>
> giovanni
>
>
> 2012/6/19 Marcello Gorini <gorini at gmail.com>
>
>>
>>
>> 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.
>>>
>>>
>>  Hey,
>>
>> Check out r.grow. I am pretty sure you can modify the example given in
>> the manual to find the borders of your raster. Something like:
>>
>> # creates an inverted raster from your raster
>> > r.mapcalc "raster_inverted=if(isnull(raster,1,null())"
>> # grow this inverted raster by one cell
>> > r.grow in=raster_inverted out=raster_inverted_grown
>> # now both rasters overlap at the border, so you can do whatever you want
>> with it, for instance, extract it
>> > r.mapcalc "border=if(raster_inverted_grown==1 &&
>> isnull(raster)==0,raster,null())"
>>
>> Hope it helps.
>>
>> Cheers,
>> Marcello.
>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20120619/5fae36e7/attachment-0001.html>


More information about the grass-user mailing list