Skip to contents

For a given focal grid cell, the terrain ruggedness index (TRI) is calculated by taking the square root of the average of the squared difference between the focal cell's elevation and the elevations of the 8 surrounding cells, or $$\sqrt(\sum_{i = 1}^{8}(m_i - m_0)^2 / 8)$$ where \(m_0\) is the elevation of the focal cell and \(m_i\) is the elevation of the ith grid cell.

Usage

# S4 method for class 'GRaster'
ruggedness(x)

Arguments

x

A GRaster.

Value

A GRaster.

References

Riley, S.J., DeGloria, S.D., and Elliot, R. 1999. A terrain ruggedness index that quantifies topographic heterogeneity. Intermountain Journal of Sciences 5:23-27.

Examples

if (grassStarted()) {

# Setup
library(terra)

# Elevation raster
madElev <- fastData("madElev")

# Convert to GRaster:
elev <- fast(madElev)

# Terrain ruggedness index:
tri <- ruggedness(elev)
plot(c(elev, tri))

# Topographic wetness index:
twi <- wetness(elev)
plot(c(elev, twi))

}