Deltares / Ribasim

Water resources modeling
https://deltares.github.io/Ribasim/
MIT License
36 stars 5 forks source link

Extend Ribasim Python API with Update function #1599

Open gijsber opened 3 days ago

gijsber commented 3 days ago

When you have existing models, you might want to update the model parameterization without rebuilding the model.

Therefore an Update API would be usefull, A design would be needed, but in my mind you want to say something like:

Update(table ,[ids], [content]) where table incidcates the table to update [ids] references the nodes (or edges) to be updated [content] holds the updated dataset (complete, not partial), structured according to the table definition and ordered by the ids. [ids] and [content] could be organized in tuples, dictionaries or whatever is efficient.

visr commented 3 days ago

If the node type stays the same this should be relatively easy. More complicated functionality would be supporting also replacing node types, removing nodes, and all the other features of the Ribasim 7 network editor.

If this is used for scenarios it also links to #47.

DanielTollenaar commented 1 day ago

Here is code that updates an existing node_id to a new node_type with data, implemented in the Ribasim-NL Model class: https://github.com/Deltares/Ribasim-NL/blob/7a413d8ef9b09d8365b47888753674874efa2bf7/src/ribasim_nl/ribasim_nl/model.py#L106-L144