Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to merge two Ribasim models in Python #912

Closed
evetion opened this issue Dec 19, 2023 · 2 comments
Closed

Ability to merge two Ribasim models in Python #912

evetion opened this issue Dec 19, 2023 · 2 comments
Labels
python Relates to one of the Ribasim python packages

Comments

@evetion
Copy link
Member

evetion commented Dec 19, 2023

@SouthEndMusic

This would be helpful in writing larger testmodels that don't duplicate code, but can merge smaller test models.

Could be generically implemented as follows:

  • Merge method on the TableModel class, that merges the existing table with another TableModel (e.g. PumpStatic) using pandas, taking care of unique ids, after checking the schemas are the same.
  • Merge method on the NodeModel class, that takes another NodeModel (e.g. Pump) class and merges with it, by calling the merge method (see above) on all its children that are tablemodels.
  • Merge method on the Model class that merges with another Model. It will call the above merge method for all its children that are Nodes.

The difficulty lies in making sure the renamed node_ids are either known at the Model merge level, and used in other methods, or the renaming of the node_ids follows a fixed schema. So when the Nodes and Edges are renamed, they still are linked to things like Pumps.

@github-project-automation github-project-automation bot moved this to To do in Ribasim Dec 19, 2023
@SouthEndMusic SouthEndMusic self-assigned this Dec 19, 2023
@SouthEndMusic SouthEndMusic moved this from To do to 🏗 In progress in Ribasim Dec 19, 2023
@visr visr moved this from 🏗 In progress to 👀 In review in Ribasim Jan 8, 2024
@visr visr moved this from 👀 In review to 🏗 In progress in Ribasim Jan 18, 2024
@visr visr moved this from 🏗 In progress to What's next in Ribasim Feb 1, 2024
@SnippenE SnippenE added the python Relates to one of the Ribasim python packages label Feb 22, 2024
@Hofer-Julian Hofer-Julian removed their assignment Feb 27, 2024
@visr
Copy link
Member

visr commented Mar 19, 2024

This is probably easier to implement now after #1110. Node IDs only have to be made unique per node type. We might be able to re-use some parts of #914.

@SouthEndMusic
Copy link
Collaborator

Closed in favor of #1297.

@github-project-automation github-project-automation bot moved this from What's next to ✅ Done in Ribasim Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Relates to one of the Ribasim python packages
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants