1r.recode(1) Grass User's Manual r.recode(1)
2
3
4
6 r.recode - Recodes categorical raster maps.
7
9 raster
10
12 r.recode
13 r.recode help
14 r.recode [-ad] input=name output=name [rules=name] [title=string]
15 [--overwrite] [--verbose] [--quiet]
16
17 Flags:
18 -a
19 Align the current region to the input map
20
21 -d
22 Force output to double map type (DCELL)
23
24 --overwrite
25 Allow output files to overwrite existing files
26
27 --verbose
28 Verbose module output
29
30 --quiet
31 Quiet module output
32
33 Parameters:
34 input=name
35 Raster map to be recoded
36
37 output=name
38 Name for output raster map
39
40 rules=name
41 File containing recode rules
42
43 title=string
44 Title for the resulting raster map
45
47 r.recode creates an output map layer based on an input raster map
48 layer. The output map layer will be a recoding of the input map layer
49 based on recode rules input to r.recode. A title for the output map
50 layer may be (optionally) specified by the user.
51
52 The recode rules are read from standard input (i.e., from the key‐
53 board, redirected from a file, or piped through another program).
54
55 The program will be run non-interactively if the user specifies the
56 name of the raster map layer to be recoded, the name of an output layer
57 to hold recoded map, and (optionally) the name of a title for the out‐
58 put map. Rules are defined in one of these formats:
59 old_low:old_high:new_low:new_high
60 old_low:old_high:new_val (i.e. new_high == new_low)
61 *:old_val:new_val (interval [inf, old_val])
62 old_val:*:new_val (interval [old_val, inf])
63 r.recode is loosely based on r.reclass and uses the GRASS reclass
64 library to convert the rasters. It has routines for converting to every
65 possible combination of raster (eg. int to double, double to float,
66 etc). Standard floating point raster precision is float, with -d dou‐
67 ble precision will be written.
68 There are four basic routines that it accepts:
69
70 1 old-low to old-high is reclassed to new-low to new high , where
71 the user provides all four values. The program figures on the
72 fly what type of raster should be created.
73
74 2 old-low to old-high is reclassed to a single new value. Anything
75 outside the range is null.
76
77 3
78 * to old-high will reclass everything less than old-high to a
79 single new value.
80
81 4
82 old-low to * will reclass everything greater than old-low to a
83 single new value.
84
85 These four sets of arguments can be given on the command line, or piped
86 via stdin or a file. More than one set of arguments is accepted.
87
89 Map type conversion
90 To simply convert a raster between formats (eg. int to float) the user
91 would use the first argument. For example
92 10:1500:0.1:15.0
93 would convert an old raster with range between 10 and 1500 to a float
94 raster with range bewteen 0.1 and 15.0.
95
96 Value replacement
97 r.recode can be used to replace existing cell values by others. The
98 formatting is as described above. In following example the values 1, 2
99 and 3 are replaced by 1.1, 7.5 resp. 0.4:
100
101 r.recode in=oldmap out=newmap << EOF
102 1:1:1.1:1.1
103 2:2:7.5:7.5
104 3:3:0.4:0.4
105 EOF
106
107
109 CERL
110
111 Last changed: $Date: 2003-05-06 17:35:18 +0200 (Tue, 06 May 2003) $
112
113 Full index
114
115 © 2003-2008 GRASS Development Team
116
117
118
119GRASS 6.3.0 r.recode(1)