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

Accept and return (optional) ASCII format for gases and units #2

Merged
merged 7 commits into from
Feb 9, 2021

Conversation

danielhuppmann
Copy link
Contributor

This PR brings in a generalization of the API, per a comment by @mikapfl, see IAMconsortium/pyam#497 (comment).

The `UNFCCCApiReader.query()´ now accepts simple ASCII-strings of gases (N2O instead of N₂O), and optionally (default) returns the gases and unit columns normalized to ASCII.

Note: Not sure if 'C5F₁₂' in the UNFCCC API is a bug or a feature, but I figured that the explicit dictionary is preferable (more readable) to a "make everything subscript except for ..." function.

@codecov
Copy link

codecov bot commented Feb 9, 2021

Codecov Report

Merging #2 (e1a2830) into main (d9d0406) will increase coverage by 0.80%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main       #2      +/-   ##
==========================================
+ Coverage   89.77%   90.57%   +0.80%     
==========================================
  Files           2        2              
  Lines         176      191      +15     
==========================================
+ Hits          158      173      +15     
  Misses         18       18              
Impacted Files Coverage Δ
unfccc_di_api/tests/test_unfccc_di_api.py 100.00% <100.00%> (ø)
unfccc_di_api/unfccc_di_api.py 89.02% <100.00%> (+0.71%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d9d0406...128c6ca. Read the comment docs.

@mikapfl
Copy link
Member

mikapfl commented Feb 9, 2021

Fighting the CI can be avoided by running "make lint" in the repo before committing. 🙂

It is also possible to set up pre-commit to run automatically on git commits, the docs explain how.

Like this, normalization is available at all levels of abstraction.
@mikapfl mikapfl merged commit 5e17b99 into pik-primap:main Feb 9, 2021
@mikapfl
Copy link
Member

mikapfl commented Feb 9, 2021

Thanks for the PR, looks good!

@mikapfl
Copy link
Member

mikapfl commented Feb 9, 2021

I have released a new version incorporating your changes. So if you want to drop the normalization from your pyam PR, you might want to use a versioned dependency >= 2.0.0

Cheers + thanks again,

Mika

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

Successfully merging this pull request may close these issues.

None yet

2 participants