mdbartos / pysheds

:earth_americas: Simple and fast watershed delineation in python.
GNU General Public License v3.0
710 stars 195 forks source link

extract_profiles function returning wrong connections when neighbouring cells drain to outlet #232

Open barbedorafael opened 11 months ago

barbedorafael commented 11 months ago

I'm trying to get upstream/downstream relationships of several river stretches spread across several catchments in a large region. However, I noticed a problem when the most downstream cell of two neighboring catchments drain to the same outlet point, which happens quite often: instead of considering both cells as the end of the domain (outlet point), one catchment is considered as a contributor to the other, which is not true, and oftentimes the larger catchment is the contributor to the smaller one, which has no topological sense.

Below I attached an image ilustrating the issue, where the thicker line is wrongly considered to be downstream of the larger catchment.

I couldn't solve that in the code, so right now I'm just manually adjusting the values to fit my needs. I'm reporting this hoping it can be solved in the future. Thanks.

image