소스 검색

Start China BUR3 / NC4, fix bug in bur downloader

Johannes Gütschow 11 달 전
부모
커밋
a2525105a7

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 741 - 96
poetry.lock


+ 3 - 0
pyproject.toml

@@ -49,6 +49,9 @@ ruff = "^0.1.8"
 pre-commit = "^3.3.1"
 towncrier = "^23.6.0"
 liccheck = "^0.9.1"
+notebook = "^7.2.0"
+ipywidgets = "^8.1.2"
+ipympl = "^0.9.4"
 
 [build-system]
 requires = ["poetry-core"]

+ 3 - 1
src/unfccc_ghg_data/unfccc_downloader/fetch_submissions_bur.py

@@ -53,13 +53,15 @@ if __name__ == "__main__":
         if "href" not in link.attrs:
             continue
         href = link.attrs["href"]
-        if "/documents/" in href:
+        if "documents/" in href:
             if "title" in link.attrs.keys():
                 title = link.attrs["title"]
             else:
                 title = link.contents[0]
             if href.startswith("/documents"):
                 href = "https://unfccc.int" + href
+            elif href.startswith("documents"):
+                href = "https://unfccc.int/" + href
             # Only add pages in the format https://unfccc.int/documents/65587
             # to further downloads
             if str(Path(href).parent).endswith("documents"):

+ 30 - 0
src/unfccc_ghg_data/unfccc_reader/China/__init__.py

@@ -0,0 +1,30 @@
+"""Read China's BURs, NIRs, NCs
+
+Scripts and configurations to read Argentina's submissions to the UNFCCC.
+Currently, the following submissions and datasets are available (all datasets
+including DI (red using the DI-reader) and legacy BUR/NIR (no code)):
+
+.. exec_code::
+    :hide_code:
+
+    from unfccc_ghg_data.helper.functions import (get_country_datasets,
+                                                  get_country_submissions)
+    country = 'CHN'
+    # print available submissions
+    print("="*15 + " Available submissions " + "="*15)
+    get_country_submissions(country, True)
+    print("")
+
+    #print available datasets
+    print("="*15 + " Available datasets " + "="*15)
+    get_country_datasets(country, True)
+
+You can also obtain this information running
+
+.. code-block:: bash
+
+    poetry run doit country_info country=CHN
+
+See below for a listing of scripts for BUR/NIR reading including links.
+
+"""

+ 63 - 0
src/unfccc_ghg_data/unfccc_reader/China/config_chn_bur3_nc4.py

@@ -0,0 +1,63 @@
+"""Config for China BUR3 and NC4
+
+Configuration for reading the China's NC4 and BUR3 from pdf.
+Full configuration is contained here including configuraton for conversions to
+primap2 data format.
+
+NOTE: GWPs are a mixture of AR4 and SAR values (SAR except for HFC-245fa and HFC-365mfc)
+Thus the Kyoto GHG gas basket is not fully consistent with SAR GWPs and is
+re-generated for the processed version of the data.
+"""
+
+## general config
+gwp_to_use = "SARGWP100"  # see note above
+
+
+## NC4 specific config
+config_nc4 = {
+    "scenario": "NC4",
+    "year": 2017,
+    "unit": "kt / year",
+    "pages_overview": {
+        "CHN": [30],
+        "MAC": [218],
+        "HKG": [190],
+    },
+    "pages_inventory": {
+        "CHN": [31, 32],
+        "MAC": [219],
+        "HKG": [191],
+    },
+    "pages_fgases": {
+        "CHN": [33],
+        "MAC": [],
+        "HKG": [192],
+    },
+}
+
+## BUR3 specific config
+config_bur3 = {
+    "scenario": "BUR3",
+    "year": 2018,
+    "unit": "kt / year",
+    "pages_overview": {
+        "CHN": [11],
+        "MAC": [63],
+        "HKG": [43],
+    },
+    "pages_inventory": {
+        "CHN": [13, 14],
+        "MAC": [61],
+        "HKG": [44],
+    },
+    "pages_fgases": {
+        "CHN": [15],
+        "MAC": [],
+        "HKG": [45],
+    },
+    "pages_recalc": {
+        "CHN": [18],
+        "MAC": [67],
+        "HKG": [50],
+    },
+}

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.