ArcGIS Pro – How to Calculate Terrain Roughness Index in ArcGIS Pro?

arcgis-proarcpy

I am trying to calculate Terrain Roughness Index (TRI) as written up in Riley et al 1999, and have used the python code located here. However, this approach converts a raster to a numpy array and then iterates over the rows.

This can be relatively slow, so is there a way to use ArcGIS Pro to write a custom focal statistics script to calculate a TRI value for each cell over a moving window?

Best Answer

Honestly, I would just calculate a focal variance. Variance within a 3x3 window is very close to TRI [sqrt(sum(dev^2)]. The variance would also be more scalable than TRI which is limited to a square 3x3 window. You could use the raster calculator to calculate an algebraic approximation of the index.

ArcGIS (type) syntax:

s = FocalStatistics(dem, NbrRectangle(3, 3, MAP), "SUM", "")
d = (dem * dem)
t = FocalStatistics(d, NbrRectangle(3, 3, MAP), "SUM", "")
tri = sqrt( t + 9 * d - 2 * dem * s )

There are several geomorphometric indices available in the ArcGIS Geomorphometry & Gradient Metrics toolbox that would provide alternatives to TRI. There is an actual implementation of TRI, that provides optional corrections and standardization of the index, in the R spatialEco package available on CRAN or GitHub.

Related Question