pysheds
pysheds copied to clipboard
Rasterizing an existing basin boundary shapefile snap to DEM or flow direction raster with the same extent
Hello,
I have an existing basin boundary in a shapfile (mapped by experts). I would like to compare that with the shapefile that is based on the DEM or flow direction and extracted by pysheds.
Can I polygonized a basin shapefile into raster so that its raster snap exactly on the grid of the DEM or flow direction with exact same spatial extend? so I can easy compare the grids inside the shapefile with the pysheds and check the overlaps and its percentage, etc.
I think an example would be very help (in addition to the soil example already existing).
Thank you in advance.
Greetings,
I think the easiest way would be to:
- Delineate and extract the basin boundary from the DEM.
- Clip the grid's 'view' to the delineated basin.
- Rasterize the basin boundary shapefile delineated by experts using
grid.rasterize. - Use
grid.viewto create a view of the rasterized basin boundary at the same spatial extent and resolution as your DEM-delineated boundary. - Use boolean expressions to find the number of shared pixels and thus shared area.
This will be easier to do in pysheds v0.3, where rasterize returns a raster with a spatial extent.
Cheers, MDB