[GRASS-dev] r3.stats and heapsort

Sören Gebbert soerengebbert at gmx.de
Mon Feb 19 06:12:42 EST 2007


Dear devs,
i have implemented a new raster3d module called r3.stats.
This module calculates volume statistics for raster3d maps.
The functionality is mostly similar to r.stats, except the category 
support for raster3d maps (AFAIK categories are implemented in g3dlib 
but not used) and the output format (i dont see the necessity of dozen 
format flags).

r3.stats calculates volume statistics based on subranges like r.stats
and volume statistics based on groups of unique values. Examples are 
available in the documentation of the module.

http://www-pool.math.tu-berlin.de/~soeren/grass/modules/r3.stats.tar.bz2

This module is implemented from scratch, its not based on the code of 
r.stats. Because r.stats has a bug in computing subrange statistics 
which i was not able to correct. :(
r3.stats is not that sophisticated like r.stats, because it does not use 
  linked lists and hash tables, it can be very memory consuming and i 
guess it is by far not as fast as r.stats. Because of the quadratic 
complexity for subrange calculations, the number of subranges is limited 
  to 1 - 100000.

r3.stats uses heapsort to calculate groups of equal values. Because of 
this and the fact that r3.univar uses heapsort and r.univar hopefully 
soon too, i would like to add heapsort as library function to grass:

extern int G_heapsort_int(int *array, int num);
extern int G_heapsort_float(float *array, int num);
extern int G_heapsort_double(double *array, int num);


Important:
Please do not test r3.stats bevor i have submitted the data type patch i 
have announced one day befor.

Best regards
Soeren




More information about the grass-dev mailing list