Closed d2hydro closed 6 months ago
In Ribasim 2024.2.0 the node IDs are only unique to the node type, so that simplifies the merging quite a bit.
@visr; actually I think it will make merging (reindexing) a little bit more complex. I would like to have all nodes a unique id so I can create a networkx object (using Node and Edge) and route trought the network. But I can concat node_id and type and do the same for edge, so that's OK.
This should work:
CLASS_TABLES = {}
for node in model.nodes().values():
CLASS_TABLES[node.get_input_type()] = node.fields()
Downside is that it requires a model instance. But the results doesn't depend on the model.
All code to create the hws and lhm 2024.2.X model-versions.
@visr, curious to your thoughts on how we merge models. I resetting a model index and concatting multiple models is defined here https://github.com/Deltares/Ribasim-NL/blob/RWS-network/src/ribasim_nl/ribasim_nl/reset_index.py https://github.com/Deltares/Ribasim-NL/blob/RWS-network/src/ribasim_nl/ribasim_nl/concat.py
For that I need to know tables with node_id columns from ribasim. Would be great if I could read that from the module directly instead of having my own global variable: https://github.com/Deltares/Ribasim-NL/blob/1262ebd23c24c20aac736766c469251c6aee0f2b/src/ribasim_nl/ribasim_nl/model.py#L11-L22