Bläddra i källkod

[DATALAD] Recorded changes

Daniel Busch 2 veckor sedan
förälder
incheckning
eb76af36f1

+ 1 - 1
extracted_data/v2024-11-14/FAOSTAT_Agrifood_system_emissions_v2024-11-14.csv

@@ -1 +1 @@
-../../.git/annex/objects/5G/fW/MD5E-s10458235--62c6d808ca90338e6bff7e3b6dfa402a.csv/MD5E-s10458235--62c6d808ca90338e6bff7e3b6dfa402a.csv
+../../.git/annex/objects/WG/0z/MD5E-s10463749--5e57717e09254e6fce7fae3c8b7b1b62.csv/MD5E-s10463749--5e57717e09254e6fce7fae3c8b7b1b62.csv

+ 1 - 1
extracted_data/v2024-11-14/FAOSTAT_Agrifood_system_emissions_v2024-11-14.nc

@@ -1 +1 @@
-../../.git/annex/objects/xj/QG/MD5E-s3288277--bc9454347dd91ba244c5b88e274f557a.nc/MD5E-s3288277--bc9454347dd91ba244c5b88e274f557a.nc
+../../.git/annex/objects/1Z/KQ/MD5E-s3323376--f9ad6998eb9c5696dc229c8fb443ce83.nc/MD5E-s3323376--f9ad6998eb9c5696dc229c8fb443ce83.nc

+ 33 - 14
tests/unit/test_conversion.py

@@ -26,11 +26,24 @@ def test_conversion_from_FAO_to_IPCC2006_PRIMAP():
         / "v2024-11-14/FAOSTAT_Agrifood_system_emissions_v2024-11-14_raw.nc"
     )
     ds = pm2.open_dataset(ds_fao)
-
+    # consistency check in original categorisation
     # drop UNFCCC data
     ds = ds.drop_sel(source="UNFCCC")
 
     # We need a comversion CSV file for each entity
+    # agg_info_fao = {
+    #     "category (FAOSTAT)" : {
+    #         "4" : {
+    #             "sources" : [
+    #                 "4.A",
+    #                 "4.B",
+    #             ],
+    #             "sel": {"variable": ["CO2"]},
+    #         },
+    #     }
+    # }
+    # ds_checked = ds.pr.add_aggregates_coordinates(agg_info=agg_info_fao)
+
     # That's a temporary workaround until convert function can filter for data variables (entities)
     conv = {}
     gases = ["CO2", "CH4", "N2O"]
@@ -61,11 +74,12 @@ def test_conversion_from_FAO_to_IPCC2006_PRIMAP():
             },
             "M.3.C.AG": {
                 "sources": [
-                    "3.C.1.b",
-                    "3.C.1.c",
-                    "3.C.4",
-                    "3.C.5",
-                ],  # savanna, cropland fires
+                    "3.C.1.b",  # Biomass Burning In Croplands
+                    "3.C.1.c",  # Biomass Burning in Grasslands
+                    "3.C.4",  # Direct N2O Emissions from Managed Soils
+                    "3.C.5",  # Indirect N2O Emissions from Managed Soils
+                    "3.C.6",  # Indirect N2O Emissions from Manure Management
+                ],
             },
             "M.AG.ELV": {
                 "sources": ["M.3.C.AG"],  # "M.3.D.AG" is zero
@@ -126,7 +140,12 @@ def test_conversion_from_FAO_to_IPCC2006_PRIMAP():
             # "M.3.D.LU": {"sources": ["3.D.1"]},
             # For LULUCF Forest Land, Cropland, Grassland, is all we have
             "M.LULUCF": {
-                "sources": ["3.B.1", "3.B.2", "3.B.3", "3.C.1.a"]
+                "sources": [
+                    "3.B.1",  # Carbon stock change in forests
+                    "3.B.2",  # Drained grassland
+                    "3.B.3",  # Drained cropland
+                    "3.C.1.a",  # Biomass Burning In Forests
+                ]
             },  # forest fires
             "3": {"sources": ["M.AG", "M.LULUCF"]},
         }
@@ -160,13 +179,13 @@ def test_conversion_from_FAO_to_IPCC2006_PRIMAP():
 
 def test_read(tmp_path):
     domains_and_releases_to_read = [
-        ("farm_gate_agriculture_energy", "2024-11-14"),
-        ("farm_gate_emissions_crops", "2024-11-14"),
-        ("farm_gate_livestock", "2024-11-14"),
-        ("land_use_drained_organic_soils", "2024-11-14"),
-        ("land_use_fires", "2024-11-14"),
-        ("land_use_forests", "2024-11-14"),
-        ("pre_post_agricultural_production", "2024-11-14"),
+        # ("farm_gate_agriculture_energy", "2024-11-14"),
+        # ("farm_gate_emissions_crops", "2024-11-14"),
+        # ("farm_gate_livestock", "2024-11-14"),
+        # ("land_use_drained_organic_soils", "2024-11-14"),
+        ("land_use_fires", "2023-11-09"),
+        # ("land_use_forests", "2024-11-14"),
+        # ("pre_post_agricultural_production", "2024-11-14"),
     ]
 
     read_data(