r.rescale
Rescales the range of category values in a raster map layer.
r.rescale input=name [from=min,max] output=name to=min,max [title=phrase] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]
Example:
r.rescale input=name output=name to=min,max
grass.script.run_command("r.rescale", input, from=None, output, to, title=None, overwrite=False, verbose=False, quiet=False, superquiet=False)
Example:
gs.run_command("r.rescale", input="name", output="name", to=min,max)
Parameters
input=name [required]
The name of the raster map to be rescaled
from=min,max
The input data range to be rescaled (default: full range of input map)
output=name [required]
The resulting raster map name
to=min,max [required]
The output data range
title=phrase
Title for new raster map
--overwrite
Allow output files to overwrite existing files
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--qq
Very quiet module output
--ui
Force launching GUI dialog
input : str, required
The name of the raster map to be rescaled
Used as: input, raster, name
from : tuple[int, int] | list[int] | str, optional
The input data range to be rescaled (default: full range of input map)
Used as: min,max
output : str, required
The resulting raster map name
Used as: output, raster, name
to : tuple[int, int] | list[int] | str, required
The output data range
Used as: min,max
title : str, optional
Title for new raster map
Used as: phrase
overwrite: bool, optional
Allow output files to overwrite existing files
Default: False
verbose: bool, optional
Verbose module output
Default: False
quiet: bool, optional
Quiet module output
Default: False
superquiet: bool, optional
Very quiet module output
Default: False
DESCRIPTION
The r.rescale program rescales the range of category values appearing in a raster map layer. A new raster map layer, and an appropriate category file and color table based upon the original raster map layer, are generated with category labels that reflect the original category values that produced each category. This command is useful for producing representations with a reduced number of categories from a raster map layer with a large range of category values (e.g., elevation). Rescaled map layers are appropriate for use in such GRASS GIS commands as r.stats, r.report, and r.coin.
EXAMPLE
To rescale an elevation raster map layer with category values ranging from 1090 meters to 1800 meters into the range 0-255, the following command line could be used (without the from parameter, the full value range will be used):
r.rescale input=elevation from=1090,1800 output=elevation.255 to=0,255
NOTES
Category values that fall beyond the input range will become NULL. This allows the user to select a subset of the full category value range for rescaling if desired. This also means that the user should know the category value range for the input raster map layer. The user can request the r.rescale program to determine this range, or can obtain it using the r.describe or r.info command. If the category value range is determined using r.rescale, the input raster map layer is examined, and the minimum and maximum non-NULL category values are selected as the input range.
SEE ALSO
r.coin, r.describe, r.info, r.mapcalc, r.reclass, r.rescale.eq, r.report, r.resample, r.stats, r.univar
AUTHOR
Michael Shapiro, U.S.Army Construction Engineering Research Laboratory
SOURCE CODE
Available at: r.rescale source code
(history)
Latest change: Friday Feb 07 19:16:09 2025 in commit a82a39f