r3.univar1grass
Calculates univariate statistics from the non-null cells of a 3d raster map. statistics include number of cells counted, minimum and maximum cell values, range, arithmetic mean, population variance, standard deviation, coefficient of variation, and sum.
Usage
r3.univar
r3.univar --help
r3.univar [-get]
map=name
[zones=name]
[output=name]
[percentile=float
[,float, ...]]
[separator=character]
[--overwrite]
[--help]
[--verbose]
[--quiet]
[--ui]
Keywords
raster3d, statistics, univariate statistics
Overview
r3.univar calculates the univariate statistics for a 3D raster map. This includes the number of cells counted, minimum and maximum cell values, range, arithmetic mean, population variance, standard deviation, coefficient of variation, and sum. Statistics are calculated separately for every category/zone found in the zones input map if given. If the -e extended statistics flag is given the 1st quartile, median, 3rd quartile, and given percentile are calculated. If the -g flag is given the results are presented in a format suitable for use in a shell script. If the -t flag is given the results are presented in tabular format with the given field separator. The table can immediately be converted to a vector attribute table which can then be linked to a vector, e.g. the vector that was rasterized to create the zones input raster.
Notes
As with most GRASS raster3d modules, r3.univar operates on the voxel array defined by the current 3d region settings, not the original extent and resolution of the input map. See g.region.
This module can use large amounts of system memory when the -e extended statistics flag is used with a very large region setting. If the region is too large the module should exit gracefully with a memory allocation error. Basic statistics can be calculated using any size input region.
Examples
Computing univariate statistics of a 3D raster with randomly generated values:
# define volumeg.region n=10 s=0 w=0 e=10 b=0 t=10 res=1 res3=1 -p3# generate random mapr3.mapcalc "random_0_1 = rand(0., 1)" -s# compute univariate statistics, along with extended statisticsr3.univar -e map=random_0_1 percentile=98100%total null and non-null cells: 1000total null cells: 0Of the non-null cells:----------------------n: 1000minimum: 0.00053905maximum: 0.998322range: 0.997783mean: 0.513676mean of absolute values: 0.513676standard deviation: 0.289969variance: 0.0840821variation coefficient: 56.4498 %sum: 513.6764630403341st quartile: 0.257654median (even number of cells): 0.5243133rd quartile: 0.76363798th percentile: 0.982924# script style output, along with extended statisticsr3.univar -ge map=random_0_1 percentile=98n=1000null_cells=0cells=1000min=0.000539049520323687max=0.998322037540536range=0.997782988020212mean=0.513676463040334mean_of_abs=0.513676463040334stddev=0.289969154194666variance=0.0840821103843701coeff_var=56.4497646005434sum=513.676463040334first_quartile=0.257654median=0.524313third_quartile=0.763637percentile_98=0.982924
Todo
To be implemented mode, skewness, kurtosis.
Source code
Available at: r3.univar source code (history)
Accessed: Monday Feb 24 17:50:56 2025
Main index | 3D raster index | Topics index | Keywords index | Graphical index | Full index
© 2003-2025 GRASS Development Team, GRASS GIS 8.4.1 Reference Manual
Releases
8 releases since Debian 6.0 (Squeeze); the text changed 7 times.