mdbartos / pysheds

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

Shape and extent of watershed is not correct in some cases, just moving 2 meters away as per issue #126 #185

Closed iamaxy81 closed 2 years ago

iamaxy81 commented 2 years ago

I have encountered the same behaviour as per issue #126. I have wrong watershed calculated for some pour points located on the streamline, but if I move just a few meters, also away from the stremline, I have the correct result. I tried setting snap='center' in the catchment calculation but nothing changed: grid.catchment(data='dir', x=x, y=y, out_name='catch', recursionlimit=15000, xytype='label', snap='center')

As you can see in the attached images two points that are both on the streamline, and less then half a meter far from each other, produce different results.

image image

mdbartos commented 2 years ago

Have you tried using grid.snap_to_mask to snap your coordinate to a high-accumulation cell?

iamaxy81 commented 2 years ago

Thanks man! It works