[GRASS-dev] r.sum - parsable for shell scripts
Jachym Cepicky
jachym.cepicky at centrum.cz
Mon Nov 27 01:26:12 EST 2006
allright,
as usage of r.sum is deprecated, I added one line with comment to the
module and put the whitespaces back
jachym
On Mon, Nov 27, 2006 at 02:39:28PM +1300, Hamish wrote:
> > Jachym wrote:
> > > r.sum produced result with spaces:
> > > SUM = 8787936.000000
> > >
> > > which makes it hard parable for shell scripts:
> > > eval `r.sum rast=soils --q`
> > > bash: SUM: command not found
> > >
> > > IMHO there is no barrier to remove this white spaces, so the that
> > > result looks like
> > > SUM=8787936.000000
> > >
> > > and one can easily perform something like
> > > eval `r.sum rast=soils --q`
> > > echo $SUM
> > > 8787936.000000
> > >
> > > I allready sent this to cvs - I'm just asking, to be sure.
>
> Maciek:
> > This is certainly a good approach what you have done, but I'm not
> > really sure such changes should be allowed during 6.x. Maybe postpone
> > it until GRASS 7? There might be users scripts that use r.sum and we
> > never know how they parse r.sum's output. But maybe I'm just too
> > cautious. What do others think?
>
> cautious is good. This module is very likely to be used in scripts, so
> I'd suggest keeping it's output the same during GRASS 6.x.
>
> just guessing how folks might parse that currently,
> awk '{print $3}'
> or
> cut -f3 -d' '
> or
> ...?
>
> If parsable output is desired, add a "-g" flag to do that.
>
>
> As this module gives the same result as r.univar, for future development
> I suggest depreciating the module and recommending the user just use
> r.univar instead of r.sum. It is slightly slower but the more code
> consolidation we do the better IMO.
>
> see also:
> https://intevation.de/rt/webrt?serial_num=1848
>
> ie these modules:
> r.sum, r.mode, r.median, r.average, r.statistics, r.univar, r.univar2
> might be reduced to just:
> r.statistics and r.univar ?
>
> (I don't use r.mode, r.median, r.average, r.statistics, so don't know if
> it is worth keeping r.statistics or push r.univar + r.mask|r.reclass ?)
>
>
> Hamish
>
> _______________________________________________
> grass-dev mailing list
> grass-dev at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev
--
Jachym Cepicky
e-mail: jachym.cepicky at centrum.cz
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub
-----------------------------------------
OFFICE:
Department of Geoinformation Technologies
Zemedelska 3
613 00, Brno
Czech Republick
e-mail: xcepicky at node.mendelu.cz
URL: http://mapserver.mendelu.cz
Tel.: +420 545 134 514
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20061127/d675d398/attachment.bin
More information about the grass-dev
mailing list