-
Notifications
You must be signed in to change notification settings - Fork 11
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
Update emissions.py with CO2 equivalent notation #36
base: main
Are you sure you want to change the base?
Conversation
Added CO2-eq notation as this is currently used in our AR6 and other variable templates
I suspect this may not work, because the underlying package, |
Codecov Report
@@ Coverage Diff @@
## main #36 +/- ##
=======================================
Coverage 73.10% 73.10%
=======================================
Files 4 4
Lines 145 145
=======================================
Hits 106 106
Misses 39 39
Continue to review full report at Codecov.
|
Note that you edited a file that has as its first line "# DO NOT ALTER THIS FILE MANUALLY!"... |
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.
Please expand the tests so that the new symbol you've added is tested:
Lines 86 to 103 in 00857b7
@pytest.mark.parametrize( | |
"metric, species_in, species_out, expected_value", | |
[ | |
("AR6GWP100", "CH4", "CO2", 27.9), | |
("AR5CCFGWP100", "CH4", "CO2", 34), | |
("AR5GWP100", "CH4", "CO2", 28), | |
("AR5GWP100", "CH4", "CO2e", 28), | |
("AR4GWP100", "CH4", "CO2", 25), | |
("SARGWP100", "CH4", "CO2", 21), | |
# Same-species conversion with metric=None and compatible names | |
(None, "CO2", "CO2_eq", 1.0), | |
(None, "CO2eq", "CO2e", 1.0), | |
# Species names which are substrings of one another match correctly | |
("AR5GWP100", "HFC143", "CO2", 328.0), | |
("AR5GWP100", "HFC143a", "CO2", 4800.0), | |
], | |
) | |
def test_convert_gwp(units, metric, species_in, species_out, expected_value): |
@danielhuppmann good eye! 😅 @byersiiasa you should instead modify the variable _EMI_EQUIV in the file update.py. |
@khaeru sorry not quite intuitive to me here, should I add: Also - #L92 |
Here are the relevant pytest docs: https://docs.pytest.org/en/stable/how-to/parametrize.html To paraphrase, the 4 elements of that tuple get mapped to the function arguments named on L87, i.e. "species_in", "species_out", etc. Then you can see in the function body how those are used to call the tested function. Each line is an individual test case, so e.g.
You could test "CO2-eq" as species_in and/or species_out, depending on how you expect that it should work! |
Added CO2-eq notation as this is currently used in our AR6 and other variable templates