why multiple runs of "r.fill.dir" are required

Hello,

I was reading the documentation for GRASS GIS’s r.fill.dir module and came across this statement:

“In some cases, it may be necessary to run r.fill.dir repeatedly (using output from one run as input to the next run) before all of the problem areas are filled.”

I am trying to understand why this happens. Is it only required when the -f flag is activated? I tested this by running r.fill.dir multiple times on a DEM, and it indeed took multiple runs to fill all the depressions.

I tried analyzing the code, but it’s still unclear why multiple runs are needed. Why can’t it fill all the depressions in a single run?

I would appreciate any pointers or explanations regarding this.

Thanks!

The documentation says the algorithm is based on this paper.

“Extracting topographic structure from digital elevation model data for geographic information system analysis” by S.K. Jenson and J.O. Domingue (1988).

but this paper does not mention anything about multiple iterations. It combines the connected watershed to find the highest pour point and then fill the depression till that point.

My guess is that in some cases of nested depressions the algorithm can’t resolve it all. There is a README with some notes from the author.

1 Like