1r.recode(1) Grass 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
56 (optionally) 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
60 entering 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
69 Library 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 CERL
112
113 Last changed: $Date: 2018-10-18 21:05:15 +0200 (Thu, 18 Oct 2018) $
114
116 Available at: r.recode source code (history)
117
118 Main index | Raster index | Topics index | Keywords index | Graphical
119 index | Full index
120
121 © 2003-2019 GRASS Development Team, GRASS GIS 7.6.0 Reference Manual
122
123
124
125GRASS 7.6.0 r.recode(1)