Is there any option to SAGA to calculate the Topographic Wetness Index ? I have a big area and I tried many times with SAGA, the last time I thought the results was ok (before SAGA would crash or give me a empty raster), however I just noticed that for a small part of my study area the TWI raster is empty.

For the last TWI created in SAGA I decided to calculate the slope also in SAGA, but I still have problems with the file. The area with empty cells is near the right margin of the raster.This is how it looks like (black cells are NODATA cells): enter image description here

I need to recalculate this asap but I can't find any another solution (in arcgis or qgis).


I've just saw that I have the same problem in other small areas of the image, that are +/- flat. After overlaying with the SRTM, I can see that when the SRTM value is negative that the TWI cells have NODATA values. I guess this is the reason for the error.

  • there is also a grass-tool named r.topidx. Maybe you can try it out too. I had the same problem as you in the past (see my post in the related posts list), but i somehow managed to do it with SAGA
    – Curlew
    Commented Apr 28, 2013 at 18:45
  • 1
    For the topographic wetness index in GRASS GIS, see grasswiki.osgeo.org/wiki/Hydrological_Sciences#Flow_calculation -> r.topidx. You can reach it from QGIS through the Sextante plugin (see also grasswiki.osgeo.org/wiki/GRASS_and_Sextante). BTW: GRASS can deal with large files in case you hit the 2Gb barrier on a 32bit system.
    – markusN
    Commented Apr 28, 2013 at 18:54
  • 1
    An ArcGIS solution to exactly the same problem is presented at gis.stackexchange.com/questions/43276/….
    – whuber
    Commented Apr 29, 2013 at 14:46
  • 1
    @whuber, the PO asks for a SAGA solution, not ArcGIS.
    – Fezter
    Commented May 23, 2013 at 3:20
  • 1
    @Fezter Understood--for otherwise I would have closed this question as a duplicate and not just put the link in a comment. It was offered in the expectation that seeing one way to compute the TWI could be helpful regardless of the software one finally intends to use.
    – whuber
    Commented May 23, 2013 at 12:34

2 Answers 2


You should not be getting null or empty values. How exactly did you try to calculate TWI? In SAGA, module Terrain Analysis - Hydrology -> SAGA Wetness Index should work, so long as all of your input files are correct. i.e slope needs to be in radians, what about sinks?, drainage networks need to be correct, DEM needs to be projected (good discussion on projections here), etc...

The general equation:

TWI/CTI = ln(a / (tan (beta))

where; a=Upland contributing area: [(flow accumulation + 1 ) * (cellsize)]

beta=slope in radians.


  • Moore, ID., P.E. Gessler, G.A. Nielsen, and G.A. Petersen (1993) Terrain attributes: estimation methods and scale effects. In Modeling Change in Environmental Systems, edited by A.J. Jakeman M.B. Beck and M. McAleer Wiley , London, pp. 189 - 214.

  • Gessler, P.E., I.D. Moore, N.J. McKenzie, and P.J. Ryan. (1995). Soil-landscape modeling and spatial prediction of soil attributes. International Journal of GIS. 9(4):421-432.


When tan(beta) is zero or if the fraction is negative, you will get NODATA pixels as this gives no solution for the index. Replace the missing values with neighboring values using the Nibble tool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.