FYI, Glynn has answered me right now on grass-dev saying that in trunk nmax, nmin, nmode, etc. are available, which discard NULL values.<div><br></div><div>giovanni<br><br><div class="gmail_quote">2012/6/20 G. Allegri <span dir="ltr"><<a href="mailto:giohappy@gmail.com" target="_blank">giohappy@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
g.region -p rast=DEM<br>
r.neighbors in=DEM out=DEM_filt method=mode<br>
r.patch in=DEM,DEM_filt out=DEM_patched<br></blockquote><div><br></div></div><div>Right Markus ;)</div><div>This is the simplest approach.</div><div class="im"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div>BTW, if the border problem arouse from reprojecting with a method</div>
other than nearest, you can use in trunk as resampling method one of<br>
bilinear_f,cubic_f,lanczos_f with r.proj to avoid the border effect.<br></blockquote><div><br></div></div><div>I didn't know about these "fallbacks" methods in trunk. Very good.</div><div>I was thinking about that since a long time, because it's a featue I find very useful in ArcGIS. GRASS gives a plus: the option to use fallbacks or not ;)</div>

<div><br></div><div>It would be useful to have them in r.resamp.interp too. This is the command that "eats" my border.</div><div><br></div><div>giovanni</div><div><div class="h5"><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<br>
Markus M<br>
<div><div><br>
><br>
> giovanni<br>
><br>
> 2012/6/19 Markus Metz <<a href="mailto:markus.metz.giswork@googlemail.com" target="_blank">markus.metz.giswork@googlemail.com</a>><br>
>><br>
>> On Tue, Jun 19, 2012 at 6:15 PM, G. Allegri <<a href="mailto:giohappy@gmail.com" target="_blank">giohappy@gmail.com</a>> wrote:<br>
>> >> AFAICT, r.neighbors ignores NULL values and assigns the new value from<br>
>> >> the surrounding non-NULL values. You could then patch your original<br>
>> >> map with the output of r.neighbors.<br>
>> ><br>
>> ><br>
>> > I have considered r.neighbors but I need to apply the filter only to<br>
>> > some<br>
>> > specific categories (border cells in my case). A MASK wouldn't solve my<br>
>> > problem, because it would mask the neighbors...<br>
>><br>
>> You could replace 9999 (according to your first post the category of<br>
>> border cells) with NULL, then run r.neighbors, without a MASK?<br>
>><br>
>> Markus M<br>
>><br>
>> ><br>
>> > giovanni<br>
>> ><br>
>> ><br>
>> >><br>
>> >><br>
>> >> HTH,<br>
>> >><br>
>> >> Markus M<br>
>> >><br>
>> >> ><br>
>> >> > giovanni<br>
>> >> ><br>
>> >> ><br>
>> >> > 2012/6/19 Marcello Gorini <<a href="mailto:gorini@gmail.com" target="_blank">gorini@gmail.com</a>><br>
>> >> >><br>
>> >> >><br>
>> >> >><br>
>> >> >> G. Allegri wrote:<br>
>> >> >><br>
>> >> >>> I need to assign values to a the cells on the "border" of a raster.<br>
>> >> >>> The<br>
>> >> >>> inside and the outside are distinguished by having or not having<br>
>> >> >>> null<br>
>> >> >>> values<br>
>> >> >>> assigned.<br>
>> >> >>> I also need to keep the other cell values (internals) untouched.<br>
>> >> >>><br>
>> >> >><br>
>> >> >>  Hey,<br>
>> >> >><br>
>> >> >> Check out r.grow. I am pretty sure you can modify the example given<br>
>> >> >> in<br>
>> >> >> the<br>
>> >> >> manual to find the borders of your raster. Something like:<br>
>> >> >><br>
>> >> >> # creates an inverted raster from your raster<br>
>> >> >> > r.mapcalc "raster_inverted=if(isnull(raster,1,null())"<br>
>> >> >> # grow this inverted raster by one cell<br>
>> >> >> > r.grow in=raster_inverted out=raster_inverted_grown<br>
>> >> >> # now both rasters overlap at the border, so you can do whatever you<br>
>> >> >> want<br>
>> >> >> with it, for instance, extract it<br>
>> >> >> > r.mapcalc "border=if(raster_inverted_grown==1 &&<br>
>> >> >> > isnull(raster)==0,raster,null())"<br>
>> >> >><br>
>> >> >> Hope it helps.<br>
>> >> >><br>
>> >> >> Cheers,<br>
>> >> >> Marcello.<br>
>> >> >><br>
>> >> >><br>
>> >> >><br>
>> >> ><br>
>> >> ><br>
>> >> > _______________________________________________<br>
>> >> > grass-user mailing list<br>
>> >> > <a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>
>> >> > <a href="http://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
>> >> ><br>
>> ><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div></div></div><br>
</blockquote></div><br></div>