r.recode - Recodes categorical raster maps.
r.recode [-ad] input=name output=name [rules=name] [title=string] [--overwrite] [--verbose] [--quiet]
- Align the current region to the input map
- Force output to double map type (DCELL)
- Allow output files to overwrite existing files
- Verbose module output
- Quiet module output
- Raster map to be recoded
- Name for output raster map
- File containing recode rules
- Title for the resulting raster map
r.recode creates an output map layer based on an input raster map
layer. The output map layer will be a recoding of the input map layer based
on recode rules input to r.recode. A title for the output
map layer may be (optionally) specified by the user.
The recode rules are read from standard input (i.e., from the keyboard,
redirected from a file, or piped through another program).
The program will be run non-interactively if the user specifies the name of
the raster map layer to be recoded, the name of an output layer to
hold recoded map, and (optionally) the name of a title for the output map.
Rules are defined in one of these formats:
old_low:old_high:new_val (i.e. new_high == new_low)
*:old_val:new_val (interval [inf, old_val])
old_val:*:new_val (interval [old_val, inf])
r.recode is loosely based on r.reclass and uses the GRASS reclass
library to convert the rasters. It has routines for converting to every
possible combination of raster (eg. int to double, double to float, etc).
Standard floating point raster precision is float, with -d double
precision will be written.
There are four basic routines that it accepts:
These four sets of arguments can be given on the command line, or piped via
stdin or a file. More than one set of arguments is accepted.
- old-low to old-high is reclassed to new-low to new high , where the
user provides all four values. The program figures on the fly what type of
raster should be created.
- old-low to old-high is reclassed to a single new value. Anything outside
the range is null.
- * to old-high will reclass everything less than old-high to a single
- old-low to * will reclass everything greater than old-low to a single
Map type conversion
To simply convert a raster between formats (eg. int to float) the user would
use the first argument. For example
would convert an old raster with range between 10 and 1500 to a float
raster with range bewteen 0.1 and 15.0.
r.recode can be used to replace existing cell values by others. The
formatting is as described above. In following example the values 1, 2 and
3 are replaced by 1.1, 7.5 resp. 0.4:
r.recode in=oldmap out=newmap << EOF
Last changed: $Date: 2003-05-06 08:35:18 -0700 (Tue, 06 May 2003) $
Main index - raster index - Full index
© 2003-2008 GRASS Development Team