Browse Source

[DATALAD] Recorded changes

Daniel Busch 1 month ago
parent
commit
ab7e05e335

+ 3 - 3
conv_FAO_IPPCC2006_PRIMAP_CO2.csv

@@ -3,9 +3,9 @@
 FAO,IPCC2006_PRIMAP,comment
 4,3.B.1,Carbon stock change in forests
 4.B,M.NFC,Net Forest conversion
-5.A,3.B.3,Drained grassland
-5.B,3.B.2,Drained cropland
+5.A,3.B.3,FAO 5.A Drained grassland to IPCC 3.B.3 Grassland
+5.B,M.3.B.2.DOS,FAO 5.B Drained cropland to IPCC 3.B.2 Cropland (drained organic soils)
 6.A,3.C.1.a, FAO 6.A forest fires to IPCC 3.C.1.a Biomass burning in forest lands
 6.B, 3.C.1.c, FAO 6.B savanna fires to IPCC 3.C.1.c Biomass burning in grasslands
-6.C, 3.C.1.b, FAO 6.C Fires in organic soils to IPCC 3.C.1.b Biomass Burning In Croplands
+6.C, M.3.B.2.FOS, FAO 6.C Fires in organic soils to IPCC 3.B.3 cropland (fires in organic soils)
 7.M + 7.A, 2.G, Manufacturing fertlisers and pesticides

+ 1 - 1
conv_FAO_IPPCC2006_PRIMAP_N2O.csv

@@ -6,7 +6,7 @@ M.3.MM, 3.A.2, Manure management
 M.3.MP + M.3.MA + M.1.CR, 3.C.4
 1.B.1,M.3.C.4.SF,Better to map indivudually in case it covers different range of years
 1.B.2.a + 1.B.2.b,M.3.C.5.SF,Better to map individually in case it covers different range of years
-5.A,3.B.3,Drained grassland
+5.A,3.B.3,FAO 5.A Drained grassland to IPCC 3.B.3 Grassland
 5.B,3.B.2,Drained cropland
 6.A,3.C.1.a, FAO 6.A forest fires to IPCC 3.C.1.a Biomass burning in forest lands
 6.B, 3.C.1.c, FAO 6.B savanna fires to IPCC 3.C.1.c Biomass burning in grasslands

+ 1 - 1
extracted_data/v2023-12-13/FAOSTAT_Agrifood_system_emissions_v2023-12-13.csv

@@ -1 +1 @@
-../../.git/annex/objects/X3/xx/MD5E-s5982112--6d968cecd8f39c3d537ea0b6de011f94.csv/MD5E-s5982112--6d968cecd8f39c3d537ea0b6de011f94.csv
+../../.git/annex/objects/z3/Mq/MD5E-s5980799--3043dd6bf8a609e041a5243794bcc826.csv/MD5E-s5980799--3043dd6bf8a609e041a5243794bcc826.csv

+ 1 - 1
extracted_data/v2023-12-13/FAOSTAT_Agrifood_system_emissions_v2023-12-13.nc

@@ -1 +1 @@
-../../.git/annex/objects/9m/KJ/MD5E-s1887931--11354706000e8ef7c8c5e643f060f5e5.nc/MD5E-s1887931--11354706000e8ef7c8c5e643f060f5e5.nc
+../../.git/annex/objects/9g/Ff/MD5E-s1859181--f564c003c41b542bb3520e9151f85e16.nc/MD5E-s1859181--f564c003c41b542bb3520e9151f85e16.nc

+ 1 - 1
extracted_data/v2023-12-13/FAOSTAT_Agrifood_system_emissions_v2023-12-13_raw.csv

@@ -1 +1 @@
-../../.git/annex/objects/mf/w8/MD5E-s34004864--ee0bfaa28c0839ef173253af63c6b3fb.csv/MD5E-s34004864--ee0bfaa28c0839ef173253af63c6b3fb.csv
+../../.git/annex/objects/6W/6g/MD5E-s34171577--9f7391b62123e300849ff4df4b8ea8bf.csv/MD5E-s34171577--9f7391b62123e300849ff4df4b8ea8bf.csv

+ 1 - 1
extracted_data/v2023-12-13/FAOSTAT_Agrifood_system_emissions_v2023-12-13_raw.nc

@@ -1 +1 @@
-../../.git/annex/objects/zg/fG/MD5E-s14095580--cb5d17687b666c68adb063acc8dba832.nc/MD5E-s14095580--cb5d17687b666c68adb063acc8dba832.nc
+../../.git/annex/objects/20/P0/MD5E-s14450580--2e044a03684998487ff734df894273c1.nc/MD5E-s14450580--2e044a03684998487ff734df894273c1.nc

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

@@ -0,0 +1 @@
+../../.git/annex/objects/4m/5w/MD5E-s6104711--3aa09937e311620fd1a6e5f32e845935.csv/MD5E-s6104711--3aa09937e311620fd1a6e5f32e845935.csv

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

@@ -0,0 +1 @@
+../../.git/annex/objects/V7/Q8/MD5E-s1885319--34b97929ef46e16f92251c442368df1c.nc/MD5E-s1885319--34b97929ef46e16f92251c442368df1c.nc

+ 23 - 0
extracted_data/v2024-11-14/FAOSTAT_Agrifood_system_emissions_v2024-11-14.yaml

@@ -0,0 +1,23 @@
+attrs:
+  area: area (ISO3)
+  cat: category (IPCC2006_PRIMAP)
+  comment: Published by Food and Agriculture Organization of the United Nations (FAO),
+    converted to PRIMAP2 format by Daniel Busch
+  contact: daniel.busch@climate-resource.com
+  entity: N2O
+  institution: Food and Agriculture Organization of the United Nations
+  references: https://www.fao.org/faostat
+  rights: Creative Commons Attribution-4.0 International licence (CC BY 4.0)
+  scen: scenario (FAO)
+  title: Agrifood systems emissions
+data_file: FAOSTAT_Agrifood_system_emissions_v2024-11-14.csv
+dimensions:
+  '*':
+  - area (ISO3)
+  - category (IPCC2006_PRIMAP)
+  - entity
+  - scenario (FAO)
+  - source
+  - time
+  - unit
+time_format: '%Y'

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

@@ -1 +1 @@
-../../.git/annex/objects/FK/5f/MD5E-s15105589--f8ffeab6ace6ff5a8e94995dffdb206b.nc/MD5E-s15105589--f8ffeab6ace6ff5a8e94995dffdb206b.nc
+../../.git/annex/objects/Zm/QM/MD5E-s15105077--c6b011fcb6728c549b85b749f175e1cb.nc/MD5E-s15105077--c6b011fcb6728c549b85b749f175e1cb.nc

+ 4 - 4
poetry.lock

@@ -591,13 +591,13 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""}
 
 [[package]]
 name = "climate-categories"
-version = "0.10.5"
+version = "0.10.6"
 description = "Commonly used codes, categories, terminologies, and nomenclatures used in climate policy analysis as a Python package."
 optional = false
 python-versions = "<3.14,>=3.11"
 files = [
-    {file = "climate_categories-0.10.5-py3-none-any.whl", hash = "sha256:8a887c912e51b8c92a54d45f840ec5a1f94a73b89e211c2e793021ea2593d0ea"},
-    {file = "climate_categories-0.10.5.tar.gz", hash = "sha256:c97cec39ed838952d147a93b973d82ab0f14dda60459d2852863dd0a1a2f3edf"},
+    {file = "climate_categories-0.10.6-py3-none-any.whl", hash = "sha256:b96fd50c9d484aacbbb2a9a94e14e47e950c0ae11de0604f355a8590e31f4005"},
+    {file = "climate_categories-0.10.6.tar.gz", hash = "sha256:4b12dac466691b977c9a7fc324663e38c37b3a2643a41543c1eecc2307c49ef0"},
 ]
 
 [package.dependencies]
@@ -5354,4 +5354,4 @@ type = ["pytest-mypy"]
 [metadata]
 lock-version = "2.0"
 python-versions = ">=3.11,<3.13"
-content-hash = "4bb04843483f277afb8e1c00d89e9f7970b596ff3ff93accfa394192a3e4b5d3"
+content-hash = "49ecf834cde076e33ff5fd9b3aff9a20d09b4f24e0bf2fdbe97fba1c3fb81b73"

+ 0 - 1
pyproject.toml

@@ -23,7 +23,6 @@ doit = "^0.36.0"
 xarray = "^2024.11.0"
 jupytext = "^1.16.5"
 jupyter = "^1.1.1"
-climate-categories = "^0.10.5"
 primap2 = "^0.12.1"
 
 

+ 3 - 3
requirements.txt

@@ -268,9 +268,9 @@ charset-normalizer==3.4.0 ; python_version >= "3.11" and python_version < "3.13"
 click==8.1.7 ; python_version >= "3.11" and python_version < "3.13" \
     --hash=sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28 \
     --hash=sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de
-climate-categories==0.10.5 ; python_version >= "3.11" and python_version < "3.13" \
-    --hash=sha256:8a887c912e51b8c92a54d45f840ec5a1f94a73b89e211c2e793021ea2593d0ea \
-    --hash=sha256:c97cec39ed838952d147a93b973d82ab0f14dda60459d2852863dd0a1a2f3edf
+climate-categories==0.10.6 ; python_version >= "3.11" and python_version < "3.13" \
+    --hash=sha256:4b12dac466691b977c9a7fc324663e38c37b3a2643a41543c1eecc2307c49ef0 \
+    --hash=sha256:b96fd50c9d484aacbbb2a9a94e14e47e950c0ae11de0604f355a8590e31f4005
 cloudpickle==3.1.0 ; python_version >= "3.11" and python_version < "3.13" \
     --hash=sha256:81a929b6e3c7335c863c771d673d105f02efdb89dfaba0c90495d1c64796601b \
     --hash=sha256:fe11acda67f61aaaec473e3afe030feb131d78a43461b718185363384f1ba12e

+ 4 - 5
src/faostat_data_primap/helper/category_aggregation.py

@@ -205,7 +205,7 @@ agg_info_fao = {
         },
         "1.A": {
             # crops
-            "tolerance": 0.5,
+            "tolerance": 1,
             "sources": [
                 "1.A.1",
                 "1.A.2",
@@ -520,10 +520,9 @@ agg_info_ipcc2006_primap_CO2 = {
         "M.LULUCF": {
             "sources": [
                 "3.B.1",  # Carbon stock change in forests (FAO 4, or 4.A and 4.B)
-                "3.B.2",  # Drained grassland
-                "3.B.3",  # Drained cropland
-                # "3.C.1.a",  # Biomass Burning In Forests
-                "3.C.1.b",  # Fires in organic soils
+                "M.3.B.2.DOS",  # crop land - drained organic soils
+                "M.3.B.2.FOS",  # crop land - fires in organic soils
+                "3.B.3",  # grass land
             ],
             "sel": {"variable": ["CO2"]},
         },

+ 12 - 12
tests/unit/test_conversion.py

@@ -35,18 +35,18 @@ def test_processed_output_remains_the_same():
 @pytest.mark.parametrize(
     "domains_and_releases_to_read",
     [
-        # pytest.param(
-        #     [
-        #         ("farm_gate_agriculture_energy", "2023-12-13"),
-        #         ("farm_gate_emissions_crops", "2023-11-09"),
-        #         ("farm_gate_livestock", "2023-11-09"),
-        #         ("land_use_drained_organic_soils", "2023-11-09"),
-        #         ("land_use_fires", "2023-11-09"),
-        #         ("land_use_forests", "2023-11-09"),
-        #         ("pre_post_agricultural_production", "2023-11-09"),
-        #     ],
-        #     id="2023 release",
-        # ),
+        pytest.param(
+            [
+                ("farm_gate_agriculture_energy", "2023-12-13"),
+                ("farm_gate_emissions_crops", "2023-11-09"),
+                ("farm_gate_livestock", "2023-11-09"),
+                ("land_use_drained_organic_soils", "2023-11-09"),
+                ("land_use_fires", "2023-11-09"),
+                ("land_use_forests", "2023-11-09"),
+                ("pre_post_agricultural_production", "2023-11-09"),
+            ],
+            id="2023 release",
+        ),
         pytest.param(
             [
                 ("farm_gate_agriculture_energy", "2024-11-14"),