From 09c0e05502779891cf38297306955a9f9c366225 Mon Sep 17 00:00:00 2001 From: David Almeida <58078834+dc-almeida@users.noreply.github.com> Date: Thu, 3 Oct 2024 09:36:30 +0200 Subject: [PATCH] Update countries attributes (#351) * Update countries attributes * Update copyright * Bump nomenclature requirement version * Switch black to ruff * Ruff reformatting --- .github/workflows/ruff.yml | 8 ++ README.md | 5 +- definitions/region/countries.yaml | 92 ++++++------- definitions/region/data/write-nuts.py | 3 +- definitions/region/european-regions.yaml | 24 ++-- definitions/region/global-regions.yaml | 126 ++++++++++-------- .../model_native_regions/REMIND_3.2.yaml | 76 ++++++----- .../model_native_regions/REMIND_3.3.yaml | 72 +++++----- .../model_native_regions/prometheus_1.2.yaml | 10 +- setup.cfg | 2 +- workflow.py | 9 +- 11 files changed, 227 insertions(+), 200 deletions(-) create mode 100644 .github/workflows/ruff.yml diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 00000000..c8a0958d --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,8 @@ +name: Ruff +on: [ push, pull_request ] +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: chartboost/ruff-action@v1 \ No newline at end of file diff --git a/README.md b/README.md index 72e5243b..b038ef4e 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,13 @@ # Project definitions for the openENTRANCE project -Copyright 2020-2023 openENTRANCE consortium +Copyright 2020-2024 openENTRANCE consortium This repository is licensed under the Apache License, Version 2.0 (the "License"); see the [LICENSE](LICENSE) for details. [![license](https://img.shields.io/badge/License-Apache%202.0-black)](https://github.com/openENTRANCE/openentrance/blob/main/LICENSE) [![python](https://img.shields.io/badge/python-3.7_|_3.8_|_3.9-blue?logo=python&logoColor=white)](https://github.com/openENTRANCE/openentrance) -[![Code style: -black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) +[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) ## Aim and scope of this repository diff --git a/definitions/region/countries.yaml b/definitions/region/countries.yaml index 00086155..c77e4771 100644 --- a/definitions/region/countries.yaml +++ b/definitions/region/countries.yaml @@ -7,233 +7,233 @@ eu_member: false iso2: AL iso3: ALB - iso3_codes: ALB + countries: [Albania] - Andorra: eu_member: false iso2: AD iso3: AND - iso3_codes: AND + countries: [Andorra] - Austria: eu_member: true iso2: AT iso3: AUT - iso3_codes: AUT + countries: [Austria] - Belarus: eu_member: false iso2: BY iso3: BLR - iso3_codes: BLR + countries: [Belarus] - Belgium: eu_member: true iso2: BE iso3: BEL - iso3_codes: BEL + countries: [Belgium] - Bosnia and Herzegovina: eu_member: false iso2: BA iso3: BIH - iso3_codes: BIH + countries: [Bosnia and Herzegovina] - Bulgaria: eu_member: true iso2: BG iso3: BGR - iso3_codes: BGR + countries: [Bulgaria] - Croatia: eu_member: true iso2: HR iso3: HRV - iso3_codes: HRV + countries: [Croatia] - Cyprus: eu_member: true iso2: CY iso3: CYP - iso3_codes: CYP + countries: [Cyprus] - Czech Republic: eu_member: true iso2: CZ iso3: CZE - iso3_codes: CZE + countries: [Czechia] - Denmark: eu_member: true iso2: DK iso3: DNK - iso3_codes: DNK + countries: [Denmark] - Estonia: eu_member: true iso2: EE iso3: EST - iso3_codes: EST + countries: [Estonia] - Finland: eu_member: true iso2: FI iso3: FIN - iso3_codes: FIN + countries: [Finland] - France: eu_member: true iso2: FR iso3: FRA - iso3_codes: FRA + countries: [France] - Germany: eu_member: true iso2: DE iso3: DEU - iso3_codes: DEU + countries: [Germany] - Gibraltar: eu_member: false iso2: GI iso3: GIB - iso3_codes: GIB + countries: [Gibraltar] - Greece: eu_member: true iso2: GR iso2_alt: EL # the European Commission uses alternative ISO2 codes iso3: GRC - iso3_codes: GRC + countries: [Greece] - Hungary: eu_member: true iso2: HU iso3: HUN - iso3_codes: HUN + countries: [Hungary] - Iceland: eu_member: false iso2: IS iso3: ISL - iso3_codes: ISL + countries: [Iceland] - Ireland: eu_member: true iso2: IE iso3: IRL - iso3_codes: IRL + countries: [Ireland] - Italy: eu_member: true iso2: IT iso3: ITA - iso3_codes: ITA + countries: [Italy] - Kosovo: eu_member: false iso2: XK iso3: XKX - # this ISO3 code is not recognized by the pycountry package + countries: [Kosovo] - Latvia: eu_member: true iso2: LV iso3: LVA - iso3_codes: LVA + countries: [Latvia] - Liechtenstein: eu_member: false iso2: LI iso3: LIE - iso3_codes: LIE + countries: [Liechtenstein] - Lithuania: eu_member: true iso2: LT iso3: LTU - iso3_codes: LTU + countries: [Lithuania] - Luxembourg: eu_member: true iso2: LU iso3: LUX - iso3_codes: LUX + countries: [Luxembourg] - Malta: eu_member: true iso2: MT iso3: MLT - iso3_codes: MLT + countries: [Malta] - Moldova: eu_member: false iso2: MD iso3: MDA - iso3_codes: MDA + countries: [Moldova] - Monaco: eu_member: false iso2: MC iso3: MCO - iso3_codes: MCO + countries: [Monaco] - Montenegro: eu_member: false iso2: ME iso3: MNE - iso3_codes: MNE + countries: [Montenegro] - North Macedonia: eu_member: false iso2: MK iso3: MKD - iso3_codes: MKD + countries: [North Macedonia] - Norway: eu_member: false iso2: 'NO' iso3: NOR - iso3_codes: NOR + countries: [Norway] - Poland: eu_member: true iso2: PL iso3: POL - iso3_codes: POL + countries: [Poland] - Portugal: eu_member: true iso2: PT iso3: PRT - iso3_codes: PRT + countries: [Portugal] - Romania: eu_member: true iso2: RO iso3: ROU - iso3_codes: ROU + countries: [Romania] - Russia: eu_member: false iso2: RU iso3: RUS - iso3_codes: RUS + countries: [Russian Federation] - Serbia: eu_member: false iso2: RS iso3: SRB - iso3_codes: SRB + countries: [Serbia] - Slovakia: eu_member: true iso2: SK iso3: SVK - iso3_codes: SVK + countries: [Slovakia] - Slovenia: eu_member: true iso2: SI iso3: SVN - iso3_codes: SVN + countries: [Slovenia] - Spain: eu_member: true iso2: ES iso3: ESP - iso3_codes: ESP + countries: [Spain] - Sweden: eu_member: true iso2: SE iso3: SWE - iso3_codes: SWE + countries: [Sweden] - Switzerland: eu_member: false iso2: CH iso3: CHE - iso3_codes: CHE + countries: [Switzerland] - The Netherlands: eu_member: true iso2: NL iso3: NLD - iso3_codes: NLD + countries: [Netherlands] synonyms: ['Netherlands'] - Turkey: eu_member: false iso2: TR iso3: TUR - iso3_codes: TUR + countries: [Turkey] - Ukraine: eu_member: false iso2: UA iso3: UKR - iso3_codes: UKR + countries: [Ukraine] - United Kingdom: eu_member: false iso2: GB iso2_alt: UK # the European Commission uses alternative ISO2 codes iso3: GBR - iso3_codes: GBR + countries: [United Kingdom] synonyms: ['Great Britain'] diff --git a/definitions/region/data/write-nuts.py b/definitions/region/data/write-nuts.py index 43c25c89..ac529f0e 100644 --- a/definitions/region/data/write-nuts.py +++ b/definitions/region/data/write-nuts.py @@ -29,7 +29,7 @@ # open the three files and write headers files = [] -for (n, text) in descriptions: +for n, text in descriptions: file = open(f"../nuts{n}.yaml", "w") file.write(f"# This file was created using the script `data/{this}`\n") file.write("# DO NOT ALTER THIS FILE MANUALLY!\n\n") @@ -40,7 +40,6 @@ # iterate over dataframe and parse codes and names country, _n1, _n2 = None, None, None for i, row in df.iterrows(): - if str(row["Code 2021"]) == "nan": continue diff --git a/definitions/region/european-regions.yaml b/definitions/region/european-regions.yaml index 16fd39b5..e88e7bf9 100644 --- a/definitions/region/european-regions.yaml +++ b/definitions/region/european-regions.yaml @@ -90,35 +90,35 @@ - INNOPATHS regions: - Germany (IP): innopaths: DEU - countries: Germany + countries: [Germany] - Eastern Europe (IP): innopaths: ECE - countries: Czech Republic, Estonia, Latvia, Lithuania, Poland, Slovakia + countries: [Czechia, Estonia, Latvia, Lithuania, Poland, Slovakia] - Scandinavia (IP): innopaths: ENC - countries: Denmark, Finland, Sweden + countries: [Denmark, Finland, Sweden] - South-East Europe (IP): innopaths: ECS - countries: Bulgaria, Croatia, Hungary, Romania, Slovenia + countries: [Bulgaria, Croatia, Hungary, Romania, Slovenia] - Southern Europe (IP): innopaths: ESC - countries: Cyprus, Greece, Italy, Malta + countries: [Cyprus, Greece, Italy, Malta] - Iberian Peninsula (IP): innopaths: ESW - countries: Portugal, Spain + countries: [Portugal, Spain] - Central Europe (IP): innopaths: EWN - countries: Austria, Belgium, Luxembourg, Netherlands + countries: [Austria, Belgium, Luxembourg, Netherlands] - France (IP): innopaths: FRA - countries: France + countries: [France] - United Kingdom & Ireland (IP): innopaths: UKI - countries: UK, Ireland + countries: [United Kingdom, Ireland] - Northern non-EU Europe (IP): innopaths: NEN - countries: Iceland, Liechtenstein, Norway, Switzerland + countries: [Iceland, Liechtenstein, Norway, Switzerland] - Southern non-EU Europe (IP): innopaths: NES - countries: Albania, Andorra, Bosnia and Herzegovina, North Macedonia, Monaco, - Montenegro, Serbia, Turkey + countries: [Albania, Andorra, Bosnia and Herzegovina, North Macedonia, Monaco, + Montenegro, Serbia, Turkey] diff --git a/definitions/region/global-regions.yaml b/definitions/region/global-regions.yaml index 086521ab..5769d0e0 100644 --- a/definitions/region/global-regions.yaml +++ b/definitions/region/global-regions.yaml @@ -20,59 +20,73 @@ # to the AR6 WG3 scenario ensemble # https://data.ene.iiasa.ac.at/ar6-scenario-submission/#/about - R5: - - OECD & EU (R5): - definition: OECD 90 and EU member states and candidates - ar6: R5OECD90+EU - ssp: R5.2OECD - countries: Albania, Australia, Austria, Belgium, Bosnia and Herzegovina, Bulgaria, - Canada, Croatia, Cyprus, Czech Republic, Denmark, Estonia, Finland, France, - Germany, Greece, Guam, Hungary, Iceland, Ireland, Italy, Japan, Latvia, Lithuania, - Luxembourg, Malta, Montenegro, Netherlands, New Zealand, North Macedonia, - Norway, Poland, Portugal, Puerto Rico, Romania, Serbia, Slovakia, Slovenia, - Spain, Sweden, Switzerland, Turkey, United Kingdom, United States of America - - Reforming Economies (R5): - definition: Countries from the Reforming Ecomonies of the Former Soviet Union - ar6: R5REF - ssp: R5.2REF - countries: Armenia, Azerbaijan, Belarus, Georgia, Kazakhstan, Kyrgyzstan, Moldova, - Russia, Tajikistan, Turkmenistan, Ukraine, Uzbekistan - - Asia (R5): - definition: The region includes Asian countries with the exception of the Middle - East, Japan and Former Soviet Union states. - ar6: R5ASIA - ssp: R5.2ASIA - countries: Afghanistan, Bangladesh, Bhutan, Brunei Darussalam, Cambodia, China - (incl. Hong Kong and Macao, excl. Taiwan), Republic of Korea, Fiji, French - Polynesia, India, Indonesia, Lao People's Democratic Republic, Malaysia, Maldives, - Micronesia (Fed. States of), Mongolia, Myanmar, Nepal, New Caledonia, Pakistan, - Papua New Guinea, Philippines, Republic of Korea, Samoa, Singapore, Solomon - Islands, Sri Lanka, Taiwan, Thailand, Timor-Leste, Vanuatu, Vietnam - - Middle East & Africa (R5): - definition: Countries of the Middle East and Africa. - ar6: R5MAF - ssp: R5.2MAF - countries: Algeria, Angola, Bahrain, Benin, Botswana, Burkina Faso, Burundi, - Cameroon, Cape Verde, Central African Republic, Chad, Comoros, Congo, Côte - d`Ivoire, Democratic Republic of the Congo, Djibouti, Egypt, Equatorial Guinea, - Eritrea, Ethiopia, Gabon, Gambia, Ghana, Guinea, Guinea-Bissau, Iran, Iraq, - Israel, Jordan, Kenya, Kuwait, Lebanon, Lesotho, Liberia, Libyan Arab Jamahiriya, - Madagascar, Malawi, Mali, Mauritania, Mauritius, Mayotte, Morocco, Mozambique, - Namibia, Niger, Nigeria, Occupied Palestinian Territory, Oman, Qatar, Rwanda, - Réunion, Saudi Arabia, Senegal, Sierra Leone, Somalia, South Africa, South - Sudan, Sudan, Swaziland, Syrian Arab Republic, Togo, Tunisia, Uganda, United - Arab Emirates, United Republic of Tanzania, Western Sahara, Yemen, Zambia, - Zimbabwe - - Latin America (R5): - definition: Latin and South American countries. - ar6: R5LAM - ssp: R5.2LAM - countries: Argentina, Aruba, Bahamas, Barbados, Belize, Bolivia, Brazil, Chile, - Colombia, Costa Rica, Cuba, Dominican Republic, Ecuador, El Salvador, French - Guiana, Grenada, Guadeloupe, Guatemala, Guyana, Haiti, Honduras, Jamaica, - Martinique, Mexico, Nicaragua, Panama, Paraguay, Peru, Suriname, Trinidad - and Tobago, United States Virgin Islands, Uruguay, Venezuela - - Other (R5): - definition: Rest of the World, to be used only if a match with the 5 AR6 regions - can otherwise not be achieved. - ar6: R5ROWO - ssp: + - OECD & EU (R5): + description: OECD (membership status 1990) and EU member states and candidates + ar6: R5OECD90+EU + ssp: R5.2OECD + countries: [ + Albania, Australia, Austria, Belgium, Bosnia and Herzegovina, Bulgaria, + Canada, Croatia, Cyprus, Czechia, Denmark, Estonia, Finland, France, Germany, + Greece, Guam, Hungary, Iceland, Ireland, Italy, Japan, Kosovo, Latvia, + Lithuania, Luxembourg, Malta, Montenegro, Netherlands, New Zealand, + North Macedonia, Norway, Poland, Portugal, Puerto Rico, Romania, Serbia, + Slovakia, Slovenia, Spain, Sweden, Switzerland, Turkey, United Kingdom, + United States + ] + - Reforming Economies (R5): + description: Countries from the Reforming Economies of the Former Soviet Union + ar6: R5REF + ssp: R5.2REF + countries: [ + Armenia, Azerbaijan, Belarus, Georgia, Kazakhstan, Kyrgyzstan, Moldova, + Russian Federation, Tajikistan, Turkmenistan, Ukraine, Uzbekistan + ] + - Asia (R5): + description: The region includes Asian countries with the exception of + the Middle East, Japan and Former Soviet Union states + ar6: R5ASIA + ssp: R5.2ASIA + countries: [ + Afghanistan, Bangladesh, Bhutan, Brunei Darussalam, Cambodia, China, + Cook Islands, Fiji, French Polynesia, Hong Kong, India, Indonesia, Kiribati, + Laos, Macao, Malaysia, Maldives, Marshall Islands, Micronesia, Mongolia, + Myanmar, Nauru, Nepal, Niue, New Caledonia, North Korea, Pakistan, + Papua New Guinea, Palau, Philippines, South Korea, Samoa, Singapore, + Solomon Islands, Sri Lanka, Taiwan, Thailand, Timor-Leste, Tonga, Tuvalu, + Vanuatu, Viet Nam + ] + - Middle East & Africa (R5): + description: Countries of the Middle East and Africa + ar6: R5MAF + ssp: R5.2MAF + countries: [ + Algeria, Angola, Bahrain, Benin, Botswana, Burkina Faso, Burundi, + Cameroon, Cabo Verde, Central African Republic, Chad, Comoros, Congo, + Côte d'Ivoire, Democratic Republic of the Congo, Djibouti, Egypt, + Equatorial Guinea, Eritrea, Ethiopia, Gabon, Gambia, Ghana, Guinea, + Guinea-Bissau, Iran, Iraq, Israel, Jordan, Kenya, Kuwait, Lebanon, Lesotho, + Liberia, Libya, Madagascar, Malawi, Mali, Mauritania, Mauritius, Mayotte, + Morocco, Mozambique, Namibia, Niger, Nigeria, Palestine, Oman, Qatar, Rwanda, + Réunion, Sao Tome and Principe, Saudi Arabia, Senegal, Seychelles, + Sierra Leone, Somalia, South Africa, South Sudan, Sudan, Eswatini, + Syria, Togo, Tunisia, Uganda, United Arab Emirates, Tanzania, + Western Sahara, Yemen, Zambia, Zimbabwe + ] + - Latin America (R5): + description: Latin and South American countries + ar6: R5LAM + ssp: R5.2LAM + countries: [ + Antigua and Barbuda, Argentina, Aruba, Bahamas, Barbados, Belize, + Bolivia, Brazil, Chile, Colombia, Costa Rica, Cuba, Dominican Republic, + Ecuador, El Salvador, French Guiana, Grenada, Guadeloupe, Guatemala, + Guyana, Haiti, Honduras, Jamaica, Martinique, Mexico, Nicaragua, Panama, + Paraguay, Peru, Saint Kitts and Nevis, Saint Lucia, + Saint Vincent and the Grenadines, Suriname, Trinidad and Tobago, + United States Virgin Islands, Uruguay, Venezuela + ] + - Other (R5): + description: Rest of the World, to be used only if a match with the R5 regions + can otherwise not be achieved. + ar6: R5ROWO + ssp: diff --git a/definitions/region/model_native_regions/REMIND_3.2.yaml b/definitions/region/model_native_regions/REMIND_3.2.yaml index ef36d03a..16f39ee0 100644 --- a/definitions/region/model_native_regions/REMIND_3.2.yaml +++ b/definitions/region/model_native_regions/REMIND_3.2.yaml @@ -1,62 +1,66 @@ - REMIND 3.2: - REMIND 3.2|Canada, Australia, New Zealand: - iso3_codes: [AUS, CAN, HMD, NZL, SPM] + countries: [Australia, Canada, Heard Island and McDonald Islands, New Zealand, Saint Pierre and Miquelon] - REMIND 3.2|China and Taiwan: - iso3_codes: [CHN, HKG, MAC, TWN] + countries: [China, Hong Kong, Macao, Taiwan] - REMIND 3.2|India: - iso3_codes: IND + countries: [India] - REMIND 3.2|Japan: - iso3_codes: JPN + countries: [Japan] - REMIND 3.2|Other Asia: - iso3_codes: [AFG, ASM, ATF, BGD, BRN, BTN, CCK, COK, CXR, FJI, FSM, GUM, IDN, - IOT, KHM, KIR, KOR, LAO, LKA, MDV, MHL, MMR, MNG, MNP, MYS, NCL, NFK, NIU, - NPL, NRU, PAK, PCN, PHL, PLW, PNG, PRK, PYF, SGP, SLB, TKL, TLS, TON, THA, - TUV, UMI, VNM, VUT, WLF, WSM] + countries: [Afghanistan, American Samoa, French Southern Territories, Bangladesh, Brunei Darussalam, Bhutan, Cocos (Keeling) Islands, Cook Islands, Christmas Island, Fiji, Micronesia, Guam, Indonesia, + British Indian Ocean Territory, Cambodia, Kiribati, South Korea, Laos, Sri Lanka, Maldives, Marshall Islands, Myanmar, Mongolia, Northern Mariana Islands, Malaysia, New Caledonia, Norfolk Island, Niue, + Nepal, Nauru, Pakistan, Pitcairn, Philippines, Palau, Papua New Guinea, North Korea, French Polynesia, Singapore, Solomon Islands, Tokelau, Timor-Leste, Tonga, Thailand, + Tuvalu, United States Minor Outlying Islands, Viet Nam, Vanuatu, Wallis and Futuna, Samoa] - REMIND 3.2|Latin America and the Caribbean: - iso3_codes: [ABW, AIA, ARG, ATA, ATG, BES, BHS, BLM, BLZ, BMU, BOL, BRA, BRB, - BVT, CHL, COL, CRI, CUB, CYM, DMA, DOM, ECU, FLK, GLP, GRD, GTM, GUF, GUY, - HND, HTI, JAM, KNA, LCA, MAF, MEX, MSR, MTQ, NIC, PAN, PER, PRI, PRY, SGS, - SLV, SUR, TTO, URY, VCT, VEN, VGB, VIR, BES, CUW, SXM, TCA] + countries: [Aruba, Anguilla, Argentina, Antarctica, Antigua and Barbuda, Bahamas, Saint Barthélemy, Belize, Bermuda, Bolivia, Brazil, Barbados, + Bouvet Island, Chile, Colombia, Costa Rica, Cuba, Cayman Islands, Dominica, Dominican Republic, Ecuador, Falkland Islands (Malvinas), Guadeloupe, Grenada, Guatemala, French Guiana, Guyana, + Honduras, Haiti, Jamaica, Saint Kitts and Nevis, Saint Lucia, Saint Martin (French part), Mexico, Montserrat, Martinique, Nicaragua, Panama, Peru, Puerto Rico, Paraguay, South Georgia and the South Sandwich Islands, + El Salvador, Suriname, Trinidad and Tobago, Uruguay, Saint Vincent and the Grenadines, Venezuela, British Virgin Islands, United States Virgin Islands, "Bonaire, Sint Eustatius and Saba", Curaçao, Sint Maarten (Dutch part), Turks and Caicos Islands] - REMIND 3.2|Middle East and North Africa: - iso3_codes: [ARE, BHR, DZA, EGY, ESH, IRN, IRQ, ISR, JOR, KWT, LBN, LBY, MAR, - OMN, PSE, QAT, SAU, SDN, TUN, YEM, SYR] + countries: [United Arab Emirates, Bahrain, Algeria, Egypt, Western Sahara, Iran, Iraq, Israel, Jordan, Kuwait, Lebanon, Libya, Morocco, + Oman, Palestine, Qatar, Saudi Arabia, Sudan, Tunisia, Yemen, Syria] - REMIND 3.2|Russia and Reforming Economies: - iso3_codes: [ARM, AZE, BLR, GEO, KAZ, KGZ, MDA, RUS, TKM, UKR, UZB, TJK] + countries: [Armenia, Azerbaijan, Belarus, Georgia, Kazakhstan, Kyrgyzstan, Moldova, Russian Federation, Turkmenistan, Ukraine, Uzbekistan, Tajikistan] - REMIND 3.2|Sub-Saharan Africa: - iso3_codes: [AGO, BDI, BEN, BFA, BWA, CAF, CIV, CMR, COD, COG, COM, CPV, DJI, - ERI, ETH, GAB, GHA, GIN, GMB, GNB, GNQ, KEN, LBR, LSO, MDG, MLI, MOZ, MRT, - MUS, MWI, MYT, NAM, NER, NGA, REU, RWA, SEN, SHN, SLE, SOM, SSD, STP, SWZ, - SYC, TGO, TZA, UGA, ZAF, ZMB, ZWE, TCD] + countries: [Angola, Burundi, Benin, Burkina Faso, Botswana, Central African Republic, Côte d'Ivoire, Cameroon, Democratic Republic of the Congo, Congo, Comoros, Cabo Verde, Djibouti, + Eritrea, Ethiopia, Gabon, Ghana, Guinea, Gambia, Guinea-Bissau, Equatorial Guinea, Kenya, Liberia, Lesotho, Madagascar, Mali, Mozambique, Mauritania, + Mauritius, Malawi, Mayotte, Namibia, Niger, Nigeria, Réunion, Rwanda, Senegal, "Saint Helena, Ascension and Tristan da Cunha", Sierra Leone, Somalia, South Sudan, Sao Tome and Principe, Eswatini, + Seychelles, Togo, Tanzania, Uganda, South Africa, Zambia, Zimbabwe, Chad] - REMIND 3.2|United States: - iso3_codes: USA + countries: [United States] # 12-region version of REMIND - REMIND 3.2|EU 28: - iso3_codes: [ALA, AUT, BEL, BGR, CYP, CZE, DNK, ESP, EST, FIN, FRO, GGY, GIB, - GRC, HRV, HUN, IMN, IRL, ITA, JEY, LTU, LUX, LVA, MLT, NLD, POL, PRT, ROU, - SVK, SVN, SWE, FRA, DEU, ITA, GIB, GGY, GBR] + countries: [Åland Islands, Austria, Belgium, Bulgaria, Cyprus, Czechia, Denmark, Spain, Estonia, Finland, Faroe Islands, Guernsey, Gibraltar, + Greece, Croatia, Hungary, Isle of Man, Ireland, Italy, Jersey, Lithuania, Luxembourg, Latvia, Malta, Netherlands, Poland, Portugal, Romania, + Slovakia, Slovenia, Sweden, France, Germany, Italy, Gibraltar, Guernsey, United Kingdom] - REMIND 3.2|Non-EU28 Europe: - iso3_codes: [ALB, AND, BIH, CHE, GRL, ISL, LIE, MCO, MKD, MNE, NOR, SJM, SMR, - SRB, TUR, VAT] + countries: [Albania, Andorra, Bosnia and Herzegovina, Switzerland, Greenland, Iceland, Liechtenstein, Monaco, North Macedonia, Montenegro, Norway, Svalbard and Jan Mayen, San Marino, + Serbia, Turkey, Vatican] # 21-region version of REMIND - REMIND 3.2|Germany: - iso3_codes: DEU + countries: [Germany] - REMIND 3.2|France: - iso3_codes: FRA + countries: [France] - REMIND 3.2|United Kingdom and Ireland: - iso3_codes: [GIB, GGY, IRL, IMN, JEY, GBR] + countries: [Gibraltar, Guernsey, Ireland, Isle of Man, Jersey, United Kingdom] - REMIND 3.2|EU Center-East Europe: - iso3_codes: [CZE, EST, LVA, LTU, POL, SVK] + countries: [Czechia, Estonia, Latvia, Lithuania, Poland, Slovakia] - REMIND 3.2|EU Center-South Europe: - iso3_codes: [BGR, HRV, HUN, ROU, SVN] + countries: [Bulgaria, Croatia, Hungary, Romania, Slovenia] - REMIND 3.2|EU North-Center Europe: - iso3_codes: [ALA, DNK, FRO, FIN, SWE] + countries: [Åland Islands, Denmark, Faroe Islands, Finland, Sweden] - REMIND 3.2|EU South-Center Europe: - iso3_codes: [CYP, GRC, ITA, MLT] + countries: [Cyprus, Greece, Italy, Malta] - REMIND 3.2|EU South-West Europe: - iso3_codes: [PRT, ESP] + countries: [Portugal, Spain] - REMIND 3.2|EU North-West Europe: - iso3_codes: [AUT, BEL, LUX, NLD] + countries: [Austria, Belgium, Luxembourg, Netherlands] - REMIND 3.2|Non-EU Northern Europe: - iso3_codes: [ISL, LIE, NOR, SJM, CHE, GRL] + countries: [Iceland, Liechtenstein, Norway, Svalbard and Jan Mayen, Switzerland, Greenland] - REMIND 3.2|Non-EU Southern Europe: - iso3_codes: [ALB, AND, BIH, VAT, MKD, MCO, MNE, SMR, SRB, TUR] + countries: [Albania, Andorra, Bosnia and Herzegovina, Vatican, North Macedonia, Monaco, Montenegro, San Marino, Serbia, Turkey] +# exogenously aggregated regions + - REMIND 3.2|EU 27: + countries: [Åland Islands, Austria, Belgium, Bulgaria, Croatia, Cyprus, Czechia, Denmark, Estonia, Faroe Islands, Finland, France, Germany, Greece, + Hungary, Italy, Latvia, Lithuania, Luxembourg, Malta, Netherlands, Poland, Portugal, Romania, Slovakia, Slovenia, Spain, Sweden] diff --git a/definitions/region/model_native_regions/REMIND_3.3.yaml b/definitions/region/model_native_regions/REMIND_3.3.yaml index d6f5f9e4..026a343a 100644 --- a/definitions/region/model_native_regions/REMIND_3.3.yaml +++ b/definitions/region/model_native_regions/REMIND_3.3.yaml @@ -1,62 +1,62 @@ - REMIND 3.3: - REMIND 3.3|Canada, Australia, New Zealand: - iso3_codes: [AUS, CAN, HMD, NZL, SPM] + countries: [Australia, Canada, Heard Island and McDonald Islands, New Zealand, Saint Pierre and Miquelon] - REMIND 3.3|China and Taiwan: - iso3_codes: [CHN, HKG, MAC, TWN] + countries: [China, Hong Kong, Macao, Taiwan] - REMIND 3.3|India: - iso3_codes: IND + countries: [India] - REMIND 3.3|Japan: - iso3_codes: JPN + countries: [Japan] - REMIND 3.3|Other Asia: - iso3_codes: [AFG, ASM, ATF, BGD, BRN, BTN, CCK, COK, CXR, FJI, FSM, GUM, IDN, - IOT, KHM, KIR, KOR, LAO, LKA, MDV, MHL, MMR, MNG, MNP, MYS, NCL, NFK, NIU, - NPL, NRU, PAK, PCN, PHL, PLW, PNG, PRK, PYF, SGP, SLB, TKL, TLS, TON, THA, - TUV, UMI, VNM, VUT, WLF, WSM] + countries: [Afghanistan, American Samoa, French Southern Territories, Bangladesh, Brunei Darussalam, Bhutan, Cocos (Keeling) Islands, Cook Islands, Christmas Island, Fiji, Micronesia, Guam, Indonesia, + British Indian Ocean Territory, Cambodia, Kiribati, South Korea, Laos, Sri Lanka, Maldives, Marshall Islands, Myanmar, Mongolia, Northern Mariana Islands, Malaysia, New Caledonia, Norfolk Island, Niue, + Nepal, Nauru, Pakistan, Pitcairn, Philippines, Palau, Papua New Guinea, North Korea, French Polynesia, Singapore, Solomon Islands, Tokelau, Timor-Leste, Tonga, Thailand, + Tuvalu, United States Minor Outlying Islands, Viet Nam, Vanuatu, Wallis and Futuna, Samoa] - REMIND 3.3|Latin America and the Caribbean: - iso3_codes: [ABW, AIA, ARG, ATA, ATG, BES, BHS, BLM, BLZ, BMU, BOL, BRA, BRB, - BVT, CHL, COL, CRI, CUB, CYM, DMA, DOM, ECU, FLK, GLP, GRD, GTM, GUF, GUY, - HND, HTI, JAM, KNA, LCA, MAF, MEX, MSR, MTQ, NIC, PAN, PER, PRI, PRY, SGS, - SLV, SUR, TTO, URY, VCT, VEN, VGB, VIR, BES, CUW, SXM, TCA] + countries: [Aruba, Anguilla, Argentina, Antarctica, Antigua and Barbuda, Bahamas, Saint Barthélemy, Belize, Bermuda, Bolivia, Brazil, Barbados, + Bouvet Island, Chile, Colombia, Costa Rica, Cuba, Cayman Islands, Dominica, Dominican Republic, Ecuador, Falkland Islands (Malvinas), Guadeloupe, Grenada, Guatemala, French Guiana, Guyana, + Honduras, Haiti, Jamaica, Saint Kitts and Nevis, Saint Lucia, Saint Martin (French part), Mexico, Montserrat, Martinique, Nicaragua, Panama, Peru, Puerto Rico, Paraguay, South Georgia and the South Sandwich Islands, + El Salvador, Suriname, Trinidad and Tobago, Uruguay, Saint Vincent and the Grenadines, Venezuela, British Virgin Islands, United States Virgin Islands, "Bonaire, Sint Eustatius and Saba", Curaçao, Sint Maarten (Dutch part), Turks and Caicos Islands] - REMIND 3.3|Middle East and North Africa: - iso3_codes: [ARE, BHR, DZA, EGY, ESH, IRN, IRQ, ISR, JOR, KWT, LBN, LBY, MAR, - OMN, PSE, QAT, SAU, SDN, TUN, YEM, SYR] + countries: [United Arab Emirates, Bahrain, Algeria, Egypt, Western Sahara, Iran, Iraq, Israel, Jordan, Kuwait, Lebanon, Libya, Morocco, + Oman, Palestine, Qatar, Saudi Arabia, Sudan, Tunisia, Yemen, Syria] - REMIND 3.3|Russia and Reforming Economies: - iso3_codes: [ARM, AZE, BLR, GEO, KAZ, KGZ, MDA, RUS, TKM, UKR, UZB, TJK] + countries: [Armenia, Azerbaijan, Belarus, Georgia, Kazakhstan, Kyrgyzstan, Moldova, Russian Federation, Turkmenistan, Ukraine, Uzbekistan, Tajikistan] - REMIND 3.3|Sub-Saharan Africa: - iso3_codes: [AGO, BDI, BEN, BFA, BWA, CAF, CIV, CMR, COD, COG, COM, CPV, DJI, - ERI, ETH, GAB, GHA, GIN, GMB, GNB, GNQ, KEN, LBR, LSO, MDG, MLI, MOZ, MRT, - MUS, MWI, MYT, NAM, NER, NGA, REU, RWA, SEN, SHN, SLE, SOM, SSD, STP, SWZ, - SYC, TGO, TZA, UGA, ZAF, ZMB, ZWE, TCD] + countries: [Angola, Burundi, Benin, Burkina Faso, Botswana, Central African Republic, Côte d'Ivoire, Cameroon, Democratic Republic of the Congo, Congo, Comoros, Cabo Verde, Djibouti, + Eritrea, Ethiopia, Gabon, Ghana, Guinea, Gambia, Guinea-Bissau, Equatorial Guinea, Kenya, Liberia, Lesotho, Madagascar, Mali, Mozambique, Mauritania, + Mauritius, Malawi, Mayotte, Namibia, Niger, Nigeria, Réunion, Rwanda, Senegal, "Saint Helena, Ascension and Tristan da Cunha", Sierra Leone, Somalia, South Sudan, Sao Tome and Principe, Eswatini, + Seychelles, Togo, Tanzania, Uganda, South Africa, Zambia, Zimbabwe, Chad] - REMIND 3.3|United States: - iso3_codes: USA + countries: [United States] # 12-region version of REMIND - REMIND 3.3|EU 28: - iso3_codes: [ALA, AUT, BEL, BGR, CYP, CZE, DNK, ESP, EST, FIN, FRO, GGY, GIB, - GRC, HRV, HUN, IMN, IRL, ITA, JEY, LTU, LUX, LVA, MLT, NLD, POL, PRT, ROU, - SVK, SVN, SWE, FRA, DEU, ITA, GIB, GGY, GBR] + countries: [Åland Islands, Austria, Belgium, Bulgaria, Cyprus, Czechia, Denmark, Spain, Estonia, Finland, Faroe Islands, Guernsey, Gibraltar, + Greece, Croatia, Hungary, Isle of Man, Ireland, Italy, Jersey, Lithuania, Luxembourg, Latvia, Malta, Netherlands, Poland, Portugal, Romania, + Slovakia, Slovenia, Sweden, France, Germany, Italy, Gibraltar, Guernsey, United Kingdom] - REMIND 3.3|Non-EU28 Europe: - iso3_codes: [ALB, AND, BIH, CHE, GRL, ISL, LIE, MCO, MKD, MNE, NOR, SJM, SMR, - SRB, TUR, VAT] + countries: [Albania, Andorra, Bosnia and Herzegovina, Switzerland, Greenland, Iceland, Liechtenstein, Monaco, North Macedonia, Montenegro, Norway, Svalbard and Jan Mayen, San Marino, + Serbia, Turkey, Vatican] # 21-region version of REMIND - REMIND 3.3|Germany: - iso3_codes: DEU + countries: [Germany] - REMIND 3.3|France: - iso3_codes: FRA + countries: [France] - REMIND 3.3|United Kingdom and Ireland: - iso3_codes: [GIB, GGY, IRL, IMN, JEY, GBR] + countries: [Gibraltar, Guernsey, Ireland, Isle of Man, Jersey, United Kingdom] - REMIND 3.3|EU Center-East Europe: - iso3_codes: [CZE, EST, LVA, LTU, POL, SVK] + countries: [Czechia, Estonia, Latvia, Lithuania, Poland, Slovakia] - REMIND 3.3|EU Center-South Europe: - iso3_codes: [BGR, HRV, HUN, ROU, SVN] + countries: [Bulgaria, Croatia, Hungary, Romania, Slovenia] - REMIND 3.3|EU North-Center Europe: - iso3_codes: [ALA, DNK, FRO, FIN, SWE] + countries: [Åland Islands, Denmark, Faroe Islands, Finland, Sweden] - REMIND 3.3|EU South-Center Europe: - iso3_codes: [CYP, GRC, ITA, MLT] + countries: [Cyprus, Greece, Italy, Malta] - REMIND 3.3|EU South-West Europe: - iso3_codes: [PRT, ESP] + countries: [Portugal, Spain] - REMIND 3.3|EU North-West Europe: - iso3_codes: [AUT, BEL, LUX, NLD] + countries: [Austria, Belgium, Luxembourg, Netherlands] - REMIND 3.3|Non-EU Northern Europe: - iso3_codes: [ISL, LIE, NOR, SJM, CHE, GRL] + countries: [Iceland, Liechtenstein, Norway, Svalbard and Jan Mayen, Switzerland, Greenland] - REMIND 3.3|Non-EU Southern Europe: - iso3_codes: [ALB, AND, BIH, VAT, MKD, MCO, MNE, SMR, SRB, TUR] + countries: [Albania, Andorra, Bosnia and Herzegovina, Vatican, North Macedonia, Monaco, Montenegro, San Marino, Serbia, Turkey] diff --git a/definitions/region/model_native_regions/prometheus_1.2.yaml b/definitions/region/model_native_regions/prometheus_1.2.yaml index 16ef2aa9..e8644a9d 100644 --- a/definitions/region/model_native_regions/prometheus_1.2.yaml +++ b/definitions/region/model_native_regions/prometheus_1.2.yaml @@ -1,11 +1,11 @@ - PROMETHEUS 1.2: - PROMETHEUS 1.2|Western Europe: - countries: Austria, Belgium, Denmark, Faeroe Islands, Finland, France, Germany, + countries: [ Austria, Belgium, Denmark, Faroe Islands, Finland, France, Germany, Gibraltar, Greece, Iceland, Ireland, Italy, Liechtenstein, Luxembourg, Monaco, Netherlands, Norway, Portugal, San Marino, Spain, Sweden, Switzerland, - United Kingdom, + United Kingdom ] - PROMETHEUS 1.2|Central Europe: - countries: Bulgaria, Croatia, Cyprus, Czech Republic, Estonia, Hungary, Latvia, - Lithuania, Malta, Poland, Romania, Slovak Republic, Slovenia + countries: [ Bulgaria, Croatia, Cyprus, Czechia, Estonia, Hungary, Latvia, + Lithuania, Malta, Poland, Romania, Slovakia, Slovenia ] - PROMETHEUS 1.2|North America: - countries: Canada, USA + countries: [ Canada, United States ] diff --git a/setup.cfg b/setup.cfg index b622f2c2..07944ca8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -13,7 +13,7 @@ packages = openentrance install_requires = setuptools >= 41 pyyaml - nomenclature-iamc >= 0.16.0, < 0.17.0 + nomenclature-iamc >= 0.19.0 iam-units >= 2021.11.12 setup_requires = setuptools >= 41 diff --git a/workflow.py b/workflow.py index f7775a41..97d7c9f8 100755 --- a/workflow.py +++ b/workflow.py @@ -3,17 +3,20 @@ import pyam from nomenclature import DataStructureDefinition, RegionProcessor, process from nomenclature.codelist import RegionCode +from datetime import datetime, timedelta here = Path(__file__).absolute().parent logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) -from datetime import datetime, timedelta # datetime must be in Central European Time (CET) EXP_TZ = "UTC+01:00" EXP_TIME_OFFSET = timedelta(seconds=3600) -OE_SUBANNUAL_FORMAT = lambda x: x.strftime("%m-%d %H:%M%z").replace("+0100", "+01:00") + + +def oe_subannual_format(x): + return x.strftime("%m-%d %H:%M%z").replace("+0100", "+01:00") def main(df: pyam.IamDataFrame, dimensions=["region", "variable"]) -> pyam.IamDataFrame: @@ -54,7 +57,7 @@ def main(df: pyam.IamDataFrame, dimensions=["region", "variable"]) -> pyam.IamDa # convert to subannual format if data provided in datetime format if df.time_col == "time": logger.info('Re-casting from "time" column to categorical "subannual" format') - df = df.swap_time_for_year(subannual=OE_SUBANNUAL_FORMAT) + df = df.swap_time_for_year(subannual=oe_subannual_format) # check that any datetime-like items in "subannual" are valid datetime and UTC+01:00 if "subannual" in df.dimensions: