-
Notifications
You must be signed in to change notification settings - Fork 160
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
Resolve issues related to technical_lifetime
and historical vintages in Westeros tutorials
#815
Resolve issues related to technical_lifetime
and historical vintages in Westeros tutorials
#815
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #815 +/- ##
=======================================
+ Coverage 95.4% 95.6% +0.1%
=======================================
Files 46 46
Lines 4354 4335 -19
=======================================
- Hits 4156 4145 -11
+ Misses 198 190 -8
|
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.
Looks good to me, thanks :)
Aside from the ToDos you collected, I'd add this: Please adapt the objective value in this test line to the new one, which is 167594.640625
:
_t("w0", f"{W}_baseline", check=[("solve-objective-value", 173795.09375)]), |
This seems to be the only reason the tests are failing now (the one on windows-latest-py3.9 is flaky and has nothing to do with this PR).
technical_lifetime
and historical vintages in Westeros tutorialstechnical_lifetime
and historical vintages in Westeros tutorials
Thanks @glatterf42 for the quick review. I hadn't changed the objective functions in those test because we need to add investment cost for the grid (one of the ToDos) which will change the objective function. I discussed with @OFR-IIASA this morning, and we believe it's not needed to update the investment cost of wind and coal power plants (the optional ToDo), because this tutorial is not representing the reality of today, or in fact any period in history, and just wants to showcase how the model works with two technologies with different investment cost. As such, I will leave the investment cost for wind and coal power plants as it is for the time being. |
29fb4a1
to
44a80be
Compare
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.
Sorry to backtrack here, but one clarifying question and one change request:
Does this PR really close #525, #609, #813, and #814?
And as mentioned by @khaeru in the issue he linked, these lines are not clear to new users because it's unclear what the keys are in the key_or_data
argument. Could you please adjust this so that we use make_df()
for this line, too, clarifying the keys?
44a80be
to
e9d85b4
Compare
Highjacking this PR to enable ruff for all tutorial files since I started migrating to As for the question I raised earlier, I have now concluded from your PR description, @behnam-zakeri, that all issues except #814 are indeed closed by this PR since #814 is the only one where you say "partially addressing". |
0ec68a6
to
d807b14
Compare
739c058
to
b3293db
Compare
b3293db
to
7f37327
Compare
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.
Looks good to me once CI passes :)
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.
Thanks for the improvements here!
Applying the code style to the tutorials is a good step. In westeros_baseline.ipynb, this apparently result in a cell with code like:
# Create a Reporter object to describe and carry out reporting
# calculations and operations (like plotting) based on `scenario`
from message_ix.report import Reporter
# ← The line that was here
# "prepare_plots" enables several to describe reporting operations, e.g.
# "plot activity", "plot capacity", or "plot prices"
# See message_ix/util/tutorial.py for more information
from message_ix.util.tutorial import prepare_plots
rep = Reporter.from_scenario(scenario) # ← …is now here
prepare_plots(rep)
This means the initial comment is no longer with the line it was meant to describe. This might have been due to ruff's automatic sorting of imports. More readable would be:
from message_ix.report import Reporter
from message_ix.util.tutorial import prepare_plots
# Create a Reporter object to describe and carry out reporting
# calculations and operations (like plotting) based on `scenario`
rep = Reporter.from_scenario(scenario)
# "prepare_plots" enables several to describe reporting operations, e.g.
# "plot activity", "plot capacity", or "plot prices"
# See message_ix/util/tutorial.py for more information
prepare_plots(rep)
Some other requested changes inline, as well as an important question.
7f37327
to
4e5f907
Compare
* Use make_df for clarity where not already used
* Import make_df from the top level * Use lists of years in make_df * Clean up location of comments in reporting cells
ebac2b5
to
fde7729
Compare
This PR resolves issues related to Westeros "baseline" tutorial, including #525, #609, #813, and #814.
This PR does the following:
technical_lifetime
of that technology (addressing Fix handling of activity years and life time of technologies in the tutorials #525)technical_lifetime
not defined for historical vintages in Westeros tutorial #609, partially related to this comment in Add commodity flow of capacity variables #451, and partially related to Westeros tutorials inconsistent with changes made to baseline #624)How to review
PR checklist