1r.stats(1)                    Grass User's Manual                   r.stats(1)
2
3
4

NAME

6       r.stats  - Generates area statistics for raster map.
7

KEYWORDS

9       raster, statistics
10

SYNOPSIS

12       r.stats
13       r.stats --help
14       r.stats  [-acpl1gxArnNCi] input=name[,name,...]  [output=name]   [sepa‐
15       rator=character]          [null_value=string]          [nsteps=integer]
16       [sort=string]   [--overwrite]  [--help]  [--verbose]  [--quiet]  [--ui]
17
18   Flags:
19       -a
20           Print area totals in square meters
21
22       -c
23           Print cell counts (sortable)
24
25       -p
26           Print approximate (total percent may not be 100%) percents
27
28       -l
29           Print category labels
30
31       -1
32           One cell (range) per line
33
34       -g
35           Print grid coordinates (east and north)
36
37       -x
38           Print x and y (column and row)
39           Indexing starts with 1: first column and row are 1
40
41       -A
42           Print  averaged  values  instead  of intervals (floating-point maps
43           only)
44
45       -r
46           Print raw indexes of  floating-point  ranges  (floating-point  maps
47           only)
48
49       -n
50           Do not report no data value
51
52       -N
53           Do not report cells where all maps have no data
54
55       -C
56           Report for cats floating-point ranges (floating-point maps only)
57
58       -i
59           Read floating-point map as integer (use map’s quant rules)
60
61       --overwrite
62           Allow output files to overwrite existing files
63
64       --help
65           Print usage summary
66
67       --verbose
68           Verbose module output
69
70       --quiet
71           Quiet module output
72
73       --ui
74           Force launching GUI dialog
75
76   Parameters:
77       input=name[,name,...] [required]
78           Name of raster map(s) to report on
79
80       output=name
81           Name for output file (if omitted or "-" output to stdout)
82
83       separator=character
84           Field separator
85           Special characters: pipe, comma, space, tab, newline
86           Default: space
87
88       null_value=string
89           String representing NULL value
90           Default: *
91
92       nsteps=integer
93           Number of floating-point subranges to collect stats from
94           Default: 255
95
96       sort=string
97           Sort output statistics by cell counts
98           Default: sorted by categories or intervals
99           Options: asc, desc
100           asc: Sort by cell counts in ascending order
101           desc: Sort by cell counts in descending order
102

DESCRIPTION

104       r.stats calculates the area present in each of the categories or float‐
105       ing-point intervals of user-selected input raster map. Area  statistics
106       are  given  in units of square meters and/or cell counts. This analysis
107       uses  the  current  geographic  region  (g.region)  and  mask  settings
108       (r.mask). The output statistics can be saved to a output file.
109
110       Area  statistics  is printed in square meters for each category when -a
111       is given. Similarly if -c flag is chosen, areas will be stated also  in
112       number of cells.
113

NOTES

115       If  a  single  raster  map  is  specified, a list of categories will be
116       printed.  The -x flag will print x and y (column and row) starting with
117       1  (both  first  row  and first column are indexed with 1). If multiple
118       raster maps are specified, a cross-tabulation table for  each  combina‐
119       tion of categories in the raster maps will be printed.
120
121       For  example,  if  one  raster map was specified, the output would look
122       like:
123       1 1350000.00
124       2 4940000.00
125       3 8870000.00
126       If three raster maps were specified, the output would look like:
127       0 0 0 8027500.00
128       0 1 0 1152500.00
129       1 0 0 164227500.00
130       1 0 1 2177500.00
131       1 1 0 140092500.00
132       1 1 1 3355000.00
133       2 0 0 31277500.00
134       2 0 1 2490000.00
135       2 1 0 24207500.00
136       2 1 1 1752500.00
137       3 0 0 17140000.00
138       3 1 0 11270000.00
139       3 1 1 2500.00
140       Within each grouping, the first field represents the category value  of
141       first  raster map, the second represents the category values associated
142       with second raster map, the third represents category values for  third
143       raster  map, and the last field gives the area in square meters for the
144       particular combination of these  three  raster  maps’  categories.  For
145       example,  above,  combination  3,1,1 covered 2500 square meters. Fields
146       are separated by the separator option.   The  output  from  r.stats  is
147       sorted  by  category  or  category intervals (for floating-point raster
148       maps).
149
150       Note that the user has only the option of printing out cell  statistics
151       in  terms  of cell counts and/or area totals. Users wishing to use dif‐
152       ferent units than are available here should use r.report.
153

EXAMPLES

155   Report area for each category
156       Report area for each category in the single raster map:
157       g.region raster=geology_30m
158       r.stats -a in=geology_30m nv=no-data sep=tab
159       217     71960000.000000
160       262     19760000.000000
161       270     67760000.000000
162       405     25120000.000000
163       583     2520000.000000
164       720     480000.000000
165       766     840000.000000
166       862     6560000.000000
167       910     4360000.000000
168       921     1200000.000000
169       946     360000.000000
170       948     80000.000000
171       no-data 33375200000.000004
172
173   Report sorted number of cells for each category
174       Report sorted number of cells for each category in  the  single  raster
175       map (suppress NULL data):
176       g.region raster=geology_30m
177       r.stats -cn input=geology_30m sort=desc
178       217 1799
179       270 1694
180       405 628
181       262 494
182       862 164
183       910 109
184       583 63
185       921 30
186       766 21
187       720 12
188       946 9
189       948 2
190
191   Report area, number of cells, and percents in multiple raster maps
192       Report area, number of cells, and percents (separated by tabs) for each
193       category in multiple raster maps (suppress NULL data):
194       g.region raster=towns
195       r.stats -nacp input=towns,urban separator=tab
196       1       55      23840000.000000 596     11.89%
197       2       55      13680000.000000 342     6.82%
198       3       55      1360000.000000  34      0.68%
199       4       55      16040000.000000 401     8.00%
200       5       55      98240000.000000 2456    48.98%
201       6       55      19760000.000000 494     9.85%
202
203   Report sorted area intervals of floating-point raster map
204       Report sorted area for each interval  of  floating-point  input  raster
205       map. Number of intervals are given by nsteps option.
206       g.region raster=elevation
207       r.stats -an input=elevation nsteps=10 sort=desc separator=tab
208       95.879221-105.954329    36440000.000000
209       85.804114-95.879221     30800000.000000
210       105.954329-116.029436   30080000.000000
211       116.029436-126.104543   27960000.000000
212       126.104543-136.17965    26440000.000000
213       136.17965-146.254757    20880000.000000
214       75.729007-85.804114     15880000.000000
215       65.6539-75.729007       6040000.000000
216       146.254757-156.329865   5720000.000000
217       55.578793-65.6539       760000.000000
218
219   Report raster cell counts in multiple raster maps
220       Report  raster  cell counts of landuse and geological categories within
221       zipcode areas:
222       g.region raster=zipcodes
223       # landuse/landcover and zipcodes
224       r.stats -c input=landclass96,zipcodes separator=comma
225       # landuse/landcover, geology and zipcodes with category labels
226       r.stats -c input=landclass96,zipcodes,geology_30m separator=comma -l
227

SEE ALSO

229          g.region,   r.report,    r.coin,    r.describe,    r.stats.quantile,
230       r.stats.zonal, r.statistics, r.univar
231

AUTHORS

233       Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
234       Sort option by Martin Landa, Czech Technical University in Prague, 2013
235

SOURCE CODE

237       Available at: r.stats source code (history)
238
239       Main  index  | Raster index | Topics index | Keywords index | Graphical
240       index | Full index
241
242       © 2003-2019 GRASS Development Team, GRASS GIS 7.8.2 Reference Manual
243
244
245
246GRASS 7.8.2                                                         r.stats(1)
Impressum