1r.stats.zonal(1) GRASS GIS User's Manual r.stats.zonal(1)
2
3
4
6 r.stats.zonal - Calculates category or object oriented statistics (ac‐
7 cumulator-based statistics).
8
10 raster, statistics, zonal statistics
11
13 r.stats.zonal
14 r.stats.zonal --help
15 r.stats.zonal [-cr] base=name cover=name method=string output=name
16 [--overwrite] [--help] [--verbose] [--quiet] [--ui]
17
18 Flags:
19 -c
20 Cover values extracted from the category labels of the cover map
21
22 -r
23 Create reclass map with statistics as category labels
24
25 --overwrite
26 Allow output files to overwrite existing files
27
28 --help
29 Print usage summary
30
31 --verbose
32 Verbose module output
33
34 --quiet
35 Quiet module output
36
37 --ui
38 Force launching GUI dialog
39
40 Parameters:
41 base=name [required]
42 Name of base raster map
43
44 cover=name [required]
45 Name of cover raster map
46
47 method=string [required]
48 Method of object-based statistic
49 Options: count, sum, min, max, range, average, avedev, variance,
50 stddev, skewness, kurtosis, variance2, stddev2, skewness2, kurto‐
51 sis2
52 count: Count of values in specified objects
53 sum: Sum of values in specified objects
54 min: Minimum of values in specified objects
55 max: Maximum of values in specified objects
56 range: Range of values (max - min) in specified objects
57 average: Average of values in specified objects
58 avedev: Average deviation of values in specified objects
59 variance: Variance of values in specified objects
60 stddev: Standard deviation of values in specified objects
61 skewness: Skewness of values in specified objects
62 kurtosis: Kurtosis of values in specified objects
63 variance2: (2-pass) Variance of values in specified objects
64 stddev2: (2-pass) Standard deviation of values in specified objects
65 skewness2: (2-pass) Skewness of values in specified objects
66 kurtosis2: (2-pass) Kurtosis of values in specified objects
67
68 output=name [required]
69 Resultant raster map
70
72 r.stats.zonal is a tool to analyse exploratory statistics of a float‐
73 ing-point "cover layer" according to how it intersects with objects in
74 a "base layer". A variety of standard statistical measures are possi‐
75 ble. This type of analysis is often called zonal statistics. The
76 zones are specified as the base raster map and the statistics are com‐
77 puted from cells in the cover raster map. Notably, the output of this
78 module is spatial: The resulting values are recorded as cell values in
79 the output raster map.
80
82 r.stats.zonal is intended to be a partial replacement for r.statistics,
83 with support for floating-point cover maps at the expense of not sup‐
84 porting quantiles. For this, see r.stats.quantile.
85
87 In this example, the raster polygon map zipcodes in the North Carolina
88 sample dataset is used to calculate zonal raster statistics using the
89 elevation raster map:
90 g.region raster=zipcodes -p
91 # pixel count in zipcode areas
92 r.stats.zonal base=zipcodes cover=elevation method=count output=zipcodes_elev_count
93 r.colors zipcodes_elev_count color=gyr -g
94 # average elevation in zipcode areas
95 r.stats.zonal base=zipcodes cover=elevation method=average output=zipcodes_elev_avg
96 r.colors zipcodes_elev_avg color=elevation -g
97
99 • r.stats.quantile for computing quantiles in zones (objects in
100 base raster map),
101
102 • r.quantile for computing quantiles of a whole raster map,
103
104 • r.statistics for categorical (integer) zonal statistics,
105
106 • r.univar for zonal statistics with textual (non-spatial) out‐
107 put,
108
109 • v.vect.stats for statistics of vector points in vector areas.
110
112 Glynn Clements
113
115 Available at: r.stats.zonal source code (history)
116
117 Accessed: Saturday Jan 21 21:15:12 2023
118
119 Main index | Raster index | Topics index | Keywords index | Graphical
120 index | Full index
121
122 © 2003-2023 GRASS Development Team, GRASS GIS 8.2.1 Reference Manual
123
124
125
126GRASS 8.2.1 r.stats.zonal(1)