[GRASS-dev] Re: r.neighbors modification

Martin Wegmann wegmann at biozentrum.uni-wuerzburg.de
Tue Nov 28 07:48:42 EST 2006


On Tuesday 28 November 2006 00:38, Hamish wrote:
> Martin Wegmann wrote:
> > > > you might combine all those flags into one option,
> > > > #%option
> > > > #% key: size
> > > > #% type: integer
> > > > #% description: compute var & avg of NxN ring
> > > > #% options: 3,5,7,9,11
> > > > #% answer: 5
> > > > #% required : no
> > > > #%END
> > >
> > > very good - implemented
> >
> > is it possible to add a flag when all sizes shall be computed?
> >
> > I tried a bit with || statements in the if-then part, but had no luck
> > so far.
> >
> > any ideas?
>
> from the parser standpoint:
>
> #% options: 3,5,7,9,11
> #% multiple: yes
>
>
> then you can have e.g. a 2 cell wide ring with
>
> size=5,7
>
>
> [There are two options here: multiple individual sizes or combination
> sizes. The rest talks about multiple sizes within the same map as that's
> more interesting to me.]
>
> [Will r.mfilter do the same as the output _avg map?]

just quick test and reply:

r.covar gives:
1.000000 0.969710 
0.969710 1.000000 

same algorithm but with moving window shows a few differences (see jpg).
(divide by 1000 to get correlation values between -1 and 1)

Martin
>
> from the g.parser help page:
> NOTES
> An option can be instructed to allow multiple inputs by adding the
> following line:
>
> #% multiple : yes
>
> While this will only directly change the Usage section of the help
> screen, the option's environmental string may be easily parsed from
> within a script. For example, individual comma separated identities for
> an option named "input" can be parsed with the following Bash shell
> code:
>
> IFS=,
> for opt in $GIS_OPT_INPUT ; do
>     ... "$opt"
> done
>
> I am not sure how to do the r.mapcalc part then, maybe >> append each
> mapcalc ring size rules to a file, then run r.mapcalc redirecting the
> conglomorate file to stdin,
>
> r.mapcalc < $TMP.rulesfile
>
> it would take too much to fully paste all combinations in to the script
> without some sort of dynamic rule building.
>
>
>
>
> if you want multiple individual maps, set DO_5=0, DO_7=1 in the loop
> and then test for that, e.g.:
>
> DO_3=0
> DO_5=0
> DO_7=0
> # ...
>
> IFS=,
> for size in $GIS_OPT_SIZE ; do
>   if [ $size -eq 3 ] ; then
>     DO_3=1
>   fi
>   if [ $size -eq 5 ] ; then
>     DO_5=1
>   fi
>   if [ $size -eq 7 ] ; then
>     DO_7=1
>   fi
> # ...
>
> done
>
> (or something like that)
>
>
> Hamish
>
> _______________________________________________
> grass-dev mailing list
> grass-dev at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mfilter_ring_correlation.jpg
Type: image/jpeg
Size: 66845 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20061128/910fc5f9/mfilter_ring_correlation.jpg


More information about the grass-dev mailing list