Browse Source

Fix bug in DI reading from zenodo

Johannes Gütschow 1 year ago
parent
commit
1231578980

+ 2 - 1
UNFCCC_GHG_data/UNFCCC_DI_reader/UNFCCC_DI_reader_core.py

@@ -294,6 +294,7 @@ def read_UNFCCC_DI_for_country_df_zenodo(
     reader = unfccc_di_api.ZenodoReader()
 
     di_data = reader.query(party_code=country_code)
+
     # remove the "no_gas" data
     di_data = di_data[di_data["gas"] != "No gas"]
 
@@ -301,7 +302,7 @@ def read_UNFCCC_DI_for_country_df_zenodo(
         di_data = di_data[di_data["category"].isin(category_groups)]
 
     # if data has been collected print some information and save the data
-    if di_data is None:
+    if di_data is None or len(di_data) == 0:
         raise ValueError(f"No data collected for country {country_code} and category "
                          f"groups "
                          f"{category_groups}")

+ 2 - 0
extracted_data/UNFCCC/folder_mapping.json

@@ -28,6 +28,7 @@
     "QAT": "Qatar",
     "NAM": "Namibia",
     "MLT": "Malta",
+    "SVN": "Slovenia",
     "BGR": "Bulgaria",
     "CZE": "Czechia",
     "PHL": "Philippines",
@@ -140,6 +141,7 @@
     "NRU": "Nauru",
     "GTM": "Guatemala",
     "COD": "Congo,_The_Democratic_Republic_of_the",
+    "COG": "Congo",
     "GAB": "Gabon",
     "SYC": "Seychelles",
     "NIC": "Nicaragua",