Select to view content in your preferred language

Miscalculated topographic wetness index

7568
6
10-26-2012 09:41 AM
toddsams
Deactivated User
I am trying to use a flow accumulation (fac) raster and a slope (slope) raster to calculate the topographic wetness index (TWI) in raster calculator as:

Ln("fac"/Tan("slope"))

The resulting output values do not make sense relative to hand calculations. For example:

If...
   fac = 6 cells, slope = 26.379343 degrees

   TWI = 0.701 (ArcGIS raster calculator)
   TWI  = 2.493 (by hand)


Also, many of the output pixels are "no data".

Does anyone know what might be causing this discrepancy?
0 Kudos
6 Replies
MarkBoucher
Honored Contributor
See if slope is in percent instead of degrees.
0 Kudos
toddsams
Deactivated User
I checked and slope is in degrees.

Though, even if it were in percent it just seems that the calculation is wrong regardless of what the numbers actually represent.
0 Kudos
toddsams
Deactivated User
So I tried to isolate the problem by simplifying the calculation as

Tan("slope")

The results appear to be very far off. For example:

slope = 32.998260
Tan("slope") = -86.669029 (by ArcGIS raster calculator)
Tan("slope") = 0.64915 (by hand calculator)
Tan("slope") = 0.64915 (by http://www.rapidtables.com/calc/math/Tan_Calculator.htm)

It appears that the Tan function in ArcGIS raster calculator is not working properly.
0 Kudos
MarkBoucher
Honored Contributor
I set my HP calculator to work in Radians and I got Tan(32.998260) = -86.669029. So, I think you need to do a conversion of your degrees to radians and then to the Tan() function.

This is confirmed by the help on Tan(): http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?id=6412&pid=6399&topicname=Tan&.

It looks like "DEG" is a constant that equals 180/pi and so you might be able to use this equation:

Ln("fac" / Tan("slope" / DEG))

Also note that the Raster Calculator is finicky with spaces around operands.  If you use the "calculator pad" in the Raster Calculator to build your equations, it makes sure all the spaces are where they should be.
0 Kudos
toddsams
Deactivated User
Excellent! Thanks for the help!!

DEG wasn't recognized but I replaced with 180/3.141592 and it works just fine. Thanks again.
0 Kudos
JeffreyEvans
Frequent Contributor
A quick forum search on "CTI" would have yielded these threads that would have answered your question. Note that in last thread there is a link to a toolbox that has the CTI model available. 

http://forums.arcgis.com/threads/32896-from-DEM-to-CTI?highlight=CTI

http://forums.arcgis.com/threads/33824-Areas-of-No-Data-in-the-Topgraphic-Index?highlight=CTI

http://forums.arcgis.com/threads/44868-Compound-Topographic-Index-Catchment-Wetness-Index-from-DTM-d...
0 Kudos