Skip to content

Pysheds

King, Jonathan M requested to merge ghsc/users/jking/pfdf:pysheds into main

Summary

This merge requests replaces TauDEM with pysheds for watershed analyses. This has many consequences throughout the package, which include:

  • Replaced the dem module with the watershed module
  • The stream module has been replaced by the watershed.network function
  • Consolidated all raster backends into the raster.Raster class. This class supports
    • Handling of pysheds Rasters
    • Projection / CRS / transform metadata and validation, and
    • User-facing functions for working with rasters

Other effects of this shift include:

  • Installation no longer requires conda, as all dependencies are now Python packages
  • All ArcPy commands (i.e. the stream module) have been removed, so the package is now fully open source
  • Moved various utility modules into the _utils subpackage
  • Simplified various type hints as per Python 3.11 style

Multi-part Merge

Switching to pysheds also prompted large changes to the Segments class and hazard assessment models. Ultimately, this seemed like too much for a single merge request, so I'm breaking the updates into either 2 or 3 merges. This is the first of the series, and only includes changes to the backend and watershed module. As such, the segments and models modules are intentionally broken. I've temporarily disabled the tests for these modules in the pipeline, but will restore them over the next few merges.

Notes for Reviewer

Some thoughts to simplify the review experience:

  • I wouldn't bother with the deleted files (dem.py, _rasters.py, rasters.py, stream.py and associated tests) as they've all been replaced by other modules
  • The diffs in the validate module look larger than they really are because I moved a few functions around. The real changes are as follows:
    • Added validate.option
    • Added raster metadata validaters
    • Renamed validate.mask to validate.boolean

Closes #23 (closed), #25 (closed), #27 (closed), #31 (closed), #38 (closed), #48 (closed)

Edited by King, Jonathan M

Merge request reports