Select to view content in your preferred language

Terrain Ruggedness Index Phyton code

5071
4
09-30-2015 03:13 AM
LlorençCastell_Fabregues
Deactivated User

Hello!

Does anyone know how to get the code to calculate the terrain ruggednes index (TRI, Riley 1999) using python in arcgis 10.1. I have no knowledege about python code...

thanks for the help!

0 Kudos
4 Replies
DanPatterson_Retired
MVP Emeritus

What did you rule out in a web search?  There are numerous possibilities using

terrain ruggedness python

as a search phrase.  For example

http://gis4geomorphology.com/roughness-topographic-position/

so please indicate your research, those links, what you tried and what you found deficient or that you are in need of help with

LlorençCastell_Fabregues
Deactivated User

Thanks for the answer, I knew this website, but this is only an apporximation, I would like to know the entire python code for the TRI, to do some tests amd modifications in the code.

thanks

0 Kudos
DanPatterson_Retired
MVP Emeritus

What code do you have? there are other links as well.

You could re-implement Jeff Jenness's tool for ArcView 3.x at

http://arcscripts.esri.com/details.asp?dbid=14156

changing from Avenue to ArcPy and Python would work.

I don't know what you mean by an approximation... the references and interpretations of TPI are well documented on the website and reference published literature.

Or are you want a pure python implementation?  If so, you should indicate:

  • what moving window algorithm you are using
  • what algorithms you are using for the various steps

This will simplify suggestions and clarify what deficiencies are not covered by the existing interpretations.

NeilAyres
MVP Alum

And the link posted by ObiDan is pretty well explained in terms of what to do in the raster toolbox / raster calculator.

Before getting into the details of coding this in python, why not do it by hand a few times and experiment there.

There is a lot of help here and at python.org and many others on python coding.