Skip to content

Commit

Permalink
Add more tool examples for documentation.
Browse files Browse the repository at this point in the history
Add more tool examples for documentation.
  • Loading branch information
wuwwen committed Dec 26, 2023
1 parent f8bf03b commit 74f3e48
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mikeplus/tools/catch_slope_length_process_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@

class CathSlopeLengthProcess:
"""This tool performs automatic estimation of slope and length for each catchment.
Examples
--------
An example to calculate the slope and length for catchmetn of "imp3" based on a slope shapefile and dfs2 file.
```python
>>> data_access = DataTableAccess(muppOrSqlite)
>>> data_access.open_database()
>>> catch_ids = ["imp3"]
>>> tool = CathSlopeLengthProcess(data_access.datatables)
>>> tool.run(catch_ids, "../tests/testdata/catchSlopeLen/Catch_Slope.shp", "tests/testdata/catchSlopeLen/dem.dfs2", 0)
>>> data_access.close_database()
```
"""
def __init__(self,
dataTables):
Expand Down
8 changes: 8 additions & 0 deletions mikeplus/tools/connection_repair_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ class ConnectionRepairTool:
For collection module, this class is to repair station connections, catchment connections and load point connections.
For water distribute module, this class is to repair station connections and demand allocation connections.
For SWMM, this class is to repair station connections and catchment connections.
Examples
--------
>>> data_access = DataTableAccess(muppOrSqlite)
>>> data_access.open_database()
>>> conn_repair = ConnectionRepairTool(data_access.datatables)
>>> conn_repair.run()
>>> data_access.close_database()
"""
def __init__(self,
dataTables):
Expand Down
14 changes: 14 additions & 0 deletions mikeplus/tools/interpolation_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@


class InterpolationTool:
"""The Interpolation and Assignment tool helps assign values to any field in the MIKE+ database either by taking the attribute value directly from
another fea­ture/attribute or by interpolating between any number of other features.
Examples
--------
Interplate node diameter from connected links for the nodes which have NULL diameter.
```python
>>> data_access = DataTableAccess(muppOrSqlite)
>>> data_access.open_database()
>>> tool = InterpolationTool(data_access.datatables)
>>> tool.interpolate_from_nearest_feature("msm_Node", "Diameter", "msm_Link", "Diameter", Ture, False, None)
>>> data_access.close_database()
```
"""
def __init__(self,
dataTables):
self._dataTables = dataTables
Expand Down
11 changes: 11 additions & 0 deletions mikeplus/tools/topology_repair_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@

class TopoRepairTool:
"""TopoRepairTool offers a way to detect and repair topology or network geometry issues in the model.
Examples
--------
Delete unlinked nodes and links, also delete overlapped nodes for the whole network.
```python
>>> data_access = DataTableAccess(muppOrSqlite)
>>> data_access.open_database()
>>> repair_tool = TopoRepairTool(data_access.datatables)
>>> repair_tool.run(True, True, False, False, Flase, False, False)
>>> data_access.close_database()
```
"""
def __init__(self,
dataTables):
Expand Down

0 comments on commit 74f3e48

Please sign in to comment.