Browse Source

[DATALAD RUNCMD] Process DI data for non-AnnexI for date latest

=== Do not change lines below ===
{
 "chain": [],
 "cmd": "./venv/bin/python3 UNFCCC_GHG_data/UNFCCC_DI_reader/process_UNFCCC_DI_for_country_group.py ",
 "dsid": "4d062170-604c-4efd-afbf-5ce7f97e0e63",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
Johannes Gütschow 1 năm trước cách đây
mục cha
commit
337e37176c

+ 9 - 8
UNFCCC_GHG_data/helper/functions.py

@@ -128,19 +128,20 @@ def process_data_for_country(
         # subtract categories
         if 'subtract_cats' in processing_info_country:
             subtract_cats_current = processing_info_country['subtract_cats']
-            if 'entities' in subtract_cats_current.keys():
-                entities_current = subtract_cats_current['entities']
-            else:
-                entities_current = list(data_country.data_vars)
-            print(f"Subtracting categories for country {country_code}, entities "
-                  f"{entities_current}")
+            print(f"Subtracting categories for country {country_code}")
             for cat_to_generate in subtract_cats_current:
+                if 'entities' in subtract_cats_current[cat_to_generate].keys():
+                    entities_current = subtract_cats_current[cat_to_generate]['entities']
+                else:
+                    entities_current = list(data_country.data_vars)
+
                 cats_to_subtract = \
                     subtract_cats_current[cat_to_generate]['subtract']
                 data_sub = \
-                    data_country.pr.loc[{'category': cats_to_subtract}].pr.sum(
+                    data_country[entities_current].pr.loc[
+                        {'category': cats_to_subtract}].pr.sum(
                         dim='category', skipna=True, min_count=1)
-                data_parent = data_country.pr.loc[
+                data_parent = data_country[entities_current].pr.loc[
                     {'category': subtract_cats_current[cat_to_generate]['parent']}]
                 data_agg = data_parent - data_sub
                 nan_vars = [var for var in data_agg.data_vars if

+ 1 - 0
datasets/UNFCCC/DI_non_AnnexI/DI_non_AnnexI_2023-07-18.csv

@@ -0,0 +1 @@
+DI_non_AnnexI_9177e6b829bcfcd93505d1355cae9ee4_hash.csv

+ 1 - 0
datasets/UNFCCC/DI_non_AnnexI/DI_non_AnnexI_2023-07-18.nc

@@ -0,0 +1 @@
+DI_non_AnnexI_9177e6b829bcfcd93505d1355cae9ee4_hash.nc

+ 1 - 0
datasets/UNFCCC/DI_non_AnnexI/DI_non_AnnexI_2023-07-18.yaml

@@ -0,0 +1 @@
+DI_non_AnnexI_9177e6b829bcfcd93505d1355cae9ee4_hash.yaml

+ 1 - 0
datasets/UNFCCC/DI_non_AnnexI/DI_non_AnnexI_9177e6b829bcfcd93505d1355cae9ee4_hash.csv

@@ -0,0 +1 @@
+../../../.git/annex/objects/j4/q5/MD5E-s15068741--c3b05d7248ef0abdec923319d1780e08.csv/MD5E-s15068741--c3b05d7248ef0abdec923319d1780e08.csv

+ 1 - 0
datasets/UNFCCC/DI_non_AnnexI/DI_non_AnnexI_9177e6b829bcfcd93505d1355cae9ee4_hash.nc

@@ -0,0 +1 @@
+../../../.git/annex/objects/80/vg/MD5E-s5743047--58b8cb2cd448f29c5bc8669cf5e5f239.nc/MD5E-s5743047--58b8cb2cd448f29c5bc8669cf5e5f239.nc

+ 41 - 0
datasets/UNFCCC/DI_non_AnnexI/DI_non_AnnexI_9177e6b829bcfcd93505d1355cae9ee4_hash.yaml

@@ -0,0 +1,41 @@
+attrs:
+  references: https://di.unfccc.int
+  rights: ''
+  contact: mail@johannes-guetschow.de
+  institution: United Nations Framework Convention on Climate Change (www.unfccc.int)
+  cat: category (IPCC2006_PRIMAP)
+  area: area (ISO3)
+  scen: scenario (Process_Date)
+  sec_cats:
+  - class
+  - measure
+  comment: Data read from the UNFCCC DI flexible query interface using the API. Data
+    read on 2023-05-24. Processed on 2023-07-18
+  title: 'Data submitted by the following non-AnnexI countries and available in the
+    DI interface, converted to IPCC2006 categories and downscaled where applicable.
+    For download date see scenario. Countries: AFG, AGO, ALB, ARE, ARG, ARM, ATG,
+    AZE, BDI, BEN, BFA, BGD, BHR, BHS, BIH, BLZ, BOL, BRA, BRB, BRN, BTN, BWA, CAF,
+    CHL, CHN, CIV, CMR, COD, COG, COK, COL, COM, CPV, CRI, CUB, DJI, DMA, DOM, DZA,
+    ECU, EGY, ERI, ETH, FJI, FSM, GAB, GEO, GHA, GIN, GMB, GNB, GRD, GTM, GUY, HND,
+    HTI, IDN, IND, IRN, IRQ, ISR, JAM, JOR, KEN, KGZ, KHM, KIR, KNA, KOR, KWT, LAO,
+    LBN, LBR, LCA, LKA, LSO, MAR, MDA, MDG, MDV, MEX, MHL, MKD, MLI, MMR, MNE, MNG,
+    MOZ, MRT, MUS, MWI, MYS, NAM, NER, NGA, NIC, NIU, NPL, NRU, OMN, PAK, PAN, PER,
+    PHL, PLW, PNG, PRK, PRY, PSE, QAT, RWA, SAU, SDN, SEN, SGP, SLB, SLV, SMR, SRB,
+    SSD, STP, SUR, SWZ, SYC, SYR, TCD, TGO, THA, TJK, TKM, TLS, TON, TTO, TUN, TUV,
+    TZA, UGA, URY, UZB, VCT, VEN, VNM, VUT, WSM, YEM, ZAF, ZMB, ZWE'
+time_format: '%Y'
+dimensions:
+  '*':
+  - time
+  - source
+  - measure
+  - class
+  - scenario (Process_Date)
+  - area (ISO3)
+  - provenance
+  - category (IPCC2006_PRIMAP)
+  - entity
+  - unit
+additional_coordinates:
+  orig_cat_name: category (IPCC2006_PRIMAP)
+data_file: DI_non_AnnexI_9177e6b829bcfcd93505d1355cae9ee4_hash.csv

+ 1 - 0
extracted_data/UNFCCC/Israel/ISR_DI_2023-07-18.csv

@@ -0,0 +1 @@
+ISR_DI_2dd0ae06664fd5288c942082f3437268_hash.csv

+ 1 - 0
extracted_data/UNFCCC/Israel/ISR_DI_2023-07-18.nc

@@ -0,0 +1 @@
+ISR_DI_2dd0ae06664fd5288c942082f3437268_hash.nc

+ 1 - 0
extracted_data/UNFCCC/Israel/ISR_DI_2023-07-18.yaml

@@ -0,0 +1 @@
+ISR_DI_2dd0ae06664fd5288c942082f3437268_hash.yaml

+ 1 - 0
extracted_data/UNFCCC/Israel/ISR_DI_2dd0ae06664fd5288c942082f3437268_hash.csv

@@ -0,0 +1 @@
+../../../.git/annex/objects/j3/4Q/MD5E-s116263--deb79d8da32308eabe743128b4810c90.csv/MD5E-s116263--deb79d8da32308eabe743128b4810c90.csv

+ 1 - 0
extracted_data/UNFCCC/Israel/ISR_DI_2dd0ae06664fd5288c942082f3437268_hash.nc

@@ -0,0 +1 @@
+../../../.git/annex/objects/VG/z7/MD5E-s302499--ecac74e93ca3e49793cc56d290e5b1a4.nc/MD5E-s302499--ecac74e93ca3e49793cc56d290e5b1a4.nc

+ 31 - 0
extracted_data/UNFCCC/Israel/ISR_DI_2dd0ae06664fd5288c942082f3437268_hash.yaml

@@ -0,0 +1,31 @@
+attrs:
+  references: https://di.unfccc.int
+  title: Data submitted to the UNFCCC by country Israel as available in the DI interface
+    on 2023-07-18. Processed on 2023-07-18
+  comment: Data read from the UNFCCC DI flexible query interface using the API. Data
+    read on 2023-07-18. Processed on 2023-07-18
+  rights: ''
+  contact: mail@johannes-guetschow.de
+  institution: United Nations Framework Convention on Climate Change (www.unfccc.int)
+  cat: category (IPCC2006_PRIMAP)
+  area: area (ISO3)
+  scen: scenario (Access_Date)
+  sec_cats:
+  - class
+  - measure
+time_format: '%Y'
+dimensions:
+  '*':
+  - time
+  - measure
+  - scenario (Access_Date)
+  - class
+  - source
+  - provenance
+  - category (IPCC2006_PRIMAP)
+  - area (ISO3)
+  - entity
+  - unit
+additional_coordinates:
+  orig_cat_name: category (IPCC2006_PRIMAP)
+data_file: ISR_DI_2dd0ae06664fd5288c942082f3437268_hash.csv