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

Hamish hamish_b at yahoo.com
Sun Sep 11 17:26:47 EDT 2011


Markus wrote:
> I can confirm this (64bit Linux):
> 
> GRASS 6.4.2svn (nc_spm_08):~ > g.region -dg res=8
...
> GRASS 6.4.2svn (nc_spm_08):~ > r.univar elevation
>  100%
> total null and non-null cells: -347311046   
> total null cells: -350476046       
...
> I suppose that r.univar is lacking the needed off_t updates.


globals.h is defining univar_stat's 'n' and 'size' as int, and
stats.c is printing as plain '%d'. (fwiw in GRASS 5 I used
'unsigned int' originally, but it appears to haven be lost with
the introduction of r3.univar.)

suggest to use 'unsigned long' and "%lu" as is done by r.in.xyz,
and 'off_t' for 'n_alloc'.

try r48240 in trunk.


Hamish


ps- I get this warning when compiling it, not sure how to fix:
r3.univar_main.c: In function 'main':
r3.univar_main.c:146: warning: assignment discards qualifiers from pointer target type
146:     if (NULL == (mapset = G_find_raster3d(zonemap, "")))


More information about the grass-user mailing list