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