1r.clump(1) GRASS GIS User's Manual r.clump(1)
2
3
4
6 r.clump - Recategorizes data in a raster map by grouping cells that
7 form physically discrete areas into unique categories.
8
10 raster, statistics, reclass, clumps
11
13 r.clump
14 r.clump --help
15 r.clump [-dg] input=name[,name,...] [output=name] [title=string]
16 [threshold=float] [minsize=integer] [--overwrite] [--help]
17 [--verbose] [--quiet] [--ui]
18
19 Flags:
20 -d
21 Clump also diagonal cells
22 Clumps are also traced along diagonal neighboring cells
23
24 -g
25 Print only the number of clumps in shell script style
26
27 --overwrite
28 Allow output files to overwrite existing files
29
30 --help
31 Print usage summary
32
33 --verbose
34 Verbose module output
35
36 --quiet
37 Quiet module output
38
39 --ui
40 Force launching GUI dialog
41
42 Parameters:
43 input=name[,name,...]Â [required]
44 Name of input raster map(s)
45
46 output=name
47 Name for output raster map
48
49 title=string
50 Title for output raster map
51
52 threshold=float
53 Threshold to identify similar cells
54 Valid range: 0 = identical to < 1 = maximal difference
55 Default: 0
56
57 minsize=integer
58 Minimum clump size in cells
59 Clumps smaller than minsize will be merged to form larger clumps
60 Default: 1
61
63 r.clump finds all areas of contiguous cell category values (connected
64 components) in the input raster map. NULL values in the input are ig‐
65 nored. It assigns a unique category value to each such area ("clump")
66 in the resulting output raster map.
67
68 Category distinctions in the input raster map are preserved. This
69 means that if distinct category values are adjacent, they will NOT be
70 clumped together. The user can run r.reclass prior to r.clump to recat‐
71 egorize cells and reassign cell category values.
72
73 r.clump can also perform "fuzzy" clumping where neighboring cells that
74 are not identical but similar to each other are clumped together. Here,
75 the spectral distance between two cells is scaled to the range [0, 1]
76 and compared to the threshold value. Cells are clumped together if
77 their spectral distance is ⤠threshold. The result is very sensitive
78 to this threshold value, a recommended start value is 0.01, then in‐
79 creasing or decreasing this value according to the desired output.
80 Once a suitable threshold has been determined, noise can be reduced by
81 merging small clumps with the minsize option.
82
83 r.clump can also use multiple raster maps of any kind (CELL, FCELL,
84 DCELL) as input. In this case, the spectral distance between cells is
85 used to determine the similarity of two cells. This means that input
86 maps must be metric: the difference cell 1 - cell 2 must make sense.
87 Categorical maps, e.g. land cover, can not be used in this case. Exam‐
88 ples for valid input maps are satellite imagery, vegetation indices,
89 elevation, climatic parameters etc.
90
92 By default, the resulting clumps are connected only by their four di‐
93 rect neighbors (left, right, top, bottom). The -d flag activates also
94 diagonal clump tracing.
95
96 r.clump works properly with raster map that contains only "fat" areas
97 (more than a single cell in width). Linear elements (lines that are a
98 single cell wide) may or may not be clumped together depending on the
99 direction of the line - horizontal and vertical lines of cells are con‐
100 sidered to be contiguous, but diagonal lines of cells are not consid‐
101 ered to be contiguous and are broken up into separate clumps unless the
102 -d flag is used.
103
104 A random color table and other support files are generated for the out‐
105 put raster map.
106
108 Clumping of a raster map
109 Perform clumping on "lakes" map (North Carolina sample dataset) and re‐
110 port area sizes for each lake individually rather by waterbody type:
111 g.region raster=lakes -p
112 # report sizes by waterbody type
113 r.report lakes units=h
114 # clump per raster polygon
115 r.clump lakes out=lakes_individual
116 # report sizes by individual waterbody
117 r.report lakes_individual units=h
118 Figure: Clumping of rasterized lakes: original lakes map (left) and
119 clumped lakes map (right)
120
121 Fuzzy clumping on Landsat bands
122 Perform fuzzy clumping on Landsat 7 2002 imagery (North Carolina sample
123 dataset)
124 g.region raster=lsat7_2002_10 -p
125 r.clump in=lsat7_2002_10,lsat7_2002_20,lsat7_2002_30,lsat7_2002_40,lsat7_2002_50,lsat7_2002_70 \
126 out=lsat7_2002_clump threshold=0.045
127 # reduce noise
128 r.clump in=lsat7_2002_10,lsat7_2002_20,lsat7_2002_30,lsat7_2002_40,lsat7_2002_50,lsat7_2002_70 \
129 out=lsat7_2002_clump_min10 threshold=0.045 minsize=10
130 Figure: Fuzzy clumping on Landsat bands: original RGB composite (left),
131 fuzzy clumped map (middle), and fuzzy clumped with minsize map (right)
132
134 r.average, r.buffer, r.distance, r.grow, r.mapcalc, r.mfilter,
135 r.neighbors, r.to.vect, r.reclass, r.statistics, r.support
136
138 Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
139 Markus Metz (diagonal clump tracing, fuzzy clumping)
140
142 Available at: r.clump source code (history)
143
144 Accessed: Saturday Jan 21 21:14:29 2023
145
146 Main index | Raster index | Topics index | Keywords index | Graphical
147 index | Full index
148
149 © 2003-2023 GRASS Development Team, GRASS GIS 8.2.1 Reference Manual
150
151
152
153GRASS 8.2.1 r.clump(1)