## tools.TopoRepairTool


Topology repair tool for MIKE+.


Usage

``` python
tools.TopoRepairTool(database)
```


TopoRepairTool provides methods to repair the topology of a MIKE+ model.


## Examples

Delete unlinked nodes and links, also delete overlapped nodes for the whole network.

``` python
>>> from mikeplus import Database
>>> db = Database("path/to/model.sqlite")
>>> repair_tool = TopoRepairTool(db)
>>> repair_tool.run(True, True, False, False, False, False, False)
>>> db.close()
```


## Methods

| Name | Description |
|----|----|
| [__init__()](#__init__) | Initialize the TopoRepairTool with the given Database. |
| [run()](#run) | Offers a way to detect and repair topology or network geometry issues in the model. |

------------------------------------------------------------------------


#### \_\_init\_\_()


Initialize the TopoRepairTool with the given Database.


Usage

``` python
__init__(database)
```


##### Parameters


`database: Database`  
A Database object for the MIKE+ model.


------------------------------------------------------------------------


#### run()


Offers a way to detect and repair topology or network geometry issues in the model.


Usage

``` python
run(
    delete_unLink_node_Link=True,
    dissolve_overlap_node=True,
    correct_link_connection=True,
    search_junction_connection=True,
    create_junction_connection=True,
    split_link_on_tjunction=True,
    add_missing_zones=True,
    snap_distance=0.1
)
```


##### Parameters


`delete_unLink_node_Link: bool = ``True`  
If true, isolated nodes (other than tanks) and links / pipes, disconnected from the rest of the network, will be removed. By default True

`dissolve_overlap_node: bool = ``True`  
If true, extra nodes within the specified search radius will be removed. By default True

`correct_link_connection: bool = ``True`  
When a link's end is not connected to a node, if this operation is true, it will connect it either to the closest existing node within the specified search radius, or to a new node. By default True

`search_junction_connection: bool = ``True`  
If true, it will connect to the closest existing node within the specified search radius. By default True

`create_junction_connection: bool = ``True`  
If true, it will connect to a new node. By default True

`split_link_on_tjunction: bool = ``True`  
If true, when the end of a link overlaps a second link, this second link is split at the intersection and a node is inserted, and all the three resulting pipes are connected to this new node. By default True

`add_missing_zones: bool = ``True`  
If true, refresh the list of network zones. By default True

`snap_distance: float = ``0.1`  
The distance used in dissolve the overlapped nodes, in correct link connection, and in split link on T junction, by default 0.1.


##### Raises


`ValueError`  
If the active model is neither CS_MIKE1D nor WD_EPANET.
