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

Add marginal carbon intensity data from UNFCCC #102

Merged
merged 42 commits into from
Sep 23, 2022

Conversation

fershad
Copy link
Contributor

@fershad fershad commented Sep 6, 2022

This PR adds country level marginal carbon intensity data from the UNFCCC to CO2.js. Initially (in this PR) we will be including the source data, and introducing scripts to generate JSON and JS exports of the source CSV file.

Todo:

  • ISO 2 & 3 letter country code mapping
  • Figure out how to handle memo notes that appear at the end of the dataset (e.g. Memo: EU 27)
  • Figure out how to handle countries that have all 0s (example)

@fershad fershad mentioned this pull request Sep 8, 2022
3 tasks
@fershad
Copy link
Contributor Author

fershad commented Sep 8, 2022

@fershad
Copy link
Contributor Author

fershad commented Sep 8, 2022

@mrchrisadams This PR is ready for review. It exposes the UNFCCC data in JSON format, just like we have done for Ember in #69. In order to do this, I have:

  1. Added the UNFCCC data as a CSV file in data/IFI_Default_Grid_Factors_2021_v3.1_unfccc.csv
  2. Added a new column in the countries.csv file to allow the UNFCCC country names to also be mapped to country codes (diff)
    • Please note that some countries in the Ember data are not in the UNFCCC data (e.g. Hong Kong), and some in the UNFCCC data are not in Ember (e.g. Tuvalu).
    • I have also added regions from the two datasets, although we don't use them at the moment.
  3. Moved more of the code into common utils functions which should be easier to maintain going forward.
  4. Moved the main generator scripts into a functions folder to keep the main data folder clean.
  5. Added scripts for marginal intensity to the package.json.

@fershad
Copy link
Contributor Author

fershad commented Sep 8, 2022

I have also added JSDoc style comments to the utility functions, which should help us when we come back to this code later & help others who want to play with it too. I'll try to do this more often as I touch other parts of the CO2.js code base, so that we can gradually have more complete documentation throughout the library.

@fershad fershad requested a review from mrchrisadams September 8, 2022 10:50
@fershad
Copy link
Contributor Author

fershad commented Sep 13, 2022

@mrchrisadams this should be all set now with the changes we discussed yesterday for #104

Copy link
Member

@mrchrisadams mrchrisadams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @fershad I'm happy for this to be merged in.

Thanks for putting the work in.

There are a lot of commits in this PR, and it doesn't look like we can rebase these in. I'm happy with a squash commit if it makes it easier to get this into the main branch, for us to start thinking about how to use this data in an extended API.

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.

2 participants