[GRASS-dev] Re: r.neighbors modification
Martin Wegmann
wegmann at biozentrum.uni-wuerzburg.de
Thu Nov 23 13:07:08 EST 2006
[..]
> > I am looking for a way to compute r.neighbors for a ring only and not
> > for
>
> the
>
> > whole 5x5, 7x7 etc. moving window.
> > It is something like a 7x7 windows but minus the values in the 5x5
> > windows.
> >
> > traditional way:
> >
> > a a a a a
> > a b b b a
> > a b x b a
> > a b b b a
> > a a a a a
> >
> > ring analysis:
> >
> > a a a a a
> > a a
> > a x a
> > a a
> > a a a a a
>
> I'm guessing that should be:
> > a a a a a
> > a a
> > a x a
> > a a
> > a a a a a
> >
> >
> > I think there is no post-r.neighbors way to compute statistics in such
> > a "ring",
>
> It depends upon the aggregate. Some of them could be computed with a
> combination of r.neighbors and r.mapcalc commands.
>
> They could all be done using r.mapcalc, but some of them might require
> excessively complex expressions (at a minimum, they would all involve
> 16 map[r,c] terms). r.mapcalc has n-ary min, max, median and mode; sum
> and mean are fairly easy to write (you would probably want to process
> the nulls separately to simplify the expressions), variance and stddev
> aren't hard but would be somewhat more verbose.
I wrote a short neighbourhood ring analysis for average and
variance analysis (currently only up to 11x11 but I will add rings up to
21x21).
Hamish advice how to improve a script (v.cellstats threat) is partly
incorporated but I am grateful for any further suggestions how to improve this
script.
Martin
> Of course, the expressions get longer as the window size increases,
> and you would need a separate expression for each size (although you
> could probably generate it from a script).
>
> > hence I or somebody else has to modify the source code. I am
> > willing to learn some more C programming, but definitely need some help
> > to get started.
>
> I'm not sure it's worth modifying r.neighbors for this specific case
> (it might be worth you modifying your version, but not us shipping a
> modified version). More generally useful would be to allow the
> neighbourhood set to be read from a file, similar to r.mfilter (or
> even just have a list of offsets as an optional argument).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: r.ring
Type: application/x-shellscript
Size: 13610 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20061123/fbc3361a/r.bin
More information about the grass-dev
mailing list