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
40       -A
41           Print  averaged  values  instead  of intervals (floating-point maps
42           only)
43
44       -r
45           Print raw indexes of  floating-point  ranges  (floating-point  maps
46           only)
47
48       -n
49           Do not report no data value
50
51       -N
52           Do not report cells where all maps have no data
53
54       -C
55           Report for cats floating-point ranges (floating-point maps only)
56
57       -i
58           Read floating-point map as integer (use map’s quant rules)
59
60       --overwrite
61           Allow output files to overwrite existing files
62
63       --help
64           Print usage summary
65
66       --verbose
67           Verbose module output
68
69       --quiet
70           Quiet module output
71
72       --ui
73           Force launching GUI dialog
74
75   Parameters:
76       input=name[,name,...] [required]
77           Name of raster map(s) to report on
78
79       output=name
80           Name for output file (if omitted or "-" output to stdout)
81
82       separator=character
83           Field separator
84           Special characters: pipe, comma, space, tab, newline
85           Default: space
86
87       null_value=string
88           String representing NULL value
89           Default: *
90
91       nsteps=integer
92           Number of floating-point subranges to collect stats from
93           Default: 255
94
95       sort=string
96           Sort output statistics by cell counts
97           Default: sorted by categories or intervals
98           Options: asc, desc
99           asc: Sort by cell counts in ascending order
100           desc: Sort by cell counts in descending order
101

DESCRIPTION

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

NOTES

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

EXAMPLES

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

SEE ALSO

207          g.region,   r.report,    r.coin,    r.describe,    r.stats.quantile,
208       r.stats.zonal, r.statistics, r.univar
209

AUTHORS

211       Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
212       Sort option by Martin Landa, Czech Technical University in Prague, 2013
213
214       Last changed: $Date: 2014-12-12 00:12:46 +0100 (Fri, 12 Dec 2014) $
215

SOURCE CODE

217       Available at: r.stats source code (history)
218
219       Main  index  | Raster index | Topics index | Keywords index | Graphical
220       index | Full index
221
222       © 2003-2019 GRASS Development Team, GRASS GIS 7.6.0 Reference Manual
223
224
225
226GRASS 7.6.0                                                         r.stats(1)
Impressum