openclimatedata / countrygroups

Data Package, Python and JavaScript module with country groups
18 stars 9 forks source link

Add Montreal Protocol groupings? #5

Closed louispotok closed 3 years ago

louispotok commented 3 years ago

The Montreal Protocol and Kigali Amendment divide the world's countries into a few groups with different ODS/refrigerant phasedown responsibilities. I think this grouping would be a good fit for inclusion.

Going off this factsheet, I see the following 4 mutually-exclusive groups:

  1. Non-article 5 countries a. Main group b. different baseline calculation: Belarus, the Russian Federation, Kazakhstan, Tajikistan, and Uzbekistan.
  2. Article 5 countries a. Group 1: Most Article 5 countries. b. Group 2: Bahrain, India, Iran, Iraq, Kuwait, Oman, Pakistan, Qatar, Saudi Arabia, and the United Arab Emirates.

There is also a "high ambient temperature exemption" for the following countries: Algeria, Bahrain, Benin, Burkina Faso, Central African Republic, Chad, Cote d'Ivoire, Djibouti, Egypt, Eritrea, Gambia, Ghana, Guinea, Guinea-Bissau, Iran, Iraq, Jordan, Kuwait, Libya, Mali, Mauritania, Niger, Nigeria, Oman, Pakistan, Qatar, Saudi Arabia, Senegal, Sudan, Syria, Togo, Tunisia, Turkmenistan and United Arab Emirates. I think these are all Article 5 countries, but I'm not sure.

Unfortunately, I can't find a perfect reference for exactly which countries are in Article 5.

This page from Pakistan's National Ozone Unit has a list of Article 5 countries, and Wikipedia's page on the Montreal Protocol says "147 of the 196 Parties to the Montreal Protocol meet these criteria (they are referred to as Article 5 countries)" but I don't see a citation for those numbers.

The closest thing I can find is UNEP's Ozonaction Networks page which has a table of regional networks of Ozone Officers. When I copy the table out of a PDF and cleanup the multi-line countries I get 147 (in a gist here), so that matches. But I don't know if that's an acceptable source for this repo. I could also see a case for adding each of these regions as a group if it doesn't line up with another regional grouping in the repo, I didn't check that.

Hope this is helpful, happy to help in any other way if I can.

rgieseke commented 3 years ago

Interesting, few links i followed lead to missing pages on UN sites :-(

In general i try to have an official source (even if PDF), for future maintainability.

louispotok commented 3 years ago

Thank you for the quick response! Not sure I understand, though - are you saying that you got missing pages on the links I shared, or elsewhere?

Anyway, if I understand you correctly -- if I can find an official source you'd be willing to add it. Is that right?

rgieseke commented 3 years ago

Yes, on links i looked up or followed from other pages (outdated UN pages i think, sorry, i don't find them again).

Happy to include a list from an official source, i'm hesitant to include something where (your) background knowledge is required to assemble a list. If the format on an official list changes, someone can adjust the parsing code etc, that's no problem.

louispotok commented 3 years ago

Found it, thanks to a helpful email reply from UNEP:

rgieseke commented 3 years ago

Excellent! They look like they could be done in similar way to the existing ones. Want to submit a PR?

louispotok commented 3 years ago

Happy to. Just to make sure I understand the overall approach:

  1. Each script in scripts/ outputs exactly one csv or json file in data/.
  2. The name (up to file extension) should match, in other words scripts/X.py should create data/X.{csv|json}
  3. Add the name of the csv or json file to CSV_FILES or JSON_FILES in the Makefile.
  4. datapackage.json include a listing of all datasets (one entry in the resources list per data file)
  5. scripts/generate_modules.py creates a python module from the csv and json files.
  6. There is one "module name" (eg countrynames.MODULE_NAME) per data file.
  7. A module can have submodules, which is determined by a "Region" column in the csv (+ the "subresource" field in datapackage) or a nesting in the JSON file.

Is that right? I'm happy to add some more documentation to the README as well if it's helpful.

Anyway, it sounds like I have several options for how to represent this data. The most semantically faithful is probably to use JSON with subnesting.

However, do subresources need to be mutually exclusive? The high-ambient-temperature exception countries are split across Article 5 Group 1 and Article 5 group 2. I think the best way to represent all this would be with 5 groups:

* Article 5 countries 
  * Group 1: [list]
  * Group 2: [list]
  * High-ambient temperature exemptions: [list]
* Non-article 5
  * Main group [list]
  * Article 1.2J countries [list]

If that sounds good I'll go ahead. An alternative would be to add a separate resource for the high-ambient temperature exemptions but I don't think that makes a lot of sense.

Finally, in getting started I tried to run make and encountered several errors. One was an issue with installations which was solved (for me) by pinning the setuptools version, another was (I think) a change in format to the source data for imo.csv, and some others were in other datasets, likely also a change in the source data. I'm happy to try and fix them, would you prefer I add this PR separately or would one big PR (with meaningful commits) be okay? Whatever you prefer is fine by me.

rgieseke commented 3 years ago

An addition to the Readme sounds great, it probably should be noted as well that it's possible to work on individual items with e.g. make data/imo.csv

Fixing currently broken ones would also be good, too, best in a separate PR, smaller ones will be easier to review for me.

As for the structure, it depends a bit on how they will be used, I guess. For the UNFCCC Annex-I/non-Annex-I/with Kazakhstan i just used flat separate tables.

* montreal-protocol-article-5-group-1
* montreal-protocol-article-5-group-2
* montreal-protocol-article-5-high-ambient-temperature-exemptions
...

Note that i pushed some changes which i apparently forgot when i last worked on this.

louispotok commented 3 years ago

Great, thanks for your help. Submitted 3 PRs, one for this issue and two others for data updates (plus a minor fix) that came up while I was running the code.

rgieseke commented 3 years ago

Released as 0.12.0. Thanks for making it easy to review and fixing the other issues as well!

louispotok commented 3 years ago

Thanks for your work on the repo and your help getting this merged!