[GRASS-user] MAP Calculator mean of eight neighbors to interpolate 0 value in raster map

stephen sefick ssefick at gmail.com
Fri Aug 28 13:05:47 EDT 2009


I think so- let me try it

On Fri, Aug 28, 2009 at 12:04 PM, achim<ak7 at jupiter.uni-freiburg.de> wrote:
> r.mapcalc "newmap = if ( yourmap==0 , ( sum( yourmap[-1,1] ,
> yourmap[0,1] , ...)/8 ) , yourmap)"
>
> is that what you mean?
>
> stephen sefick schrieb:
>> if(0, (sum([-1,1], [0, 1], [1,1], [-1,0], [0,0], [1,0],[-1,-1],
>> [0,-1],[1,-1])/8))
>>
>> I want to use mapcalc to do the above.  I am missing a syntax step.
>> if a value is zero take the average of the eight nearest neighbors and
>> replace the value with this.  Otherwise, keep the value unchanged
>>
>



-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

								-K. Mullis


More information about the grass-user mailing list