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

Report CO₂ emissions from transportation #134

Merged
merged 31 commits into from
Oct 30, 2023
Merged

Report CO₂ emissions from transportation #134

merged 31 commits into from
Oct 30, 2023

Conversation

khaeru
Copy link
Member

@khaeru khaeru commented Oct 19, 2023

This PR adds code that mirrors the behaviour of message_data (‘legacy’) reporting, as an exploration of how to exactly replicate these calculations using genno. For this purpose, the code only replaces the portions of message_data.tools.post_processing.default_tables.retr_CO2emi that calculate CO₂ emissions from transportation.

The goals are:

  • The magnitudes and labels on the data are the same (to within a small tolerance) as those produced by message_data. (However, per this Slack thread, there does not exist a legacy reporting output for the snapshot, and it would be difficult to produce one due to changes to the units.)
  • The code is legible, and it is clear how the genno-based code mirrors the logic of the older code.

Some things specifically omitted, that could be tackled in follow-up PRs:

  • Apply units to e.g. out:* earlier, in a single operation for all technologies that share the same units of ACT and output.

Housekeeping

  • Adjust usage of genno.Operator.define to avoid mypy complaints in "Code quality" CI job (FYI @glatterf42)

How to review

See:

PR checklist

  • Continuous integration checks all ✅
  • Add or expand tests; coverage checks both ✅
  • Add, expand, or update documentation.
  • Update doc/whatsnew.

@khaeru khaeru self-assigned this Oct 19, 2023
@codecov
Copy link

codecov bot commented Oct 19, 2023

Codecov Report

Merging #134 (519bdfc) into main (c9f1638) will increase coverage by 1.8%.
The diff coverage is 99.2%.

@@           Coverage Diff           @@
##            main    #134     +/-   ##
=======================================
+ Coverage   71.5%   73.3%   +1.8%     
=======================================
  Files         80      82      +2     
  Lines       5439    5663    +224     
=======================================
+ Hits        3889    4152    +263     
+ Misses      1550    1511     -39     
Files Coverage Δ
message_ix_models/model/config.py 100.0% <100.0%> (ø)
message_ix_models/report/__init__.py 80.0% <100.0%> (+2.2%) ⬆️
message_ix_models/report/sim.py 77.9% <ø> (-1.2%) ⬇️
message_ix_models/tests/report/test_compat.py 100.0% <100.0%> (ø)
...essage_ix_models/tests/report/test_computations.py 100.0% <100.0%> (ø)
message_ix_models/tests/test_report.py 92.7% <100.0%> (+0.7%) ⬆️
message_ix_models/util/scenarioinfo.py 100.0% <100.0%> (ø)
message_ix_models/report/compat.py 99.2% <99.2%> (ø)
message_ix_models/report/computations.py 94.7% <90.0%> (+42.7%) ⬆️

... and 2 files with indirect coverage changes

@khaeru khaeru marked this pull request as ready for review October 24, 2023 14:39
@khaeru khaeru added enh New features or functionality report genno-based reporting and post-solve processing transport MESSAGEix-Transport variant or transport in the base model labels Oct 25, 2023
@khaeru khaeru mentioned this pull request Oct 30, 2023
4 tasks
@khaeru khaeru linked an issue Oct 30, 2023 that may be closed by this pull request
3 tasks
@khaeru khaeru mentioned this pull request Oct 30, 2023
3 tasks
@khaeru khaeru force-pushed the enh/report-emi branch 2 times, most recently from 24a561c to 5a6175f Compare October 30, 2023 14:03
@khaeru khaeru force-pushed the enh/report-emi branch 2 times, most recently from df84248 to 9e17e46 Compare October 30, 2023 14:25
@khaeru khaeru merged commit 294ac47 into main Oct 30, 2023
19 checks passed
@glatterf42 glatterf42 deleted the enh/report-emi branch August 14, 2024 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enh New features or functionality report genno-based reporting and post-solve processing transport MESSAGEix-Transport variant or transport in the base model
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test and improve .report
1 participant