[GRASS-dev] r.univar -e

Martin Landa landa.martin at gmail.com
Thu Aug 31 03:42:00 EDT 2006


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...).

Best, Martin

  GRASS 6.3.cvs (spearfish60):~ > r.univar help

Description:
  Calculates univariate statistics from the non-null cells of a raster map.

Keywords:
 raster, statistics

Usage:
  r.univar [-qge] map=name [percentile=value]

Flags:
  -q   Quiet mode
  -g   Print the stats in shell script style
  -e   Calculate extended statistics (quartiles and percentile)

Parameters:
         map   Name of input raster map
  percentile   Percentile to calculate (requires -e flag)
               default: 90

Just simple test:

* for DCELL:
GRASS 6.3.cvs (spearfish60):~ > g.region rast=elevation.10m;r.univar
elevation.10m -e
 100%
total null and non-null cells: 2654802
total null cells             : 0

Of the non-null cells:
----------------------
Number of cells (excluding NULL cells): 2654802
Minimum                               : 1061.06
Maximum                               : 1846.74
Range                                 : 785.679
Arithmetic mean                       : 1348.37
Arithmetic mean of absolute values    : 1348.37
Standard deviation                    : 175.494
Variance                              : 30798.3
Variation coefficient                 : 13.0153 %
Sum                                   : 3579659211.6848597527
1st Quartile                          : 1196.8
Median (even number of cells)         : 1309.37
3st Quartile                          : 1480.29
90 Percentile                         : 1613.6

* for FCELL:
GRASS 6.3.cvs (spearfish60):~ > g.region rast=slope;r.univar slope -e
 100%
total null and non-null cells: 303052
total null cells             : 12929

Of the non-null cells:
----------------------
Number of cells (excluding NULL cells): 290123
Minimum                               : 0
Maximum                               : 52.5202
Range                                 : 52.5202
Arithmetic mean                       : 11.5277
Arithmetic mean of absolute values    : 11.5277
Standard deviation                    : 7.64516
Variance                              : 58.4484
Variation coefficient                 : 66.3198 %
Sum                                   : 3344457.5523851216
1st Quartile                          : 5.38598
Median (odd number of cells)          : 9.97027
3st Quartile                          : 16.3104
90 Percentile                         : 22.4337

* for CELL:
GRASS 6.3.cvs (spearfish60):~ > g.region rast=roads;r.univar roads -e
 100%
total null and non-null cells: 302418
total null cells             : 291124

Of the non-null cells:
----------------------
Number of cells (excluding NULL cells): 11294
Minimum                               : 1
Maximum                               : 5
Range                                 : 4
Arithmetic mean                       : 3.8091
Arithmetic mean of absolute values    : 3.8091
Standard deviation                    : 1.29705
Variance                              : 1.68235
Variation coefficient                 : 34.0514 %
Sum                                   : 43020
1st Quartile                          : 3
Median (even number of cells)         : 4
3st Quartile                          : 5
90 Percentile                         : 5

-- 
Martin Landa <landa.martin at gmail.com> * http://gama.fsv.cvut.cz/~landa *
-------------- next part --------------
A non-text attachment was scrubbed...
Name: r_univar-e.diff.gz
Type: application/x-gzip
Size: 2977 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20060831/ffb2fc67/r_univar-e.diff.gz


More information about the grass-dev mailing list