mauro3 / WhereTheWaterFlows.jl

Hydrolocial water flow routing on digital elevation models
MIT License
16 stars 3 forks source link

drainpits performance #6

Closed visr closed 4 years ago

visr commented 4 years ago

As noted in the docstring, this is the performance bottleneck. Unfortunately if the array is rather large and there are a lot of pits, this becomes a real issue.

Do you have any ideas on speeding it up? Could using an algorithm like this work: https://jblindsay.github.io/wbt_book/available_tools/hydrological_analysis.html#FillDepressions

In this package the fill_dem function assumes drainpits has been run. I'm more familiar with the general approach to first make a hydrologically sound DEM, before making a drainage direction map.

mauro3 commented 4 years ago

Quick fix: If you have a lot of mini-depressions because of noise then filtering the DEM helps a lot.

Otherwise, I agree that this should be improved on. I'm no expert on this yet, so I couldn't say what's best. I hope to spend some time on this in spring. PRs welcome!

visr commented 4 years ago

Ok thanks for tip, that makes sense.

Good to know PRs are welcome in this regard, though I can't make any promises yet.

mauro3 commented 4 years ago

Cool! If you start working on something, let me know so we don't duplicate efforts (although, chances of that happening are pretty slim ;-)

mauro3 commented 4 years ago

With the last few commits, the drainpit performance is now much better and the bottleneck is now the flow-routing (see #11).