| 1 |
<h2>DESCRIPTION</h2> |
| 2 |
|
| 3 |
<em>r3.univar</em> calculates the univariate statistics for a 3D raster map. |
| 4 |
This includes the number of cells counted, minimum and maximum cell values, |
| 5 |
range, arithmetic mean, population variance, standard deviation, |
| 6 |
coefficient of variation, and sum. Statistics are calculated separately for every |
| 7 |
category/zone found in the <b>zones</b> input map if given. |
| 8 |
If the <b>-e</b> extended statistics flag is given the 1st quartile, median, |
| 9 |
3rd quartile, and given <b>percentile</b> are calculated. |
| 10 |
If the <b>-g</b> flag is given the results are presented in a format suitable |
| 11 |
for use in a shell script. |
| 12 |
If the <b>-t</b> flag is given the results are presented in tabular format |
| 13 |
with the given field separator. The table can immediately be converted to a |
| 14 |
vector attribute table which can then be linked to a vector, e.g. the vector |
| 15 |
that was rasterized to create the <b>zones</b> input raster. |
| 16 |
|
| 17 |
<h2>NOTES</h2> |
| 18 |
|
| 19 |
As with most GRASS raster3d modules, <em>r3.univar</em> operates on the voxel |
| 20 |
array defined by the current 3d region settings, not the original extent and |
| 21 |
resolution of the input map. See <em><a href="g.region.html">g.region</a></em>. |
| 22 |
<p> |
| 23 |
This module can use large amounts of system memory when the <b>-e</b> |
| 24 |
extended statistics flag is used with a very large region setting. If the |
| 25 |
region is too large the module should exit gracefully with a memory allocation |
| 26 |
error. Basic statistics can be calculated using any size input region. |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
<h2>EXAMPLE</h2> |
| 35 |
|
| 36 |
Computing univariate statistics of a 3D raster with randomly generated values: |
| 37 |
|
| 38 |
<div class="code"><pre> |
| 39 |
# define volume |
| 40 |
g.region n=10 s=0 w=0 e=10 b=0 t=10 res=1 res3=1 -p3 |
| 41 |
|
| 42 |
# generate random map |
| 43 |
r3.mapcalc "random_0_1 = rand(0., 1)" |
| 44 |
|
| 45 |
# compute univariate statistics, along with extended statistics |
| 46 |
r3.univar -e map=random_0_1 percentile=98 |
| 47 |
100% |
| 48 |
total null and non-null cells: 1000 |
| 49 |
total null cells: 0 |
| 50 |
|
| 51 |
Of the non-null cells: |
| 52 |
---------------------- |
| 53 |
n: 1000 |
| 54 |
minimum: 0.00053905 |
| 55 |
maximum: 0.998322 |
| 56 |
range: 0.997783 |
| 57 |
mean: 0.513676 |
| 58 |
mean of absolute values: 0.513676 |
| 59 |
standard deviation: 0.289969 |
| 60 |
variance: 0.0840821 |
| 61 |
variation coefficient: 56.4498 % |
| 62 |
sum: 513.676463040334 |
| 63 |
1st quartile: 0.257654 |
| 64 |
median (even number of cells): 0.524313 |
| 65 |
3rd quartile: 0.763637 |
| 66 |
98th percentile: 0.982924 |
| 67 |
|
| 68 |
# script style output, along with extended statistics |
| 69 |
r3.univar -ge map=random_0_1 percentile=98 |
| 70 |
n=1000 |
| 71 |
null_cells=0 |
| 72 |
cells=1000 |
| 73 |
min=0.000539049520323687 |
| 74 |
max=0.998322037540536 |
| 75 |
range=0.997782988020212 |
| 76 |
mean=0.513676463040334 |
| 77 |
mean_of_abs=0.513676463040334 |
| 78 |
stddev=0.289969154194666 |
| 79 |
variance=0.0840821103843701 |
| 80 |
coeff_var=56.4497646005434 |
| 81 |
sum=513.676463040334 |
| 82 |
first_quartile=0.257654 |
| 83 |
median=0.524313 |
| 84 |
third_quartile=0.763637 |
| 85 |
percentile_98=0.982924 |
| 86 |
</pre></div> |
| 87 |
|
| 88 |
<h2>TODO</h2> |
| 89 |
|
| 90 |
To be implemented <i>mode, skewness, kurtosis</i>. |
| 91 |
|
| 92 |
<h2>SEE ALSO</h2> |
| 93 |
|
| 94 |
<em> |
| 95 |
<a href="g.region.html">g.region</a>, |
| 96 |
<a href="r.univar.html">r.univar</a>, |
| 97 |
<a href="r.mode.html">r.mode</a>, |
| 98 |
<a href="r.quantile.html">r.quantile</a>, |
| 99 |
<a href="r.series.html">r.series</a>, |
| 100 |
<a href="r3.stats.html">r3.stats</a>, |
| 101 |
<a href="r.statistics.html">r.statistics</a>, |
| 102 |
<a href="v.rast.stats.html">v.rast.stats</a>, |
| 103 |
<a href="v.univar.html">v.univar</a> |
| 104 |
</em> |
| 105 |
|
| 106 |
<h2>AUTHORS</h2> |
| 107 |
|
| 108 |
Soeren Gebbert<br> |
| 109 |
Code is based on r.univar from<br> |
| 110 |
Hamish Bowman, Otago University, New Zealand<br> |
| 111 |
and Martin Landa<br> |
| 112 |
Zonal loop by Markus Metz |