[GRASS-dev] r.univar -g: output total as well

Markus Neteler neteler at osgeo.org
Thu Aug 20 05:52:22 EDT 2009


On Thu, Aug 20, 2009 at 2:50 AM, Hamish<hamish_b at yahoo.com> wrote:
> much faster:
>  g.region -g | grep cells

faster yes, but I am already running r.univar to get the other
numbers, so I can keep it simple.

On Thu, Aug 20, 2009 at 4:55 AM, Hamish<hamish_b at yahoo.com> wrote:
>>      if (param.shell_style->answer) {
>> +       fprintf(stdout, "total=%d\n", stats->size);
>>         fprintf(stdout, "n=%d\n", stats->n);
>>         fprintf(stdout, "null_cells=%d\n", stats->size - stats->n);
>>         fprintf(stdout, "min=%.15g\n", stats->min);
>
>
> FWIW I'd put it after n= so you see a nice ratio of the two a/b.
>
> or maybe after null_cells=
>
> n=
> null_cells=
> +________
> total=
...
> or to match `g.region -g` (and r.univar null_cells=) call it cells=
> not total=

Sounds good. Submitted:

r.univar -g terra_lst1km20030624.LST_Day_1km.rst
n=5698
null_cells=821198
cells=826896
min=21.464111328125
max=29.8845901489258
range=8.42047882080078
mean=25.3690008519616
mean_of_abs=25.3690008519616
stddev=1.75958414427925
variance=3.09613636079894
coeff_var=6.93596154829724
sum=144552.5668544769

May I backport to 6.4 as well?
I checked this

cd scripts
grep r.univar */* | grep -v html | grep cell

Nothing seems to conflict.


More information about the grass-dev mailing list