mdbartos / pysheds

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

How to create a raster delineating all drainage basins using pysheds. #132

Open rrsc1234 opened 3 years ago

rrsc1234 commented 3 years ago

Hi. I want to create a raster delineating all drainage basins similar to that as present in ArcMap (Basin Tool under Hydrology Tool). Can someone let me know whether is there any way of doing this using this pyshed library.

bmalbusca commented 3 years ago

Try to use snap_to_mask.ipynb.

mdbartos commented 2 years ago

This is indeed a separate function in ArcGIS (which I didn't have until a few months ago, lol): https://pro.arcgis.com/en/pro-app/latest/tool-reference/spatial-analyst/basin.htm

The key seems to be this:

The drainage basins are created by locating the pour points at the edges of the analysis window (where water would pour out of the raster), as well as sinks, then identifying the contributing area above each pour point.

So basically, they just delineate (and label) a set of drainage basins at each pixel where the flow direction points outside the boundary of the raster. I could write a wrapper function around grid.catchment to do this.

pkmn99 commented 11 months ago

this would be a neaty and much-needed function. Looking forward to it