r3.univar.html 3.4 KB

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