Deltares / Ribasim

Water resources modeling
https://ribasim.org/
MIT License
39 stars 5 forks source link

Go back to globally unique node IDs? #1690

Closed deltamarnix closed 3 weeks ago

deltamarnix commented 1 month ago

The edge table should only consist of (fid), name, from_node_id, to_node_id, edge_type, subnetwork_id.

But now it also contains from_node_type and to_node_type. This information is superfluous, because the information is already in the Node table.

We should get rid of it, because it makes changing the node type (e.g. from DiscreteControl to PidControl) hard in applications like QGIS. I want to go back to globally unique node ids.

That's the opposite of #1513

SouthEndMusic commented 1 month ago

That information is needed because node IDs are not unique across different node types. So you need ID and type to uniquely specify a node

visr commented 1 month ago

We didn't really document the reasoning why you now need both node ID and type (Basin #5) to uniquely specify a node.

The reason was to simplify the design and implementation of the Python API for adding nodes.

model.basin.add(Node(1, Point(0.0, 0.0)), basin_data)

The Node table for all Basins is in model.basin, not model. Only on writing out the model or calling model.node_table() is the whole Node table combined. So when adding a Basin we only need to check locally rather than keeping track of all IDs.

That doesn't mean we cannot change this though.