[GRASS-user] Looking for a Grass equivalent to ESRI'sFocalmean(grid, ANNULUS, irad, orad)

Dylan Beaudette dylan.beaudette at gmail.com
Sat Sep 1 18:14:10 EDT 2007


On Saturday 01 September 2007, Glynn Clements wrote:
> Moskovitz, Bob wrote:
> > I was just looking at the CVS version of r.neighbors but didn't see
> > where I can specify use an arbitrary neighbourhood shape unless it has
> > something to do with the weight=string option. Unfortunately the
> > documentation doesn't mention how to use it.
>
> The argument to the weight= option is the name of a file containing
> weights. The file should contain NxN floating-point values (anything
> acceptable to scanf's %f conversion).
>
> > So, with r.neighbors, how would I annulus shape neighbourhood shape?
>
> Create a weights file with a non-zero value for each cell which should
> be part of the neighbourhood, and zero elsewhere. E.g. for size=5:
>
>  0 1 1 1 0
>  1 0 0 0 1
>  1 0 0 0 1
>  1 0 0 0 1
>  0 1 1 1 0
>

This is an excellent update. If this does not make it into the docs soon, let 
me know and I can cook up some example HTML + images.

cheers,

Dylan


> The minimum, maximum, diversity and interspersion aggregates don't
> care about the actual weight; they simply discard any values with a
> zero weight and retain those with a non-zero weight.
>
> For the other aggregates, the way in which the weights affect the
> aggregate is fairly intuitive. In particular, an integer weight has
> the same effect as repeating the value that may times (integer weights
> aren't treated specially; this is just a consequence of how the
> weights are handled).
>
> Finally, note that r.neighbors, r.series and r.resamp.stats all use
> use the same code for the aggregates (although r.series only uses the
> unweighted forms).



-- 
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341




More information about the grass-user mailing list