r.recode(1)
π r.recode(1) β GRASS GIS User's Manual π
okay bestie, sit DOWN, because r.recode is about to change your whole raster life. it recodes categorical raster maps. that's it, that's the vibe, and it's iconic for it. β¨
π NAME π
r.recode β recodes categorical raster maps. yes queen, category glow-up incoming. π
π KEYWORDS π
raster, recode categories, reclassification
π SYNOPSIS π
r.recode
r.recode --help
r.recode [-ad] input=name output=name rules=name [title=string]
[--overwrite] [--help] [--verbose] [--quiet] [--ui]
π© Flags
-aβ Align the current region to the input raster map. periodt, no more misaligned drama. β¨-dβ Force output to 'double' raster map type (DCELL). highkey extra precision energy. π₯--overwriteβ Allow output files to overwrite existing files. (yes, we're deleting your old stuff, don't act surprised π)--helpβ Print usage summary. your lil cheat sheet bestie π«Ά--verboseβ Verbose module output. it will literally tell you everything.--quietβ Quiet module output. shhh, main character silence π€«--uiβ Force launching GUI dialog. for the visual learners π
π Parameters
input=name[required] β Name of raster map to be recoded. the before picture.output=name[required] β Name for output raster map. the after picture. slay.rules=name[required] β File containing recode rules. use'-'for standard input. iykyk π«title=stringβ Title for output raster map. optional but cute. name your baby. πΌ
β¨ DESCRIPTION β¨
r.recode creates an output raster map by recoding input raster map based on recode rules. a title for the output raster map may be (optionally) specified by the user. no cap.
the recode rules can be read from standard input β that means from the keyboard, redirected from a file, or piped through another program β by entering rules=-. the way that the - just eats stdin is so iconic honestly. π¦
rules are defined in one of these formats:
old_low:old_high:new_low:new_high
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. CELL to DCELL, DCELL to FCELL, etc). standard floating point raster precision is float (FCELL), with -d double precision (DCELL) will be written. she contains multitudes. π
there are four basic routines that it accepts:
- 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. lowkey psychic of it.
- old-low to old-high is reclassed to a single new value. anything outside the range is null. bye bestie π
*to old-high will reclass everything less than old-high to a single new value.- old-low to
*will reclass everything greater than old-low to a single new value.
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. the way she just keeps accepting more?? flexible queen. πΈ
π EXAMPLES π
π§ Map type conversion
to simply convert a raster between formats (eg. int to float) the user would use the first argument. for example
10:1500:0.1:15.0
would convert an input raster map with range between 10 and 1500 to a float raster raster with range between 0.1 and 15.0. glow-up complete, no notes. π β¨
π Value replacement
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 input=oldmap output=newmap rules=- << EOF
1:1:1.1:1.1
2:2:7.5:7.5
3:3:0.4:0.4
EOF
not the heredoc doing the absolute most π she ate fr fr.
π SEE ALSO π
r.reclass
π AUTHOR π
CERL
πΎ SOURCE CODE πΎ
available at: r.recode source code (history)
accessed: Saturday Jan 17 05:40:56 2026
main index | raster index | topics index | keywords index | graphical index | full index
okay that's the whole page bestie, every flag, every rule format, every routine, nothing skipped, we don't do half-finished energy here. π«Ά
Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual
and that's a wrap on the GRASS 8.4.2 era of r.recode(1) β go forth and recode, you absolute legend. ππΈβ¨ππ¦
π¦ where this page comes from
- fedora 44: grass 8.4.2-4.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms