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

Refactored unit conversion doesn't work within species #368

Closed
danielhuppmann opened this issue Apr 15, 2020 · 2 comments
Closed

Refactored unit conversion doesn't work within species #368

danielhuppmann opened this issue Apr 15, 2020 · 2 comments
Assignees
Labels

Comments

@danielhuppmann
Copy link
Member

Following the refactoring of the convert_unit() function for GWP (see #361), converting the physical unit of a species (without changing the species) does not work any more unless also providing a GWP-context.

TEST_DF = pd.DataFrame([
    ['model_a', 'scen_a', 'World', 'Primary Energy', 'Mt CO2/yr', 1, 6.],
],
    columns=pyam.IAMC_IDX + [2005, 2010],
)
pyam.IamDataFrame(TEST_DF).convert_unit('Mt CO2/yr', 'Gt CO2/yr')

raises an UndefinedUnitError.

This seems like a bug, because a context is shouldn't be necessary from first principles.

@khaeru
Copy link
Contributor

khaeru commented Apr 15, 2020

Good catch. It looks like this wasn't covered by any existing test, so the first step will be to add one. Will open a PR.

@danielhuppmann
Copy link
Member Author

closing as implemented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants