1r.recode(1) GRASS GIS User's Manual r.recode(1)
2
3
4
6 r.recode - Recodes categorical raster maps.
7
9 raster, recode categories, reclassification
10
12 r.recode
13 r.recode --help
14 r.recode [-ad] input=name output=name rules=name [title=string]
15 [--overwrite] [--help] [--verbose] [--quiet] [--ui]
16
17 Flags:
18 -a
19 Align the current region to the input raster map
20
21 -d
22 Force output to ’double’ raster map type (DCELL)
23
24 --overwrite
25 Allow output files to overwrite existing files
26
27 --help
28 Print usage summary
29
30 --verbose
31 Verbose module output
32
33 --quiet
34 Quiet module output
35
36 --ui
37 Force launching GUI dialog
38
39 Parameters:
40 input=name [required]
41 Name of raster map to be recoded
42
43 output=name [required]
44 Name for output raster map
45
46 rules=name [required]
47 File containing recode rules
48 ’-’ for standard input
49
50 title=string
51 Title for output raster map
52
54 r.recode creates an output raster map by recoding input raster map
55 based on recode rules. A title for the output raster map may be (op‐
56 tionally) specified by the user.
57
58 The recode rules can be read from standard input (i.e., from the key‐
59 board, redirected from a file, or piped through another program) by en‐
60 tering rules=-.
61
62 Rules are defined in one of these formats:
63 old_low:old_high:new_low:new_high
64 old_low:old_high:new_val (i.e. new_high == new_low)
65 *:old_val:new_val (interval [inf, old_val])
66 old_val:*:new_val (interval [old_val, inf])
67
68 r.recode is loosely based on r.reclass and uses the GRASS Reclass Li‐
69 brary to convert the rasters. It has routines for converting to every
70 possible combination of raster (eg. CELL to DCELL, DCELL to FCELL,
71 etc). Standard floating point raster precision is float (FCELL), with
72 -d double precision (DCELL) will be written.
73
74 There are four basic routines that it accepts:
75
76 1 old-low to old-high is reclassed to new-low to new high , where
77 the user provides all four values. The program figures on the
78 fly what type of raster should be created.
79
80 2 old-low to old-high is reclassed to a single new value. Anything
81 outside the range is null.
82
83 3 * to old-high will reclass everything less than old-high to a
84 single new value.
85
86 4 old-low to * will reclass everything greater than old-low to a
87 single new value.
88
89 These four sets of arguments can be given on the command line, or piped
90 via stdin or a file. More than one set of arguments is accepted.
91
93 Map type conversion
94 To simply convert a raster between formats (eg. int to float) the user
95 would use the first argument. For example
96 10:1500:0.1:15.0
97 would convert an input raster map with range between 10 and 1500 to a
98 float raster raster with range between 0.1 and 15.0.
99
100 Value replacement
101 r.recode can be used to replace existing cell values by others. The
102 formatting is as described above. In following example the values 1, 2
103 and 3 are replaced by 1.1, 7.5 resp. 0.4:
104 r.recode input=oldmap output=newmap rules=- << EOF
105 1:1:1.1:1.1
106 2:2:7.5:7.5
107 3:3:0.4:0.4
108 EOF
109
111 r.reclass
112
114 CERL
115
117 Available at: r.recode source code (history)
118
119 Accessed: Saturday Oct 28 18:17:52 2023
120
121 Main index | Raster index | Topics index | Keywords index | Graphical
122 index | Full index
123
124 © 2003-2023 GRASS Development Team, GRASS GIS 8.3.1 Reference Manual
125
126
127
128GRASS 8.3.1 r.recode(1)