I'm developing a program about water flow based on DEM which is in Python. There're many potential depression in such DEM. Each pixel has different water depth value and they'll be tracked according to gradient decent. What baffles me is how to determine the flow direction when the filled depression is level which means subsequent water need to fill higher elevation pixels.
The algorithm is D8 tracking water flow in NumPy array. What I want to achieve is an update array after gradient decent, i.e. array after water flow into depressions.