-
Notifications
You must be signed in to change notification settings - Fork 123
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
Handle context=None in convert_unit when input/output GHG species match #369
Conversation
- Cover context=None. - Cover same-species conversions.
@danielhuppmann—I haven't introduced any CI changes here to run against the branch for IAMconsortium/units#21, but the combination of the two works on my system. I would suggest:
The tests have been expanded, but if there is any other untested but expected behaviour, this would be a good time to add it—please add to the branch. |
- Consolidate GWP-related code in pyam.units
- Conversion without context. - Conversion between different symbols for the same species, e.g. 'CO2_eq' and 'CO2'. - Conversion using lower-case aliases for species symbols, e.g. 'co2' for 'CO2'.
Per discussion in Slack last week:
These steps are now complete. |
@@ -766,7 +766,7 @@ def rename(self, mapping=None, inplace=False, append=False, | |||
|
|||
def convert_unit(self, current, to=None, factor=None, registry=None, | |||
context=None, inplace=False): | |||
"""Convert all data having *current* units to new units. | |||
r"""Convert all data having *current* units to new units. |
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.
is the r
on purpose?
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.
Yes: I built the docs, and saw that 'gwp_'
further down was being interpreted as a ReST link (trailing underscore) when I didn't intend that. So, I added \
to escape the underscore; but then my Python linter was complaining that that was a special character. r
makes it a "raw string" in which \
is a literal character.
Co-Authored-By: Daniel Huppmann <dh@dergelbesalon.at>
resolved the merge conflict |
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, thanks @khaeru!
Please confirm that this PR has done the following:
Description of PR
Adds tests for #368 and adjusts to IAMconsortium/units#21, which contains the fix.