[GRASS-user] r.univar: total null and non-null cells: -1580967296

Markus Neteler neteler at osgeo.org
Sun Sep 11 10:40:08 EDT 2011


On Tue, Aug 23, 2011 at 8:48 AM, Hermann Peifer <peifer at gmx.eu> wrote:
> Hi,
>
> r.univar gives me negative cell counts, whereas r.stats -c produces correct
> results (I hope ;-):
>
> (...)
> 41 118441
> 42 193
> 43 135
> 44 8189
> * 2704177984
>
> I guess this is the same integer overflow issue reported earlier [1]. I am
> just a bit puzzled that after changing to a 64-bit Linux OS, results of
> r.stats seem to be correct, but not those of r.univar.
>
> Am I missing something, perhaps an upgrade? (I'm using GRASS 6.4.0.)
>
> Hermann
>
> [1] http://lists.osgeo.org/pipermail/grass-user/2009-October/052574.html

I can confirm this (64bit Linux):

GRASS 6.4.2svn (nc_spm_08):~ > g.region -dg res=8
n=320000
s=10000
w=120000
e=935000
nsres=8
ewres=8
rows=38750
cols=101875
cells=3947656250

GRASS 6.4.2svn (nc_spm_08):~ > r.univar elevation
 100%
total null and non-null cells: -347311046    <<--- !
total null cells: -350476046                     <<--- !

Of the non-null cells:
----------------------
n: 3165000
minimum: 55.5788
maximum: 156.33
range: 100.751
mean: 110.371
mean of absolute values: 110.371
standard deviation: 20.3162
variance: 412.748
variation coefficient: 18.4071 %
sum: 349325348.8554420471


Same in GRASS 7:

GRASS 7.0.svn (nc_spm_08 at neteler):~ > r.univar elevation
 100%
total null and non-null cells: -347311046
total null cells: -350476046

Of the non-null cells:
----------------------
n: 3165000
minimum: 55.5788
maximum: 156.33
range: 100.751
mean: 110.371
mean of absolute values: 110.371
standard deviation: 20.3162
variance: 412.748
variation coefficient: 18.4071 %
sum: 349325348.8554420471

I suppose that r.univar is lacking the needed off_t updates.

Markus


More information about the grass-user mailing list