Select to view content in your preferred language

How to deal with 'No Data' Values in Topographic Wetness Index

7019
10
03-16-2016 02:16 AM
NasirHameed
Occasional Contributor

I have derived Topographic Wetness Index (TWI)/CTI with ArcGIS 10.3 using 30m DEM resolution. Earlier, it was propagating negative values which were mainly confined to ridges. I have restructured the 'Raster Calculator' expression as below and got rid of negative values.

Ln(("Flow_acc"+ 1 ) * 900/"Tan_SlopeRad")

The below process diagram would acquaint you about steps I have taken to arrive at the positive integer values.

PFD.jpg

and the resultant image clearly indicates values having 'No Data'. These values are mainly confined to Zero Degree Slope within River.

Results.jpg

Earlier, I uploaded this query on the following link but no response has been made so far:-

arcgis desktop - No Data Values in TWI Raster - Geographic Information Systems Stack Exchange

Now, How would I deal with values having ''No Data'???

0 Kudos
10 Replies
JayantaPoddar
MVP Esteemed Contributor

If you want to define a value to NoData pixels, you could add another raster calculator to the model

I want to define a value of 99 to NoData pixels. I will run the following expression in Raster Calculator.

Con(IsNull("TWI"),99, "TWI")



Think Location
NasirHameed
Occasional Contributor

Jayanta Poddar​, I am not interested to flag these pixels as No Data, I am intending to know why TWI raster results in 'No Data' Values over the surfaces where there is Slope Gradient equals to Zero?

0 Kudos
DanPatterson_Retired
MVP Emeritus

looking at the equation, if the upper term is 0, you would twi of 0 since tan(0)=0.  If the lower term is 0, you would get a divide by zero error, so perhaps, it assigns the results to nodata rather than flag an error

NasirHameed
Occasional Contributor

Dan Patterson​, Yes, it assigns 'No Data' where it finds Zero Slope gradient.. On the contrary, these are the ideal places where water should be accumulated due to low gradient than those pixels surrounded by and also influenced by 'a', up slope catchment area.

In true essence,  Wetlands, ponds etc could be detected having analogues characteristics with respect to such slope gradient. But currently I am not aware for the remedial measures in order to eliminate such anomalies for the amicable results using TWI. As such “TWI calculates the capacity of water accumulation of each pixel in a watershed using a DEM” (Beven & Kirkby,1979).

The presence of No Data pixels (which are surely having Zero Degree Slope values) right in center of the river doesn't make sense to me.

There would be some rules to deal with such anomalies with respect to flat terrain when we are dealing with TWI. I am looking to get know if there is any research work / model relevant to address such anomalies so I could refer to it.

0 Kudos
DanPatterson_Retired
MVP Emeritus

If you applied the formula as given, then you are aware of the limitations.  What you need to is modify that case and return a value for TWI to some other appropriate value for the analysis.  A slope check prior to TWI being actually calculated would enable that.

if slope == 0 then TWI = ??? else calculate TWI  would be the syntax.  Perhaps someone else has already produced a GIS methodology in one of the GIS packages.  I would find it strange that this situation hasn't been address before somewhere because the TWI formula as you posted is incomplete since it provides no value for when slope is 0

NasirHameed
Occasional Contributor

Dan Patterson​ According to Beven, K.J.; Kirkby, M. J. (1979). TWI=

 \ln {a \over tanb}

If you go ahead straight forward with the formula, it will produce negative values in the resultant raster. Therefore, the rest of the values are inserted to avoid negative index values and standardize them to appropriate interpretable figures in the results.

So far, I didn't found suitable reference in order to deal with Zero Degree Slope values. If you could refer me to any study in this context please as a reference?

0 Kudos
DanPatterson_Retired
MVP Emeritus

I am sure the text must cite some constraints... I can't believe that the error hasn't been noted since 1979.  Check the text, don't just rely on the formula

By example

>>> b = 0

>>> import numpy as np

>>> np.tan(b)

0.0

>>> a = 1

>>> np.log(a/b)

Traceback (most recent call last):

  File "<interactive input>", line 1, in <module>

ZeroDivisionError: division by zero

>>> np.log([1, np.e, np.e**2, 0])

array([  0.,   1.,   2., -Inf])

>>>

NasirHameed
Occasional Contributor

I appreciate your help and suggestions.

This has helped me to further dig out and restructure my expression to derive what TWI is meant for.

Thank you

0 Kudos
NasirHameed
Occasional Contributor

Dan Patterson I have resolved this problem by modifying above expression;

Ln(("Flow_acc"+ 1 ) * 30/"Tan_SlopeRad")

Wherein, earlier I used Cell area 900(30x30)

There was nothing wrong with the Process Flow Diagram inserted above, however, I removed the 'Sinks' from the flow direction raster. Interestingly, it was earlier pre-processed and all depression were removed by 'Filling' these imperfections. However, now there are no anomalies in the derived raster and no cells contain 'No Data' values. I checked my results using WhiteBox with similiar algorithms used by ArcGIS (D8 method) and results were almost similar. Below is the results of TWI from ArcGIS , TWI.jpg

and here are the results from WhiteBox using similar algorithms (method)

TWI.png