other versions
- jessie 6.4.4-1
- stretch 7.2.0-2
- testing 7.6.0-1
- unstable 7.6.0-1
- experimental 7.6.1-1~exp1
r.univar(1grass) | Grass User's Manual | r.univar(1grass) |
NAME¶
r.univar - Calculates univariate statistics from the non-null cells of a raster map.KEYWORDS¶
raster, statisticsSYNOPSIS¶
r.univarFlags:¶
- -g
-
- -e
-
- -t
-
- --verbose
-
- --quiet
-
Parameters:¶
- map=name[,name,...]
-
- zones=name
-
- output=name
-
- percentile=float[,float,...]
-
- fs=character
-
DESCRIPTION¶
r.univar calculates the univariate statistics of one or several raster map(s). This includes the number of cells counted, minimum and maximum cell values, range, arithmetic mean, population variance, standard deviation, and coefficient of variation. 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. When multiple input maps are given to r.univar, the overall statistics are calculated. This is useful for a time series of the same variable, as well as for the case of a segmented/tiled dataset. Allowing multiple raster maps to be specified saves the user from using a temporary raster map for the result of r.series or r.patch.NOTES¶
As with most GRASS raster modules, r.univar operates on the raster array defined by the current 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. Without a zones input raster, the r.quantile module will be significantly more efficient for calculating percentiles with large maps.EXAMPLE¶
Calculate the raster statistics for zones within a vector map coverage and upload the results for mean, min and max back to the vector map:cut -f1,5,6,8 -d'|' > fields_stats.txt
columns='mean_elev DOUBLE PRECISION, min_elev DOUBLE PRECISION, max_elev DOUBLE PRECISION'
'{print "UPDATE fields_stats SET min_elev = "$2", max_elev = "$3", \
mean_elev = "$4" WHERE cat = "$1";"}' \
> fields_stats_sqlcmd.txt
TODO¶
mode, skewness, kurtosisSEE ALSO¶
g.region, r3.univar, r.average, r.median, r.mode, r.quantile, r.sum, r.series, r.stats, v.rast.stats, r.statistics, v.univarAUTHORS¶
Hamish Bowman, Otago University, New ZealandGRASS 6.4.4 |