Skip to content

Burning by pysheds #7

@mvhulten

Description

@mvhulten

Ideally burning and related routines are done by pysheds.

Blindly following these steps

grid = Grid.from_raster('dem.tif', data_name='dem')
grid.fill_depressions('dem', out_name='filled')
grid.resolve_flats('filled', out_name='flat')
grid.burn_streams('flat', streams='rivers.shp', burn_depth=10, out_name='burned')
grid.compute_gradient('burned', out_name='grad', spacing=(grid.dx, grid.dy))

results in

Traceback (most recent call last):
  File "/p/home/jusers/vanhulten1/jureca/.local/lib/python3.12/site-packages/pysheds/sgrid.py", line 2404, in _get_nodata_cells
    assert (isinstance(data, Raster))
            ^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/p/scratch/cdetect/vanhulten1/testing/ParFlow_static-file-gen.25C18/mkslopes/create_pfl_flow_direction.py", line 16, in <module>
    grid.fill_depressions('dem', out_name='filled')
  File "/p/home/jusers/vanhulten1/jureca/.local/lib/python3.12/site-packages/pysheds/sgrid.py", line 2151, in fill_depressions
    dem_mask = self._get_nodata_cells(dem)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/p/home/jusers/vanhulten1/jureca/.local/lib/python3.12/site-packages/pysheds/sgrid.py", line 2406, in _get_nodata_cells
    raise TypeError('Data must be a Raster.')
TypeError: Data must be a Raster.

This should still be tested more carefully.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions