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

[BUG] copying models with recharge models can go wrong #492

Closed
raoulcollenteur opened this issue Jan 26, 2023 · 1 comment
Closed

[BUG] copying models with recharge models can go wrong #492

raoulcollenteur opened this issue Jan 26, 2023 · 1 comment
Assignees
Labels
bug Indicates an unintended behavior or coding error
Milestone

Comments

@raoulcollenteur
Copy link
Member

raoulcollenteur commented Jan 26, 2023

Describe the bug

If arguments are provided to a recharge model, for example ps.rch.FlexModel(interception=False), and the model is copied or stored and loaded from a pas-file (same thing), the results are not the same. This is because recharge objects are not stored properly. The correct way to do this is to add a to_dict method, which exports the exact same arguments that go into the init of the class, plus the name of the class. This needs to be changed.

To Reproduce
Run example_snow.py.
ml2 = ml.copy()

=> model is different, no snowmodel.

Expected behavior

Return the same model.

Solution

The solution is easy, properly implement a to_dict method for recharge models. PR coming up.

@raoulcollenteur raoulcollenteur added the bug Indicates an unintended behavior or coding error label Jan 26, 2023
raoulcollenteur added a commit that referenced this issue Jan 26, 2023
@raoulcollenteur raoulcollenteur added this to the 0.23.0 milestone Jan 26, 2023
@raoulcollenteur raoulcollenteur self-assigned this Jan 26, 2023
@raoulcollenteur raoulcollenteur changed the title [BUG] copying models with recharge models is wrong [BUG] copying models with recharge models can go wrong Jan 26, 2023
@raoulcollenteur
Copy link
Member Author

Fixed as per #493 . Closing issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unintended behavior or coding error
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant