tools.CathSlopeLengthProcess
The Catchment Slope Length Process tool from MIKE+.
Usage
tools.CathSlopeLengthProcess(database)Examples
An example to calculate the slope and length for catchment of “imp3” based on a slope shapefile and dfs2 file.
>>> from mikeplus import Database
>>> db = Database("path/to/model.sqlite")
>>> catch_ids = ["imp3"]
>>> tool = CathSlopeLengthProcess(db)
>>> tool.run(catch_ids, "../tests/testdata/catchSlopeLen/Catch_Slope.shp", "tests/testdata/catchSlopeLen/dem.dfs2", 0)
>>> db.close()Methods
| Name | Description |
|---|---|
| __init__() | Initialize the CathSlopeLengthProcess with the given Database. |
| run() | Calculate the slope and length for each catchment. |
__init__()
Initialize the CathSlopeLengthProcess with the given Database.
Usage
__init__(database)Parameters
database: Database- A Database object for the MIKE+ model.
run()
Calculate the slope and length for each catchment.
Usage
run(
catch_ids,
line_layer,
dem_layer,
direction,
min_slope=0.002,
demUnitKey=1000,
overwrite_exist=True
)Parameters
catch_ids: Iterable[str]-
MUIDs of the catchments
line_layer: string-
a slope shape file path
dem_layer: string-
dem file path, can be dfs2 file path
direction: int-
Downstream = 0, Upstream = 1
min_slope: float = 0.002-
unit is one per one, by default 0.002
demUnitKey: int = 1000-
int type data, please check MIKE unit key, by default 1000
overwrite_exist: bool = True- overwrite exist value or not, by default True