pysheds
pysheds copied to clipboard
How to create a raster delineating all drainage basins using pysheds.
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.
Try to use snap_to_mask.ipynb.
- Pick up points that are inside your watershell (you can try use the random sampling like the example)
- Convert
z1
to Geojson/Shapefile (search how to convert tiff to Geojson ) - The outer limit will be your calculated watershed
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.
this would be a neaty and much-needed function. Looking forward to it