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
98 Figure: ZIP code map on the left shows ZIP code areas, elevation map
99 the respective values per pixel, zonal statistics map on the right
100 shows the average elevation per zone (all maps: spatial subset).
101
103 • r.stats.quantile for computing quantiles in zones (objects in
104 base raster map),
105
106 • r.quantile for computing quantiles of a whole raster map,
107
108 • r.statistics for categorical (integer) zonal statistics,
109
110 • r.univar for zonal statistics with textual (non-spatial) out‐
111 put,
112
113 • v.vect.stats for statistics of vector points in vector areas.
114
116 Glynn Clements
117
119 Available at: r.stats.zonal source code (history)
120
121 Accessed: Saturday Oct 28 18:17:58 2023
122
123 Main index | Raster index | Topics index | Keywords index | Graphical
124 index | Full index
125
126 © 2003-2023 GRASS Development Team, GRASS GIS 8.3.1 Reference Manual
127
128
129
130GRASS 8.3.1 r.stats.zonal(1)