-
Notifications
You must be signed in to change notification settings - Fork 94
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
Clean and isolate model/backend attributes #635
Conversation
At the moment, use of |
|
Current implementation is returning a rather funky error when building the documentation for For the To repeat, add a conditional breakpoint in import calliope
from calliope.postprocess.math_documentation import MathDocumentation
MODEL_PATH = "docs/hooks/dummy_model/model.yaml"
model_config = calliope.AttrDict.from_yaml(MODEL_PATH)
for override in model_config["overrides"].keys():
custom_model = calliope.Model(model_definition=MODEL_PATH, scenario=override)
custom_model.build()
math_documentation = MathDocumentation(custom_model) Notice for
No idea why this happens, yet. |
Further debugging: The error is caused by edit: error was caused by passing |
Closed in favor of #639 |
Fixes #608 and #619
Summary of changes in this pull request
This PR aims to condense the amount of stuff we save throughout the init / build / solve process by avoiding attribute duplication and cleanly defining what is passed to the backend and saved in model files.
model._timings
andmodel._model_data.attrs["timestamp_xxxx"]
are nowmodel.timestamps
.backend._add_run_mode_math
was moved tomodel._ensure_mode_math
.model.math
/model._model_data.attrs["math"]
are now justmodel.math
.model.math_documentation
was moved topostprocessing.math_documentation
, which takes anymodel
as input. This should help users build their own docs without tampering withmodel
.PR checklist
_model_def_dict
math
attributesReviewer checklist