Skip to content

r.tpi

Calculates the multiscale topographic position index

r.tpi input=name minradius=integer maxradius=integer steps=integer output=name [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

r.tpi input=name minradius=1 maxradius=31 steps=5 output=name

grass.script.run_command("r.tpi", input, minradius=1, maxradius=31, steps=5, output, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("r.tpi", input="name", minradius=1, maxradius=31, steps=5, output="name")

Parameters

input=name [required]
    Elevation
    Input DEM from which to calculate mTPI
minradius=integer [required]
    Smoothing neighborhood radius size (minimum)
    Minimum neighborhood radius in cells for DEM smoothing
    Default: 1
maxradius=integer [required]
    Smoothing neighborhood radius size (maximum)
    Maximum neighborhood radius in cells for DEM smoothing
    Default: 31
steps=integer [required]
    Number of scaling steps
    Number of steps to use for DEM generalization between minradius and maxradius
    Default: 5
output=name [required]
    Multi-scale topographic position index
--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
    Elevation
    Input DEM from which to calculate mTPI
    Used as: input, raster, name
minradius : int, required
    Smoothing neighborhood radius size (minimum)
    Minimum neighborhood radius in cells for DEM smoothing
    Default: 1
maxradius : int, required
    Smoothing neighborhood radius size (maximum)
    Maximum neighborhood radius in cells for DEM smoothing
    Default: 31
steps : int, required
    Number of scaling steps
    Number of steps to use for DEM generalization between minradius and maxradius
    Default: 5
output : str, required
    Multi-scale topographic position index
    Used as: output, raster, name
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

r.tpicalculates a multiscale version of the Topographic Position Index (TPI) of Guisan et al. (1999). The TPI is calculated by averaging a DEM over a user-specified moving window size and subtracting the original DEM from the averaged version to get the residual. This has the effect of extracting finer-scale landforms from regional-scale relief. Positive TPI values represent ridges or hills, and negative TPI values represent valleys or pits.

Unlike the original TPI, r.tpi implements a multiscale version that calculates a standardized TPI over multiple neighborhood radii from minradius to maxradius, starting at the largest neighborhood size. For subsequent steps, the standardized TPI is updated with pixels where the absolute TPI values exceed the TPI values of the previous step. For large neighborhoods > 15, resampling is used rather than a focal function to generalize the DEM.

EXAMPLE

g.region raster=elevation@PERMANENT -a
r.tpi input=elevation@PERMANENT minradius=1 maxradius=25 steps=5 output=tpi

image-alt

REFERENCES

Guisan, A., S. B. Weiss, A. D. Weiss 1999. GLM versus CCA spatial modeling of plant species distribution. Plant Ecology 143: 107-122

SEE ALSO

r.mapcalc,

AUTHOR

Steven Pawley

SOURCE CODE

Available at: r.tpi source code (history)
Latest change: Thursday Feb 20 13:02:26 2025 in commit 53de819