[GRASSLIST:6235] r.neighbor - new question

Daniel Victoria daniel_victoria at yahoo.com
Fri May 9 09:11:43 EDT 2003


Thanks,

Sometimes there is a simple answer but you just can't
see it.
I have another question now. This might sound dumb but
in the r.neighbor man page it says that it uses a
moving window in order to do the calculations. Does
this means that if the window is going from left to
right for instance, at a ceirtain point r.nieghbor
will use an already avereged cell in order to
calculate the new cell or the program only uses the
original values to calculate the average?

--- Glynn Clements <glynn.clements at virgin.net> wrote:
> 
> Daniel Victoria wrote:
> 
> > I'm trying to run r.neighbor on selected cells.
> What I
> > want to do is to substitute specific cell values
> > (lower than 10 for instance) with the value
> produce by
> > a r.neighbor average. Is there a way to do this in
> > GRASS?
> 
> If I understand you correctly, the simplest way to
> do this is to first
> create a new map with r.neighbors, then use
> r.mapcalc to choose
> between the original map and the new map, e.g.
> 
> 	r.neighbors input=origmap output=newmap
> method=average size=7
> 	r.mapcalc 'result = if(origmap < 10, newmap,
> origmap)'
> 
> > I tried r.mapcalc but I got a little confused with
> the
> > neighbor operand [r,c]. For a 3x3 window the [r,c]
> in
> > r.mapcalc should be easy but for something larger
> > (7x7) it would be a lot more work. Is there an
> easyer
> > way?
> 
> Re-implementing r.neighbors in r.mapcalc is
> impractical for large
> window sizes; there aren't any looping constructs,
> so there isn't any
> way of doing it without writing N-squared distinct
> terms (e.g. 49
> terms for a 7x7 window).
> 
> -- 
> Glynn Clements <glynn.clements at virgin.net>


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com




More information about the grass-user mailing list