Browse Source

sector tables complete

Daniel Busch 6 months ago
parent
commit
4f632f6c13

+ 53 - 2
src/unfccc_ghg_data/unfccc_reader/Saint_Kitts_and_Nevis/config_kna_bur1.py

@@ -1,5 +1,18 @@
 """
 Configuration file to read Saint Kitts and Nevis' BUR 1.
+
+Tables to read:
+- The sector tables in the Annex from page 149
+- trend tables page 111-113
+- page 117
+- page 118
+- page 119
+- page 121
+- page 124
+
+Not reading:
+- page 97 - trend table with data for 2008, because it's in the trend tables from page 111
+- page 113 - slice of trend table on page 111
 """
 
 gwp_to_use = "AR5GWP100"
@@ -29,6 +42,9 @@ coords_value_mapping = {
     "category": "PRIMAP1",
     "entity": {
         "NMVOCs": "NMVOC",
+        "HFCS": f"HFCS ({gwp_to_use})",
+        "PFCS": f"PFCS ({gwp_to_use})",
+        "SF6": f"SF6 ({gwp_to_use})",
         "Other halogenated gases with CO2 equivalent conversion factors (1)": f"UnspMixOfHFCs ({gwp_to_use})",
     },
 }
@@ -44,8 +60,8 @@ meta_data = {
 
 filter_remove = {
     "f_memo": {"category": "MEMO"},
-    "f_HFCS": {
-        "category": "Other halogenated gases without CO2 equivalent conversion factors (2)"
+    "f1": {
+        "entity": "Other halogenated gases without CO2 equivalent conversion factors (2)"
     },
 }
 
@@ -55,6 +71,7 @@ conf_general = {
 
 conf = {
     "energy": {
+        # TODO: List of entities are always keys of unit mapping dict
         "entities": ["CO2", "CH4", "N2O", "NOX", "CO", "NMVOCs", "SO2"],
         "header": ["orig_category"],
         "cat_codes_manual": {
@@ -161,4 +178,38 @@ conf = {
             "NMVOC": "Gg",
         },
     },
+    "waste": {
+        "entities": [
+            "CO2",
+            "CH4",
+            "N2O",
+            "NOX",
+            "CO",
+            "NMVOC",
+            "SO2",
+        ],
+        "header": ["orig_category"],
+        "cat_codes_manual": {
+            "Information Items": "MEMO",
+            "CO2 from Biomass Combustion for Energy Production": "MBIO",
+        },
+        "page_defs": {
+            "159": {"skip_rows_start": 2},
+        },
+        "replace_data_entries": {
+            "NO,NA": "NO",
+            "NO,NE": "NO",
+            "NE,NO": "NO",
+            "NO,IE": "NO",
+        },
+        "unit_mapping": {
+            "CO2": "Gg",
+            "CH4": "Gg",
+            "N2O": "Gg",
+            "NOX": "Gg",
+            "CO": "Gg",
+            "NMVOC": "Gg",
+            "SO2": "Gg",
+        },
+    },
 }

+ 6 - 1
src/unfccc_ghg_data/unfccc_reader/Saint_Kitts_and_Nevis/read_KNA_BUR1_from_pdf.py

@@ -60,7 +60,8 @@ if __name__ == "__main__":
                 df_page = df_page[skip_rows_start:]
 
             if df_sector is None:
-                df_sector = df_page
+                # Reset index to avoid pandas' SettingWithCopyWarning
+                df_sector = df_page.reset_index(drop=True)
             else:
                 df_sector = pd.concat(
                     [
@@ -143,4 +144,8 @@ if __name__ == "__main__":
         time_format="%Y",
     )
 
+    ### convert to primap2 format ###
+    print("Converting to primap2 format.")
+    data_main_pm2 = pm2.pm2io.from_interchange_format(df_main_IF)
+
     pass