[GRASS-dev] r.univar -e

Hamish hamish_nospam at yahoo.com
Wed Sep 6 01:08:09 EDT 2006


Martin Landa wrote:
> Hi all,
> 
> I have added '-e' flag to r.univar according to r.univar.sh. See the
> attached patch. Please look at the code, any comments welcomed...
> (before committing to CVS - if desired...).

Nice work!

I have merged your patch locally with a few minor changes:
  http://bambi.otago.ac.nz/hamish/grass/r.univar_ext.c
    or if you prefer,
  http://bambi.otago.ac.nz/hamish/grass/r.univar_ext.diff


A few comments/questions before putting it in CVS:

* It is quite a bit faster than r.univar.sh! (I guess this is to be
expected, but it's always nice to see)

* qsort() comparison functions are declared as static int. 
a) shouldn't they just be int?
b) could/should these fns be inlined for speed?

* GRASS 5's s.cellstats uses something called qisort() instead of
qsort(), which claims to be faster. Comments from the crowd?
 http://freegis.org/cgi-bin/viewcvs.cgi/grass/src/sites/s.cellstats/qisort.c?rev=HEAD&content-type=text/vnd.viewcvs-markup

* Are there any issues with having shell variables (-g flag) which start
with a number?

* I've held off on reformatting the output. Your patch assumes that the
font will be monospaced, while the new GUI(s) may prefer to use a
proportional font.

* fabsf() removed as it's non-POSIX. fabs() used instead.

* Kept "Mean" instead of "Arithmetic mean". Sample, population,
geometric means don't apply in this context, so keep it simple.


TODOs
 easy: mean of squares  (if anyone needs this just ask & I'll put it in)
 harder: mode, skewness, kurtosis   (begging required, file a wish)



thanks,
Hamish




More information about the grass-dev mailing list