-
Notifications
You must be signed in to change notification settings - Fork 112
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
Add precautionary checks to Model.initialize_items #315
Conversation
b35d71b
to
a75a0c4
Compare
Codecov Report
@@ Coverage Diff @@
## master #315 +/- ##
==========================================
+ Coverage 97.43% 97.56% +0.12%
==========================================
Files 41 41
Lines 4292 4353 +61
==========================================
+ Hits 4182 4247 +65
+ Misses 110 106 -4
Continue to review full report at Codecov.
|
96bc80e
to
6cac790
Compare
- Ensures tests pass no matter which subset/order is run. - Also tidy reporting.utils.parse_units.
- Ensures storage-related parameters are added to any Scenario loaded; this allows test_legacy_scenario to pass.
- Ensures storage-related parameters are added to any Scenario loaded; this allows test_legacy_scenario to pass.
- Ensures storage-related parameters are added to any Scenario loaded; this allows test_legacy_scenario to pass.
2ac3173
to
0112f33
Compare
0112f33
to
4ddee80
Compare
Thanks @khaeru for imprving the code to account for temporary and/or new items introduced in a development branch. I see this very useful, as the user can add these new/temporary items in one place |
- Add mapping of time and period - Update data load for storage mappings - Update data load and parameter/sets def - Update model core - Add unit test and explanation - Add a document for illustration - Update and clean time mapping - Update data load - Update and clean model core - Clean sets and parameter definition text - Add to release notes - Clean up text in GAMS - Move storage init to core.py for use in all scenarios - Cleanup of test_storage - Remove commodity index from storage bounds and losses - Add relation_storage as an option (storage_equality removed) - Map storage_balance to map_tec_storage_level - Add inline documentation to model_core - Clean up GAMS files before rebasing - Small modifications after rebasing - Changes related to initialization of storage - Clean up notation and complete documentation - Improve tests to consider the initial value - Improve mapping of storage level for storage with no loss - Update asserts in test_reporting explicitly - Cleanup of documentation and GAMS core - Update test_legacy_version for changes in GAMS - Improve text of test and documentation - Consider lvl_temporal directly in parameter time_seq - Make the connection between the last and first time steps (storage cycle) - Remove second 'year' from index of time_period mapping - Move init_storage to models.MESSAGE.initialize - Minor code cleanup - Use ixmp.Model.initialize_items() - Update hard coded lengths in test_reporting and test_tutorials - Rename test_storage and move to tests folder - Accept and check an optional scheme kwarg to message_ix.Scenario - Cleanup after rebase - Code removed by 56f7bd5 - Code removed by 3bd21e5 - Restore line endings of period_parameter_assignment.gms - Simplify the mapping of charge-discharge technologies to storage - Remove map_time_period from include folder to data_load.gms - Correct the mapping of initial storage content - Change the sign of relation_storage and some text edits - Remove new bound definitions - Consider commodity in equations - Correct linter errors - Update period_parameter_assignment.gms - Rename and cleanup storage equivalence equation - Update reporting tests for new lengths - Update Scenario constructor per iiasa/ixmp#315 - Ensures storage-related parameters are added to any Scenario loaded; this allows test_legacy_scenario to pass. - Rename storage.PNG to storage.png, consistent with usage in docs - Correct ReST syntax for storage docs in model_core.gms - Reference label with '-' instead of spaces. - Underlines match heading length. - Space between paragraph text and '..'. - Correct relative path to figure storage.png. - Update coding style guide for docs, GAMS code - Update release notes with migration note; add storage items to docs - Add autosummary to model docs - Remove storage relations; to be modeled by existing parameters - Update reporting length numbers - References to message_ix in RELEASE_NOTES.rst - Add documentation of storage params - Change test assert values to pass CI - Add documentation of sets for storage - Edit nomenclature of storage equations - Correct typo in COMMODITY_BALANCE equation - Add one missing underline symbol in params section title - Update test_reporting.py - Edit text for parameters of storage - Address Sphinx warnings Co-authored-by: Matthew Gidden <[email protected]> Co-authored-by: Paul Natsuo Kishimoto <[email protected]> Co-authored-by: Francesco Lovat <[email protected]>
This PR adds changes necessary for iiasa/message_ix#190. In particular, it ensures that the
Model.initialize()
method is always called when a Scenario is cloned or loaded.This helps in the following way:
MESSAGE.initialize()
is expanded to add sets and parameters related to storage to any existing Scenario that lacks them. E.g. intest_legacy_version
, an old Scenario is loaded that lacks the storage parameters. Solving that Scenario with the updated MESSAGE GAMS code fails, because the items expected are not found.MESSAGE.initialize()
is invoked when that Scenario is loaded: https://github.com/behnam-zakeri/message_ix/blob/43a98fe3e416bf1fe61af54f3243052dc162f23d/message_ix/tests/test_legacy_version.py#L15-L16Also:
Model.initialize_items()
checks whether the returned object is in a checked-out state when it is received, and leaves the object in the same state.Backend.init_ts()
andBackend.init_s()
are consolidated and simplified.Scenario.__init__()
now chains through its parent method,TimeSeries.__init__()
.ixmp show-versions
#320.test_show_versions
would load pyam and message_data, which both change the pint 'application registry'; this would cause the ixmp reporting tests related to units to fail, depending on which subset of tests was run.How to review
test_legacy_version
passes.PR checklist