-
Notifications
You must be signed in to change notification settings - Fork 365
feat: add store_model option to save linopy model after solving #2001
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
base: master
Are you sure you want to change the base?
Conversation
Add solving.options.store_model config option that stores the linopy model to a NetCDF file in results/models/ after solving. Includes validation to prevent use with rolling_horizon mode.
for more information, see https://pre-commit.ci
fneum
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one question about output_model function.
rules/solve_electricity.smk
Outdated
| output: | ||
| network=RESULTS + "networks/base_s_{clusters}_elec_{opts}.nc", | ||
| config=RESULTS + "configs/config.base_s_{clusters}_elec_{opts}.yaml", | ||
| model=output_model(RESULTS + "models/base_s_{clusters}_elec_{opts}.nc"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fair, but couldn't it just be a lambda-function like elsewhere?
model=lambda w: RESULTS + "...nc" if config_provider("x", "y")(w) else []
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, just since it happens three times I wanted to have something more snappy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The disadvantage I see with this implementation is, that I have to look at different places to understand what configs determine this output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's the dream-case for branch:
model=branch(config_provider("x", "y"), RESULTS + "....nc")
a3dc397 to
ff0cf1f
Compare
Add solving.options.store_model config option that stores the linopy model to a NetCDF file in results/models/ after solving. Includes validation to prevent use with rolling_horizon mode.
Checklist
pixi.toml(usingpixi add <dependency-name>).config/config.default.yaml.doc/configtables/*.csv.doc/release_notes.rstis added.