Переглянути джерело

Use primap2 functions in country processing and adapt configurations

Johannes Gütschow 9 місяців тому
батько
коміт
8e28bd41ec
25 змінених файлів з 1170 додано та 574 видалено
  1. 1 0
      .gitignore
  2. 150 149
      poetry.lock
  3. 1 1
      pyproject.toml
  4. 47 139
      src/unfccc_ghg_data/helper/functions.py
  5. 21 16
      src/unfccc_ghg_data/unfccc_di_reader/unfccc_di_reader_config.py
  6. 202 97
      src/unfccc_ghg_data/unfccc_reader/Argentina/config_arg_bur5.py
  7. 0 1
      src/unfccc_ghg_data/unfccc_reader/Argentina/read_ARG_BUR5_from_csv.py
  8. 20 8
      src/unfccc_ghg_data/unfccc_reader/Burundi/config_bdi_bur1.py
  9. 7 7
      src/unfccc_ghg_data/unfccc_reader/Chile/config_chl_bur4.py
  10. 3 1
      src/unfccc_ghg_data/unfccc_reader/Chile/read_CHL_BUR4_from_xlsx.py
  11. 3 1
      src/unfccc_ghg_data/unfccc_reader/Chile/read_CHL_BUR5_from_xlsx.py
  12. 363 35
      src/unfccc_ghg_data/unfccc_reader/China/config_chn_bur3_nc4.py
  13. 82 0
      src/unfccc_ghg_data/unfccc_reader/China/read_CHN_BUR3_from_pdf.py
  14. 20 8
      src/unfccc_ghg_data/unfccc_reader/Guinea/config_gin_bur1.py
  15. 17 10
      src/unfccc_ghg_data/unfccc_reader/Indonesia/read_IDN_BUR3_from_pdf.py
  16. 55 22
      src/unfccc_ghg_data/unfccc_reader/Israel/config_isr_bur2.py
  17. 20 8
      src/unfccc_ghg_data/unfccc_reader/Malaysia/config_mys_bur3.py
  18. 20 8
      src/unfccc_ghg_data/unfccc_reader/Malaysia/config_mys_bur4.py
  19. 35 17
      src/unfccc_ghg_data/unfccc_reader/Morocco/config_mar_bur3.py
  20. 11 5
      src/unfccc_ghg_data/unfccc_reader/Nigeria/config_nga_bur2.py
  21. 11 5
      src/unfccc_ghg_data/unfccc_reader/Peru/config_per_bur3.py
  22. 16 10
      src/unfccc_ghg_data/unfccc_reader/Singapore/config_sgp_bur5.py
  23. 30 12
      src/unfccc_ghg_data/unfccc_reader/Taiwan/config_twn_nir2023.py
  24. 1 1
      src/unfccc_ghg_data/unfccc_reader/Taiwan/read_TWN_2023_Inventory_from_pdf.py
  25. 34 13
      src/unfccc_ghg_data/unfccc_reader/Thailand/config_tha_bur3.py

+ 1 - 0
.gitignore

@@ -158,3 +158,4 @@ dmypy.json
 
 # Mac stuff
 *.DS_Store
+/stubs/xarray/

+ 150 - 149
poetry.lock

@@ -220,18 +220,18 @@ dev = ["freezegun (>=1.0,<2.0)", "pytest (>=6.0)", "pytest-cov"]
 
 [[package]]
 name = "backports-tarfile"
-version = "1.1.1"
+version = "1.2.0"
 description = "Backport of CPython tarfile module"
 optional = false
 python-versions = ">=3.8"
 files = [
-    {file = "backports.tarfile-1.1.1-py3-none-any.whl", hash = "sha256:73e0179647803d3726d82e76089d01d8549ceca9bace469953fcb4d97cf2d417"},
-    {file = "backports_tarfile-1.1.1.tar.gz", hash = "sha256:9c2ef9696cb73374f7164e17fc761389393ca76777036f5aad42e8b93fcd8009"},
+    {file = "backports.tarfile-1.2.0-py3-none-any.whl", hash = "sha256:77e284d754527b01fb1e6fa8a1afe577858ebe4e9dad8919e34c862cb399bc34"},
+    {file = "backports_tarfile-1.2.0.tar.gz", hash = "sha256:d75e02c268746e1b8144c278978b6e98e85de6ad16f8e4b0844a154557eca991"},
 ]
 
 [package.extras]
 docs = ["furo", "jaraco.packaging (>=9.3)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"]
-testing = ["jaraco.test", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)"]
+testing = ["jaraco.test", "pytest (!=8.0.*)", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)"]
 
 [[package]]
 name = "beautifulsoup4"
@@ -696,63 +696,63 @@ test-no-images = ["pytest", "pytest-cov", "pytest-xdist", "wurlitzer"]
 
 [[package]]
 name = "coverage"
-version = "7.5.2"
+version = "7.5.3"
 description = "Code coverage measurement for Python"
 optional = false
 python-versions = ">=3.8"
 files = [
-    {file = "coverage-7.5.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:554c7327bf0fd688050348e22db7c8e163fb7219f3ecdd4732d7ed606b417263"},
-    {file = "coverage-7.5.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d0305e02e40c7cfea5d08d6368576537a74c0eea62b77633179748d3519d6705"},
-    {file = "coverage-7.5.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:829fb55ad437d757c70d5b1c51cfda9377f31506a0a3f3ac282bc6a387d6a5f1"},
-    {file = "coverage-7.5.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:894b1acded706f1407a662d08e026bfd0ff1e59e9bd32062fea9d862564cfb65"},
-    {file = "coverage-7.5.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fe76d6dee5e4febefa83998b17926df3a04e5089e3d2b1688c74a9157798d7a2"},
-    {file = "coverage-7.5.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:c7ebf2a37e4f5fea3c1a11e1f47cea7d75d0f2d8ef69635ddbd5c927083211fc"},
-    {file = "coverage-7.5.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:20e611fc36e1a0fc7bbf957ef9c635c8807d71fbe5643e51b2769b3cc0fb0b51"},
-    {file = "coverage-7.5.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:7c5c5b7ae2763533152880d5b5b451acbc1089ade2336b710a24b2b0f5239d20"},
-    {file = "coverage-7.5.2-cp310-cp310-win32.whl", hash = "sha256:1e4225990a87df898e40ca31c9e830c15c2c53b1d33df592bc8ef314d71f0281"},
-    {file = "coverage-7.5.2-cp310-cp310-win_amd64.whl", hash = "sha256:976cd92d9420e6e2aa6ce6a9d61f2b490e07cb468968adf371546b33b829284b"},
-    {file = "coverage-7.5.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5997d418c219dcd4dcba64e50671cca849aaf0dac3d7a2eeeb7d651a5bd735b8"},
-    {file = "coverage-7.5.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ec27e93bbf5976f0465e8936f02eb5add99bbe4e4e7b233607e4d7622912d68d"},
-    {file = "coverage-7.5.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1f11f98753800eb1ec872562a398081f6695f91cd01ce39819e36621003ec52a"},
-    {file = "coverage-7.5.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6e34680049eecb30b6498784c9637c1c74277dcb1db75649a152f8004fbd6646"},
-    {file = "coverage-7.5.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3e12536446ad4527ac8ed91d8a607813085683bcce27af69e3b31cd72b3c5960"},
-    {file = "coverage-7.5.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:3d3f7744b8a8079d69af69d512e5abed4fb473057625588ce126088e50d05493"},
-    {file = "coverage-7.5.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:431a3917e32223fcdb90b79fe60185864a9109631ebc05f6c5aa03781a00b513"},
-    {file = "coverage-7.5.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:a7c6574225f34ce45466f04751d957b5c5e6b69fca9351db017c9249786172ce"},
-    {file = "coverage-7.5.2-cp311-cp311-win32.whl", hash = "sha256:2b144d142ec9987276aeff1326edbc0df8ba4afbd7232f0ca10ad57a115e95b6"},
-    {file = "coverage-7.5.2-cp311-cp311-win_amd64.whl", hash = "sha256:900532713115ac58bc3491b9d2b52704a05ed408ba0918d57fd72c94bc47fba1"},
-    {file = "coverage-7.5.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:9a42970ce74c88bdf144df11c52c5cf4ad610d860de87c0883385a1c9d9fa4ab"},
-    {file = "coverage-7.5.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:26716a1118c6ce2188283b4b60a898c3be29b480acbd0a91446ced4fe4e780d8"},
-    {file = "coverage-7.5.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:60b66b0363c5a2a79fba3d1cd7430c25bbd92c923d031cae906bdcb6e054d9a2"},
-    {file = "coverage-7.5.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e5d22eba19273b2069e4efeff88c897a26bdc64633cbe0357a198f92dca94268"},
-    {file = "coverage-7.5.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3bb5b92a0ab3d22dfdbfe845e2fef92717b067bdf41a5b68c7e3e857c0cff1a4"},
-    {file = "coverage-7.5.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:1aef719b6559b521ae913ddeb38f5048c6d1a3d366865e8b320270b7bc4693c2"},
-    {file = "coverage-7.5.2-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:8809c0ea0e8454f756e3bd5c36d04dddf222989216788a25bfd6724bfcee342c"},
-    {file = "coverage-7.5.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:1acc2e2ef098a1d4bf535758085f508097316d738101a97c3f996bccba963ea5"},
-    {file = "coverage-7.5.2-cp312-cp312-win32.whl", hash = "sha256:97de509043d3f0f2b2cd171bdccf408f175c7f7a99d36d566b1ae4dd84107985"},
-    {file = "coverage-7.5.2-cp312-cp312-win_amd64.whl", hash = "sha256:8941e35a0e991a7a20a1fa3e3182f82abe357211f2c335a9e6007067c3392fcf"},
-    {file = "coverage-7.5.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:5662bf0f6fb6757f5c2d6279c541a5af55a39772c2362ed0920b27e3ce0e21f7"},
-    {file = "coverage-7.5.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:3d9c62cff2ffb4c2a95328488fd7aa96a7a4b34873150650fe76b19c08c9c792"},
-    {file = "coverage-7.5.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:74eeaa13e8200ad72fca9c5f37395fb310915cec6f1682b21375e84fd9770e84"},
-    {file = "coverage-7.5.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1f29bf497d51a5077994b265e976d78b09d9d0dff6ca5763dbb4804534a5d380"},
-    {file = "coverage-7.5.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1f96aa94739593ae0707eda9813ce363a0a0374a810ae0eced383340fc4a1f73"},
-    {file = "coverage-7.5.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:51b6cee539168a912b4b3b040e4042b9e2c9a7ad9c8546c09e4eaeff3eacba6b"},
-    {file = "coverage-7.5.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:59a75e6aa5c25b50b5a1499f9718f2edff54257f545718c4fb100f48d570ead4"},
-    {file = "coverage-7.5.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:29da75ce20cb0a26d60e22658dd3230713c6c05a3465dd8ad040ffc991aea318"},
-    {file = "coverage-7.5.2-cp38-cp38-win32.whl", hash = "sha256:23f2f16958b16152b43a39a5ecf4705757ddd284b3b17a77da3a62aef9c057ef"},
-    {file = "coverage-7.5.2-cp38-cp38-win_amd64.whl", hash = "sha256:9e41c94035e5cdb362beed681b58a707e8dc29ea446ea1713d92afeded9d1ddd"},
-    {file = "coverage-7.5.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:06d96b9b19bbe7f049c2be3c4f9e06737ec6d8ef8933c7c3a4c557ef07936e46"},
-    {file = "coverage-7.5.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:878243e1206828908a6b4a9ca7b1aa8bee9eb129bf7186fc381d2646f4524ce9"},
-    {file = "coverage-7.5.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:482df956b055d3009d10fce81af6ffab28215d7ed6ad4a15e5c8e67cb7c5251c"},
-    {file = "coverage-7.5.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a35c97af60a5492e9e89f8b7153fe24eadfd61cb3a2fb600df1a25b5dab34b7e"},
-    {file = "coverage-7.5.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:24bb4c7859a3f757a116521d4d3a8a82befad56ea1bdacd17d6aafd113b0071e"},
-    {file = "coverage-7.5.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:e1046aab24c48c694f0793f669ac49ea68acde6a0798ac5388abe0a5615b5ec8"},
-    {file = "coverage-7.5.2-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:448ec61ea9ea7916d5579939362509145caaecf03161f6f13e366aebb692a631"},
-    {file = "coverage-7.5.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:4a00bd5ba8f1a4114720bef283cf31583d6cb1c510ce890a6da6c4268f0070b7"},
-    {file = "coverage-7.5.2-cp39-cp39-win32.whl", hash = "sha256:9f805481d5eff2a96bac4da1570ef662bf970f9a16580dc2c169c8c3183fa02b"},
-    {file = "coverage-7.5.2-cp39-cp39-win_amd64.whl", hash = "sha256:2c79f058e7bec26b5295d53b8c39ecb623448c74ccc8378631f5cb5c16a7e02c"},
-    {file = "coverage-7.5.2-pp38.pp39.pp310-none-any.whl", hash = "sha256:40dbb8e7727560fe8ab65efcddfec1ae25f30ef02e2f2e5d78cfb52a66781ec5"},
-    {file = "coverage-7.5.2.tar.gz", hash = "sha256:13017a63b0e499c59b5ba94a8542fb62864ba3016127d1e4ef30d354fc2b00e9"},
+    {file = "coverage-7.5.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a6519d917abb15e12380406d721e37613e2a67d166f9fb7e5a8ce0375744cd45"},
+    {file = "coverage-7.5.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:aea7da970f1feccf48be7335f8b2ca64baf9b589d79e05b9397a06696ce1a1ec"},
+    {file = "coverage-7.5.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:923b7b1c717bd0f0f92d862d1ff51d9b2b55dbbd133e05680204465f454bb286"},
+    {file = "coverage-7.5.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:62bda40da1e68898186f274f832ef3e759ce929da9a9fd9fcf265956de269dbc"},
+    {file = "coverage-7.5.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d8b7339180d00de83e930358223c617cc343dd08e1aa5ec7b06c3a121aec4e1d"},
+    {file = "coverage-7.5.3-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:25a5caf742c6195e08002d3b6c2dd6947e50efc5fc2c2205f61ecb47592d2d83"},
+    {file = "coverage-7.5.3-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:05ac5f60faa0c704c0f7e6a5cbfd6f02101ed05e0aee4d2822637a9e672c998d"},
+    {file = "coverage-7.5.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:239a4e75e09c2b12ea478d28815acf83334d32e722e7433471fbf641c606344c"},
+    {file = "coverage-7.5.3-cp310-cp310-win32.whl", hash = "sha256:a5812840d1d00eafae6585aba38021f90a705a25b8216ec7f66aebe5b619fb84"},
+    {file = "coverage-7.5.3-cp310-cp310-win_amd64.whl", hash = "sha256:33ca90a0eb29225f195e30684ba4a6db05dbef03c2ccd50b9077714c48153cac"},
+    {file = "coverage-7.5.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:f81bc26d609bf0fbc622c7122ba6307993c83c795d2d6f6f6fd8c000a770d974"},
+    {file = "coverage-7.5.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:7cec2af81f9e7569280822be68bd57e51b86d42e59ea30d10ebdbb22d2cb7232"},
+    {file = "coverage-7.5.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:55f689f846661e3f26efa535071775d0483388a1ccfab899df72924805e9e7cd"},
+    {file = "coverage-7.5.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:50084d3516aa263791198913a17354bd1dc627d3c1639209640b9cac3fef5807"},
+    {file = "coverage-7.5.3-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:341dd8f61c26337c37988345ca5c8ccabeff33093a26953a1ac72e7d0103c4fb"},
+    {file = "coverage-7.5.3-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:ab0b028165eea880af12f66086694768f2c3139b2c31ad5e032c8edbafca6ffc"},
+    {file = "coverage-7.5.3-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:5bc5a8c87714b0c67cfeb4c7caa82b2d71e8864d1a46aa990b5588fa953673b8"},
+    {file = "coverage-7.5.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:38a3b98dae8a7c9057bd91fbf3415c05e700a5114c5f1b5b0ea5f8f429ba6614"},
+    {file = "coverage-7.5.3-cp311-cp311-win32.whl", hash = "sha256:fcf7d1d6f5da887ca04302db8e0e0cf56ce9a5e05f202720e49b3e8157ddb9a9"},
+    {file = "coverage-7.5.3-cp311-cp311-win_amd64.whl", hash = "sha256:8c836309931839cca658a78a888dab9676b5c988d0dd34ca247f5f3e679f4e7a"},
+    {file = "coverage-7.5.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:296a7d9bbc598e8744c00f7a6cecf1da9b30ae9ad51c566291ff1314e6cbbed8"},
+    {file = "coverage-7.5.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:34d6d21d8795a97b14d503dcaf74226ae51eb1f2bd41015d3ef332a24d0a17b3"},
+    {file = "coverage-7.5.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8e317953bb4c074c06c798a11dbdd2cf9979dbcaa8ccc0fa4701d80042d4ebf1"},
+    {file = "coverage-7.5.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:705f3d7c2b098c40f5b81790a5fedb274113373d4d1a69e65f8b68b0cc26f6db"},
+    {file = "coverage-7.5.3-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b1196e13c45e327d6cd0b6e471530a1882f1017eb83c6229fc613cd1a11b53cd"},
+    {file = "coverage-7.5.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:015eddc5ccd5364dcb902eaecf9515636806fa1e0d5bef5769d06d0f31b54523"},
+    {file = "coverage-7.5.3-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:fd27d8b49e574e50caa65196d908f80e4dff64d7e592d0c59788b45aad7e8b35"},
+    {file = "coverage-7.5.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:33fc65740267222fc02975c061eb7167185fef4cc8f2770267ee8bf7d6a42f84"},
+    {file = "coverage-7.5.3-cp312-cp312-win32.whl", hash = "sha256:7b2a19e13dfb5c8e145c7a6ea959485ee8e2204699903c88c7d25283584bfc08"},
+    {file = "coverage-7.5.3-cp312-cp312-win_amd64.whl", hash = "sha256:0bbddc54bbacfc09b3edaec644d4ac90c08ee8ed4844b0f86227dcda2d428fcb"},
+    {file = "coverage-7.5.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:f78300789a708ac1f17e134593f577407d52d0417305435b134805c4fb135adb"},
+    {file = "coverage-7.5.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:b368e1aee1b9b75757942d44d7598dcd22a9dbb126affcbba82d15917f0cc155"},
+    {file = "coverage-7.5.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f836c174c3a7f639bded48ec913f348c4761cbf49de4a20a956d3431a7c9cb24"},
+    {file = "coverage-7.5.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:244f509f126dc71369393ce5fea17c0592c40ee44e607b6d855e9c4ac57aac98"},
+    {file = "coverage-7.5.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c4c2872b3c91f9baa836147ca33650dc5c172e9273c808c3c3199c75490e709d"},
+    {file = "coverage-7.5.3-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:dd4b3355b01273a56b20c219e74e7549e14370b31a4ffe42706a8cda91f19f6d"},
+    {file = "coverage-7.5.3-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:f542287b1489c7a860d43a7d8883e27ca62ab84ca53c965d11dac1d3a1fab7ce"},
+    {file = "coverage-7.5.3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:75e3f4e86804023e991096b29e147e635f5e2568f77883a1e6eed74512659ab0"},
+    {file = "coverage-7.5.3-cp38-cp38-win32.whl", hash = "sha256:c59d2ad092dc0551d9f79d9d44d005c945ba95832a6798f98f9216ede3d5f485"},
+    {file = "coverage-7.5.3-cp38-cp38-win_amd64.whl", hash = "sha256:fa21a04112c59ad54f69d80e376f7f9d0f5f9123ab87ecd18fbb9ec3a2beed56"},
+    {file = "coverage-7.5.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:f5102a92855d518b0996eb197772f5ac2a527c0ec617124ad5242a3af5e25f85"},
+    {file = "coverage-7.5.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:d1da0a2e3b37b745a2b2a678a4c796462cf753aebf94edcc87dcc6b8641eae31"},
+    {file = "coverage-7.5.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8383a6c8cefba1b7cecc0149415046b6fc38836295bc4c84e820872eb5478b3d"},
+    {file = "coverage-7.5.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9aad68c3f2566dfae84bf46295a79e79d904e1c21ccfc66de88cd446f8686341"},
+    {file = "coverage-7.5.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2e079c9ec772fedbade9d7ebc36202a1d9ef7291bc9b3a024ca395c4d52853d7"},
+    {file = "coverage-7.5.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:bde997cac85fcac227b27d4fb2c7608a2c5f6558469b0eb704c5726ae49e1c52"},
+    {file = "coverage-7.5.3-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:990fb20b32990b2ce2c5f974c3e738c9358b2735bc05075d50a6f36721b8f303"},
+    {file = "coverage-7.5.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:3d5a67f0da401e105753d474369ab034c7bae51a4c31c77d94030d59e41df5bd"},
+    {file = "coverage-7.5.3-cp39-cp39-win32.whl", hash = "sha256:e08c470c2eb01977d221fd87495b44867a56d4d594f43739a8028f8646a51e0d"},
+    {file = "coverage-7.5.3-cp39-cp39-win_amd64.whl", hash = "sha256:1d2a830ade66d3563bb61d1e3c77c8def97b30ed91e166c67d0632c018f380f0"},
+    {file = "coverage-7.5.3-pp38.pp39.pp310-none-any.whl", hash = "sha256:3538d8fb1ee9bdd2e2692b3b18c22bb1c19ffbefd06880f5ac496e42d7bb3884"},
+    {file = "coverage-7.5.3.tar.gz", hash = "sha256:04aefca5190d1dc7a53a4c1a5a7f8568811306d7a8ee231c42fb69215571944f"},
 ]
 
 [package.dependencies]
@@ -1101,53 +1101,53 @@ typing = ["typing-extensions (>=4.8)"]
 
 [[package]]
 name = "fonttools"
-version = "4.52.1"
+version = "4.52.4"
 description = "Tools to manipulate font files"
 optional = false
 python-versions = ">=3.8"
 files = [
-    {file = "fonttools-4.52.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:67a30b872e79577e5319ce660ede4a5131fa8a45de76e696746545e17db4437f"},
-    {file = "fonttools-4.52.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f0a5bff35738f8f6607c4303561ee1d1e5f64d5b14cf3c472d3030566c82e763"},
-    {file = "fonttools-4.52.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5c9622593dfff042480a1b7e5b72c4d7dc00b96d2b4f98b0bf8acf071087e0db"},
-    {file = "fonttools-4.52.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:33cfc9fe27af5e113d157d5147e24fc8e5bda3c5aadb55bea9847ec55341ce30"},
-    {file = "fonttools-4.52.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:aa5bec5027d947ee4b2242caecf7dc6e4ea03833e92e9b5211ebb6ab4eede8b2"},
-    {file = "fonttools-4.52.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:10e44bf8e5654050a332a79285bacd6bd3069084540aec46c0862391147a1daa"},
-    {file = "fonttools-4.52.1-cp310-cp310-win32.whl", hash = "sha256:7fba390ac2ca18ebdd456f3a9acfb4557d6dcb2eaba5cc3eadce01003892a770"},
-    {file = "fonttools-4.52.1-cp310-cp310-win_amd64.whl", hash = "sha256:15df3517eb95035422a5c953ca19aac99913c16aa0e4ef061aeaef5f3bcaf369"},
-    {file = "fonttools-4.52.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:40730aab9cf42286f314b985b483eea574f1bcf3a23e28223084cbb9e256457c"},
-    {file = "fonttools-4.52.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a19bc2be3af5b22ff5c7fe858c380862e31052c74f62e2c6d565ed0855bed7a6"},
-    {file = "fonttools-4.52.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f859066d8afde53f2ddabcd0705061e6d9d9868757c6ae28abe49bc885292df4"},
-    {file = "fonttools-4.52.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:74cd3e3e9ba501e87a391b62e91f7b1610e8b3f3d706a368e5aee51614c1674e"},
-    {file = "fonttools-4.52.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:958957b81418647f66820480363cb617ba6b5bcf189ec6c4cea307d051048545"},
-    {file = "fonttools-4.52.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:56addf1f995d94dad13aaaf56eb6def3d9ca97c2fada5e27af8190b3141e8633"},
-    {file = "fonttools-4.52.1-cp311-cp311-win32.whl", hash = "sha256:fea5456b2af42db8ecb1a6c2f144655ca6dcdcebd970f3145c56e668084ded7e"},
-    {file = "fonttools-4.52.1-cp311-cp311-win_amd64.whl", hash = "sha256:228faab7638cd726cdde5e2ec9ee10f780fbf9de9aa38d7f1e56a270437dff36"},
-    {file = "fonttools-4.52.1-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:7c6aeb0d53e2ea92009b11c3d4ad9c03d0ecdfe602d547bed8537836e464f51e"},
-    {file = "fonttools-4.52.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:e871123d12c92e2c9bda6369b69ce2da9cef40b119cc340451e413e90355fa38"},
-    {file = "fonttools-4.52.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5ff8857dc9bb3e407c25aef3e025409cfbb23adb646a835636bebb1bdfc27a41"},
-    {file = "fonttools-4.52.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7685fdc6e23267844eef2b9af585d7f171cca695e4eb369d7682544c3e2e1123"},
-    {file = "fonttools-4.52.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:b1e1b2774485fbbb41a1beccc913b9c6f7971f78da61dd34207b9acc3cc2963e"},
-    {file = "fonttools-4.52.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:1e2c415160397fd6ed3964155aeec4bfefceeee365ab17161a5b3fe3f8dab077"},
-    {file = "fonttools-4.52.1-cp312-cp312-win32.whl", hash = "sha256:3ba2c4647e7decfb8e9cd346661c7d151dae1fba23d37b48bcf5fa8351f7b8c8"},
-    {file = "fonttools-4.52.1-cp312-cp312-win_amd64.whl", hash = "sha256:d39b926f14a2f7a7f92ded7d266b18f0108d867364769ab59da88ac2fa90d288"},
-    {file = "fonttools-4.52.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:6e58d8097a269b6c43ec0abb3fa8d6c350ff0c7dfd23fc14d004610df88a4bb3"},
-    {file = "fonttools-4.52.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:20f0fc969817c50539dc919ed8c4aef4de28c2d6e0111a064112301f157aede4"},
-    {file = "fonttools-4.52.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d62e84d38969491c6c1f6fe3dd63108e99d02de01bb3d98c160a5d4d24120910"},
-    {file = "fonttools-4.52.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8eb5a389bbdee6f4c422881de422ee0e7efdfcd9310b13d540b12aa8ae2c9e7b"},
-    {file = "fonttools-4.52.1-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:0caf05c969cbde6729dd97b64bea445ee152bb19215d5886f7b93bd0fb455468"},
-    {file = "fonttools-4.52.1-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:df08bee1dd29a767311b50c62c0cfe4d72ae8c793e567d4c60b8c16c7c63a4f0"},
-    {file = "fonttools-4.52.1-cp38-cp38-win32.whl", hash = "sha256:82ffcf4782ceda09842b5b7875b36834c15d7cc0d5dd3d23a658ee9cf8819cd6"},
-    {file = "fonttools-4.52.1-cp38-cp38-win_amd64.whl", hash = "sha256:26b43bab5a3bce55ed4d9699b16568795eef5597d154f52dcabef5b4804c4b21"},
-    {file = "fonttools-4.52.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:7e8dbc13c4bc12e60df1b1f5e484112a5e96a6e8bba995e2965988ad73c5ea1b"},
-    {file = "fonttools-4.52.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:7352ba2226e45e8fba11c3fb416363faf1b06f3f2e80d07d2930401265f3bf9c"},
-    {file = "fonttools-4.52.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a8834d43763e9e92349ce8bb25dfb612aef6691eefefad885212d5e8f36a94a4"},
-    {file = "fonttools-4.52.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ee2a8c1101d06cc8fca7851dceb67afd53dd6fc0288bacaa632e647bc5afff58"},
-    {file = "fonttools-4.52.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:a99b738227c0f6f2bbe381b45804a7c46653c95b9d7bf13f6f02884bc87e4930"},
-    {file = "fonttools-4.52.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:75aa00a16b9a64d1550e2e70d3582c7fe1ef18560e0cf066a4087fe6d11908a2"},
-    {file = "fonttools-4.52.1-cp39-cp39-win32.whl", hash = "sha256:c2f09b4aa699cfed4bbebc1829c5f044b41976707dac9230ed00d5a9fc6452c1"},
-    {file = "fonttools-4.52.1-cp39-cp39-win_amd64.whl", hash = "sha256:78ea6e0d4c89f8e216995923b854dd10bd09e48d3a5a3ccb48bb68f436a409ad"},
-    {file = "fonttools-4.52.1-py3-none-any.whl", hash = "sha256:faf5c83f83f7ddebdafdb453d02efdbea7fb494080d7a8d45a8a20db06ea8da5"},
-    {file = "fonttools-4.52.1.tar.gz", hash = "sha256:8c9204435aa6e5e9479a5ba4e669f05dea28b0c61958e0c0923cb164296d9329"},
+    {file = "fonttools-4.52.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:fb8cd6559f0ae3a8f5e146f80ab2a90ad0325a759be8d48ee82758a0b89fa0aa"},
+    {file = "fonttools-4.52.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5ecb88318ff249bd2a715e7aec36774ce7ae3441128007ef72a39a60601f4a8f"},
+    {file = "fonttools-4.52.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b9a22cf1adaae7b2ba2ed7d8651a4193a4f348744925b4b740e6b38a94599c5b"},
+    {file = "fonttools-4.52.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8873d6edd1dae5c088dd3d61c9fd4dd80c827c486fa224d368233e7f33dc98af"},
+    {file = "fonttools-4.52.4-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:73ba38b98c012957940a04d9eb5439b42565ac892bba8cfc32e10d88e73921fe"},
+    {file = "fonttools-4.52.4-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:9725687db3c1cef13c0f40b380c3c15bea0113f4d0231b204d58edd5f2a53d90"},
+    {file = "fonttools-4.52.4-cp310-cp310-win32.whl", hash = "sha256:9180775c9535389a665cae7c5282f8e07754beabf59b66aeba7f6bfeb32a3652"},
+    {file = "fonttools-4.52.4-cp310-cp310-win_amd64.whl", hash = "sha256:46cc5d06ee05fd239c45d7935aaffd060ee773a88b97e901df50478247472643"},
+    {file = "fonttools-4.52.4-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:d272c7e173c3085308345ccc7fb2ad6ce7f415d777791dd6ce4e8140e354d09c"},
+    {file = "fonttools-4.52.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:21921e5855c399d10ddfc373538b425cabcf8b3258720b51450909e108896450"},
+    {file = "fonttools-4.52.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:52f6001814ec5e0c961cabe89642f7e8d7e07892b565057aa526569b9ebb711c"},
+    {file = "fonttools-4.52.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4b0b9eb0f55dce9c7278ad4175f1cbaed23b799dce5ecc20e3213da241584140"},
+    {file = "fonttools-4.52.4-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:70d87f2099006304d33438bdaa5101953b7e22e23a93b1c7b7ed0f32ff44b423"},
+    {file = "fonttools-4.52.4-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:e176249292eccd89f81d39f514f2b5e8c75dfc9cef8653bdc3021d06697e9eff"},
+    {file = "fonttools-4.52.4-cp311-cp311-win32.whl", hash = "sha256:bb7d206fa5ba6e082ba5d5e1b7107731029fc3a55c71c48de65121710d817986"},
+    {file = "fonttools-4.52.4-cp311-cp311-win_amd64.whl", hash = "sha256:346d08ff92e577b2dc5a0c228487667d23fe2da35a8b9a8bba22c2b6ba8be21c"},
+    {file = "fonttools-4.52.4-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:d2cc7906bc0afdd2689aaf88b910307333b1f936262d1d98f25dbf8a5eb2e829"},
+    {file = "fonttools-4.52.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:00d9abf4b400f98fb895566eb298f60432b4b29048e3dc02807427b09a06604e"},
+    {file = "fonttools-4.52.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4b419207e53db1599b3d385afd4bca6692c219d53732890d0814a2593104d0e2"},
+    {file = "fonttools-4.52.4-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cf694159528022daa71b1777cb6ec9e0ebbdd29859f3e9c845826cafaef4ca29"},
+    {file = "fonttools-4.52.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:9a5d1b0475050056d2e3bc378014f2ea2230e8ae434eeac8dfb182aa8efaf642"},
+    {file = "fonttools-4.52.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:4c3ad89204c2d7f419436f1d6fde681b070c5e20b888beb57ccf92f640628cc9"},
+    {file = "fonttools-4.52.4-cp312-cp312-win32.whl", hash = "sha256:1dc626de4b204d025d029e646bae8fdbf5acd9217158283a567f4b523fda3bae"},
+    {file = "fonttools-4.52.4-cp312-cp312-win_amd64.whl", hash = "sha256:309b617942041073ffa96090d320b99d75648ed16e0c67fb1aa7788e06c834de"},
+    {file = "fonttools-4.52.4-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:8b186cd6b8844f6cf04a7e0a174bc3649d3deddbfc10dc59846a4381f796d348"},
+    {file = "fonttools-4.52.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:9ed23a03b7d9f0e29ca0679eafe5152aeccb0580312a3fc36f0662e178b4791b"},
+    {file = "fonttools-4.52.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:89b53386214197bd5b3e3c753895bad691de84726ced3c222a59cde1dd12d57b"},
+    {file = "fonttools-4.52.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7467161f1eed557dbcec152d5ee95540200b1935709fa73307da16bc0b7ca361"},
+    {file = "fonttools-4.52.4-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:b4cba644e2515d685d4ee3ca2fbb5d53930a0e9ec2cf332ed704dc341b145878"},
+    {file = "fonttools-4.52.4-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:890e7a657574610330e42dd1e38d3b9e0a8cb0eff3da080f80995460a256d3dd"},
+    {file = "fonttools-4.52.4-cp38-cp38-win32.whl", hash = "sha256:7dccf4666f716e5e0753f0fa28dad2f4431154c87747bc781c838b8a5dca990e"},
+    {file = "fonttools-4.52.4-cp38-cp38-win_amd64.whl", hash = "sha256:a791f002d1b717268235cfae7e4957b7fd132e92e2c5400e521bf191f1b3a9a5"},
+    {file = "fonttools-4.52.4-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:05e4291db6af66f466a203d9922e4c1d3e18ef16868f76f10b00e2c3b9814df2"},
+    {file = "fonttools-4.52.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a64e72d2c144630e017ac9c1c416ddf8ac43bef9a083bf81fe08c0695f0baa95"},
+    {file = "fonttools-4.52.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ebb183ed8b789cece0bd6363121913fb6da4034af89a2fa5408e42a1592889a8"},
+    {file = "fonttools-4.52.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a4daf2751a98c69d9620717826ed6c5743b662ef0ae7bb33dc6c205425e48eba"},
+    {file = "fonttools-4.52.4-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:15efb2ba4b8c2d012ee0bb7a850c2e4780c530cc83ec8e843b2a97f8b3a5fd4b"},
+    {file = "fonttools-4.52.4-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:35af630404223273f1d7acd4761f399131c62820366f53eac029337069f5826a"},
+    {file = "fonttools-4.52.4-cp39-cp39-win32.whl", hash = "sha256:d0184aa88865339d96f7f452e8c5b621186ef7638744d78bf9b775d67e206819"},
+    {file = "fonttools-4.52.4-cp39-cp39-win_amd64.whl", hash = "sha256:e03dae26084bb3632b4a77b1cd0419159d2226911aff6dc4c7e3058df68648c6"},
+    {file = "fonttools-4.52.4-py3-none-any.whl", hash = "sha256:95e8a5975d08d0b624a14eec0f987e204ad81b480e24c5436af99170054434b8"},
+    {file = "fonttools-4.52.4.tar.gz", hash = "sha256:859399b7adc8ac067be8e5c80ef4bb2faddff97e9b40896a9de75606a43d0469"},
 ]
 
 [package.extras]
@@ -1618,21 +1618,21 @@ files = [
 
 [[package]]
 name = "ipywidgets"
-version = "8.1.2"
+version = "8.1.3"
 description = "Jupyter interactive widgets"
 optional = false
 python-versions = ">=3.7"
 files = [
-    {file = "ipywidgets-8.1.2-py3-none-any.whl", hash = "sha256:bbe43850d79fb5e906b14801d6c01402857996864d1e5b6fa62dd2ee35559f60"},
-    {file = "ipywidgets-8.1.2.tar.gz", hash = "sha256:d0b9b41e49bae926a866e613a39b0f0097745d2b9f1f3dd406641b4a57ec42c9"},
+    {file = "ipywidgets-8.1.3-py3-none-any.whl", hash = "sha256:efafd18f7a142248f7cb0ba890a68b96abd4d6e88ddbda483c9130d12667eaf2"},
+    {file = "ipywidgets-8.1.3.tar.gz", hash = "sha256:f5f9eeaae082b1823ce9eac2575272952f40d748893972956dc09700a6392d9c"},
 ]
 
 [package.dependencies]
 comm = ">=0.1.3"
 ipython = ">=6.1.0"
-jupyterlab-widgets = ">=3.0.10,<3.1.0"
+jupyterlab-widgets = ">=3.0.11,<3.1.0"
 traitlets = ">=4.3.1"
-widgetsnbextension = ">=4.0.10,<4.1.0"
+widgetsnbextension = ">=4.0.11,<4.1.0"
 
 [package.extras]
 test = ["ipykernel", "jsonschema", "pytest (>=3.6.0)", "pytest-cov", "pytz"]
@@ -2066,13 +2066,13 @@ test = ["hatch", "ipykernel", "openapi-core (>=0.18.0,<0.19.0)", "openapi-spec-v
 
 [[package]]
 name = "jupyterlab-widgets"
-version = "3.0.10"
+version = "3.0.11"
 description = "Jupyter interactive widgets for JupyterLab"
 optional = false
 python-versions = ">=3.7"
 files = [
-    {file = "jupyterlab_widgets-3.0.10-py3-none-any.whl", hash = "sha256:dd61f3ae7a5a7f80299e14585ce6cf3d6925a96c9103c978eda293197730cb64"},
-    {file = "jupyterlab_widgets-3.0.10.tar.gz", hash = "sha256:04f2ac04976727e4f9d0fa91cdc2f1ab860f965e504c29dbd6a65c882c9d04c0"},
+    {file = "jupyterlab_widgets-3.0.11-py3-none-any.whl", hash = "sha256:78287fd86d20744ace330a61625024cf5521e1c012a352ddc0a3cdc2348becd0"},
+    {file = "jupyterlab_widgets-3.0.11.tar.gz", hash = "sha256:dd5ac679593c969af29c9bed054c24f26842baa51352114736756bc035deee27"},
 ]
 
 [[package]]
@@ -2812,18 +2812,15 @@ files = [
 
 [[package]]
 name = "nodeenv"
-version = "1.8.0"
+version = "1.9.0"
 description = "Node.js virtual environment builder"
 optional = false
-python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*"
+python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
 files = [
-    {file = "nodeenv-1.8.0-py2.py3-none-any.whl", hash = "sha256:df865724bb3c3adc86b3876fa209771517b0cfe596beff01a92700e0e8be4cec"},
-    {file = "nodeenv-1.8.0.tar.gz", hash = "sha256:d51e0c37e64fbf47d017feac3145cdbb58836d7eee8c6f6d3b6880c5456227d2"},
+    {file = "nodeenv-1.9.0-py2.py3-none-any.whl", hash = "sha256:508ecec98f9f3330b636d4448c0f1a56fc68017c68f1e7857ebc52acf0eb879a"},
+    {file = "nodeenv-1.9.0.tar.gz", hash = "sha256:07f144e90dae547bf0d4ee8da0ee42664a42a04e02ed68e06324348dafe4bdb1"},
 ]
 
-[package.dependencies]
-setuptools = "*"
-
 [[package]]
 name = "notebook"
 version = "7.2.0"
@@ -2933,13 +2930,13 @@ numpy = [
 
 [[package]]
 name = "openpyxl"
-version = "3.1.2"
+version = "3.1.3"
 description = "A Python library to read/write Excel 2010 xlsx/xlsm files"
 optional = false
 python-versions = ">=3.6"
 files = [
-    {file = "openpyxl-3.1.2-py2.py3-none-any.whl", hash = "sha256:f91456ead12ab3c6c2e9491cf33ba6d08357d802192379bb482f1033ade496f5"},
-    {file = "openpyxl-3.1.2.tar.gz", hash = "sha256:a6f5977418eff3b2d5500d54d9db50c8277a368436f4e4f8ddb1be3422870184"},
+    {file = "openpyxl-3.1.3-py2.py3-none-any.whl", hash = "sha256:25071b558db709de9e8782c3d3e058af3b23ffb2fc6f40c8f0c45a154eced2c3"},
+    {file = "openpyxl-3.1.3.tar.gz", hash = "sha256:8dd482e5350125b2388070bb2477927be2e8ebc27df61178709bc8c8751da2f9"},
 ]
 
 [package.dependencies]
@@ -3358,35 +3355,38 @@ virtualenv = ">=20.10.0"
 
 [[package]]
 name = "primap2"
-version = "0.10.0"
+version = "0.11.0"
 description = "The next generation of the PRIMAP climate policy analysis suite."
 optional = false
-python-versions = ">=3.9"
+python-versions = "<3.12,>=3.10"
 files = [
-    {file = "primap2-0.10.0-py3-none-any.whl", hash = "sha256:9dfe72e4d07484f25ab6275d70a5baea93f3f58b7a1d1b4e662dd709b0a33689"},
-    {file = "primap2-0.10.0.tar.gz", hash = "sha256:46098bdff5da18874eed99bd0e62008021a2eb74b1b09bcb758c9a615b59c785"},
+    {file = "primap2-0.11.0-py3-none-any.whl", hash = "sha256:d88525997c5387975027212834c0babef8908ccd970aa8f1e1bed8b4344f7249"},
+    {file = "primap2-0.11.0.tar.gz", hash = "sha256:afabf8517b2c6f60855078b59e05c56cc4bc15875b8a1d3bfae7bdf17ee7ce94"},
 ]
 
 [package.dependencies]
+attrs = "*"
 bottleneck = "*"
 h5netcdf = ">=0.10"
 h5py = "*"
 loguru = "*"
 matplotlib = "*"
-numpy = "*"
+msgpack = "*"
+numpy = ">=1.23.0,<2.0"
 openpyxl = "*"
 openscm-units = ">=0.5.1"
-pandas = "*"
+pandas = ">=1.5.0"
 pint = ">=0.23"
 pint-xarray = ">=0.3"
 "ruamel.yaml" = "*"
-scipy = "*"
+scipy = ">=1.9.0"
 strictyaml = "*"
-xarray = "*"
+tqdm = "*"
+xarray = ">=2022.6.0"
 
 [package.extras]
 datalad = ["datalad"]
-dev = ["Sphinx (>=4.2)", "build", "coverage", "flake8", "ipykernel", "jupyter", "mypy", "nbsphinx", "numpydoc", "pip", "pre-commit", "pytest", "pytest-cov", "setuptools", "sphinx-autosummary-accessors", "sphinx-rtd-theme", "tbump", "tox", "twine", "wheel", "xdoctest"]
+dev = ["Sphinx (>=4.2)", "build", "coverage", "flake8", "ipykernel", "jupyter", "mypy", "nbsphinx", "numpydoc", "pip", "pre-commit", "pytest", "pytest-cov", "ruff", "ruff-lsp", "setuptools", "sphinx-autosummary-accessors", "sphinx-rtd-theme", "tbump", "tox", "twine", "wheel", "xdoctest"]
 test = ["pytest", "pytest-cov", "xdoctest"]
 
 [[package]]
@@ -3405,13 +3405,13 @@ twisted = ["twisted"]
 
 [[package]]
 name = "prompt-toolkit"
-version = "3.0.43"
+version = "3.0.45"
 description = "Library for building powerful interactive command lines in Python"
 optional = false
 python-versions = ">=3.7.0"
 files = [
-    {file = "prompt_toolkit-3.0.43-py3-none-any.whl", hash = "sha256:a11a29cb3bf0a28a387fe5122cdb649816a957cd9261dcedf8c9f1fef33eacf6"},
-    {file = "prompt_toolkit-3.0.43.tar.gz", hash = "sha256:3527b7af26106cbc65a040bcc84839a3566ec1b051bb0bfe953631e704b0ff7d"},
+    {file = "prompt_toolkit-3.0.45-py3-none-any.whl", hash = "sha256:a29b89160e494e3ea8622b09fa5897610b437884dcdcd054fdc1308883326c2a"},
+    {file = "prompt_toolkit-3.0.45.tar.gz", hash = "sha256:07c60ee4ab7b7e90824b61afa840c8f5aad2d46b3e2e10acc33d8ecc94a49089"},
 ]
 
 [package.dependencies]
@@ -3544,13 +3544,13 @@ files = [
 
 [[package]]
 name = "pydata-sphinx-theme"
-version = "0.15.2"
+version = "0.15.3"
 description = "Bootstrap-based Sphinx theme from the PyData community"
 optional = false
 python-versions = ">=3.9"
 files = [
-    {file = "pydata_sphinx_theme-0.15.2-py3-none-any.whl", hash = "sha256:0c5fa1fa98a9b26dae590666ff576f27e26c7ba708fee754ecb9e07359ed4588"},
-    {file = "pydata_sphinx_theme-0.15.2.tar.gz", hash = "sha256:4243fee85b3afcfae9df64f83210a04e7182e53bc3db8841ffff6d21d95ae320"},
+    {file = "pydata_sphinx_theme-0.15.3-py3-none-any.whl", hash = "sha256:a48ee049dc9b0f7064dbb8f7064b1cf3ae48aa193faafe14abd403a1b7102810"},
+    {file = "pydata_sphinx_theme-0.15.3.tar.gz", hash = "sha256:f26ed9b676f61d1b2ae9289f3d7e496e8678dd56f2568b27a66fa4ad1f164efd"},
 ]
 
 [package.dependencies]
@@ -3560,14 +3560,15 @@ beautifulsoup4 = "*"
 docutils = "!=0.17.0"
 packaging = "*"
 pygments = ">=2.7"
-sphinx = ">=5.0"
+sphinx = ">=5"
 typing-extensions = "*"
 
 [package.extras]
 a11y = ["pytest-playwright"]
-dev = ["nox", "pre-commit", "pydata-sphinx-theme[doc,test]", "pyyaml"]
-doc = ["ablog (>=0.11.0rc2)", "colorama", "ipykernel", "ipyleaflet", "jupyter_sphinx", "jupyterlite-sphinx", "linkify-it-py", "matplotlib", "myst-parser", "nbsphinx", "numpy", "numpydoc", "pandas", "plotly", "rich", "sphinx-autoapi (>=3.0.0)", "sphinx-copybutton", "sphinx-design", "sphinx-favicon (>=1.0.1)", "sphinx-sitemap", "sphinx-togglebutton", "sphinxcontrib-youtube (<1.4)", "sphinxext-rediraffe", "xarray"]
-test = ["pytest", "pytest-cov", "pytest-regressions"]
+dev = ["pandoc", "pre-commit", "pydata-sphinx-theme[doc,test]", "pyyaml", "sphinx-theme-builder[cli]", "tox"]
+doc = ["ablog (>=0.11.8)", "colorama", "ipykernel", "ipyleaflet", "ipywidgets", "jupyter_sphinx", "jupyterlite-sphinx", "linkify-it-py", "matplotlib", "myst-parser", "nbsphinx", "numpy", "numpydoc", "pandas", "plotly", "rich", "sphinx-autoapi (>=3.0.0)", "sphinx-copybutton", "sphinx-design", "sphinx-favicon (>=1.0.1)", "sphinx-sitemap", "sphinx-togglebutton", "sphinxcontrib-youtube (<1.4)", "sphinxext-rediraffe", "xarray"]
+i18n = ["Babel", "jinja2"]
+test = ["pytest", "pytest-cov", "pytest-regressions", "sphinx[test]"]
 
 [[package]]
 name = "pygments"
@@ -3686,18 +3687,18 @@ six = ">=1.5"
 
 [[package]]
 name = "python-gitlab"
-version = "4.5.0"
+version = "4.6.0"
 description = "A python wrapper for the GitLab API"
 optional = false
 python-versions = ">=3.8.0"
 files = [
-    {file = "python_gitlab-4.5.0-py3-none-any.whl", hash = "sha256:b078b63afab7624ef2084aac64e3a9f4488f55b2234017e05df1b7260169cb52"},
-    {file = "python_gitlab-4.5.0.tar.gz", hash = "sha256:0a106174949819912b9abb4232e39059f83f613177fdb1787097eb84481c64b2"},
+    {file = "python_gitlab-4.6.0-py3-none-any.whl", hash = "sha256:b22e54344706851815ae5395f5f8f6503f9d3ef180e99ac9fc2ea66f59912a56"},
+    {file = "python_gitlab-4.6.0.tar.gz", hash = "sha256:b56ae363890374caede853ef552e92c41551d605800de1c64ba61bcf25f237b0"},
 ]
 
 [package.dependencies]
-requests = ">=2.25.0"
-requests-toolbelt = ">=0.10.1"
+requests = ">=2.32.0"
+requests-toolbelt = ">=1.0.0"
 
 [package.extras]
 autocompletion = ["argcomplete (>=1.10.0,<3)"]
@@ -3950,13 +3951,13 @@ rpds-py = ">=0.7.0"
 
 [[package]]
 name = "requests"
-version = "2.32.2"
+version = "2.32.3"
 description = "Python HTTP for Humans."
 optional = false
 python-versions = ">=3.8"
 files = [
-    {file = "requests-2.32.2-py3-none-any.whl", hash = "sha256:fc06670dd0ed212426dfeb94fc1b983d917c4f9847c863f313c9dfaaffb7c23c"},
-    {file = "requests-2.32.2.tar.gz", hash = "sha256:dd951ff5ecf3e3b3aa26b40703ba77495dab41da839ae72ef3c8e5d8e2433289"},
+    {file = "requests-2.32.3-py3-none-any.whl", hash = "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6"},
+    {file = "requests-2.32.3.tar.gz", hash = "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760"},
 ]
 
 [package.dependencies]
@@ -5114,13 +5115,13 @@ test = ["websockets"]
 
 [[package]]
 name = "widgetsnbextension"
-version = "4.0.10"
+version = "4.0.11"
 description = "Jupyter interactive widgets for Jupyter Notebook"
 optional = false
 python-versions = ">=3.7"
 files = [
-    {file = "widgetsnbextension-4.0.10-py3-none-any.whl", hash = "sha256:d37c3724ec32d8c48400a435ecfa7d3e259995201fbefa37163124a9fcb393cc"},
-    {file = "widgetsnbextension-4.0.10.tar.gz", hash = "sha256:64196c5ff3b9a9183a8e699a4227fb0b7002f252c814098e66c4d1cd0644688f"},
+    {file = "widgetsnbextension-4.0.11-py3-none-any.whl", hash = "sha256:55d4d6949d100e0d08b94948a42efc3ed6dfdc0e9468b2c4b128c9a2ce3a7a36"},
+    {file = "widgetsnbextension-4.0.11.tar.gz", hash = "sha256:8b22a8f1910bfd188e596fe7fc05dcbd87e810c8a4ba010bdb3da86637398474"},
 ]
 
 [[package]]
@@ -5196,4 +5197,4 @@ plots = ["matplotlib"]
 [metadata]
 lock-version = "2.0"
 python-versions = ">=3.10, <3.11"
-content-hash = "153aea43c466cfe9e8b8cfa252956eb58cf521c767bd4fc3133db2f5ba32e336"
+content-hash = "604c1b6ebf699943ea38f98f2482d996a3d99c0d5a47361d20f28337d3acf05a"

+ 1 - 1
pyproject.toml

@@ -12,7 +12,7 @@ include = ["LICENCE"]  # poetry uses US English so assumes it will be spelt LICE
 python = ">=3.10, <3.11"
 matplotlib = { version = "^3.7.1", optional = true }
 doit = "^0.36.0"
-primap2 = ">=0.9.8"
+primap2 = ">=0.11.0"
 pycountry = "^22.3.5"
 datalad = "^0.19.3"
 treelib = "^1.7.0"

+ 47 - 139
src/unfccc_ghg_data/helper/functions.py

@@ -70,6 +70,8 @@ def process_data_for_country(  # noqa PLR0913, PLR0912, PLR0915
         Categories to return
     processing_info_country
         more detailed processing info TODO: explain format
+        The "aggregate_cats" flag is deprecated and will be removed in a future
+        version. Please use "aggregate_coord" with key "category" instead
 
     Returns
     -------
@@ -263,58 +265,43 @@ def process_data_for_country(  # noqa PLR0913, PLR0912, PLR0915
                     )
 
         # aggregate categories
-        # TODO replace by primap2 function once it is in primap2 stable
         if "aggregate_cats" in processing_info_country:
-            data_country = data_country.pr.dequantify()
+            warnings.warn(
+                'The "aggregate_cats" flag is deprecated and will '
+                "be removed in a future version. Please use "
+                '"aggregate_coord" with key "category" instead',
+                category=DeprecationWarning,
+            )
+            print(
+                f"Aggregating categories for country {country_code}, source {source}, "
+                f"scenario {scenario}"
+            )
+
+            # prep input to add_aggregates_coordinates
+            agg_info = {"category": processing_info_country["aggregate_cats"]}
+
             if "agg_tolerance" in processing_info_country:
                 agg_tolerance = processing_info_country["agg_tolerance"]
             else:
                 agg_tolerance = tolerance
-            aggregate_cats_current = processing_info_country["aggregate_cats"]
+
+            data_country = data_country.pr.add_aggregates_coordinates(
+                agg_info=agg_info,
+                tolerance=agg_tolerance,
+                skipna=True,
+                min_count=1,
+            )
+
+        if "aggregate_coord" in processing_info_country:
             print(
-                f"Aggregating categories for country {country_code}, source {source}, "
+                f"Aggregating data for country {country_code}, source {source}, "
                 f"scenario {scenario}"
             )
-            for cat_to_agg in aggregate_cats_current:
-                print(f"Category: {cat_to_agg}")
-                source_cats = aggregate_cats_current[cat_to_agg]["sources"]
-                data_agg = data_country.pr.loc[{"category": source_cats}].pr.sum(
-                    dim="category", skipna=True, min_count=1
-                )
-                nan_vars = [
-                    var
-                    for var in data_agg.data_vars
-                    if data_agg[var].isnull().all().data is True  # noqa: PD003
-                ]
-                data_agg = data_agg.drop(nan_vars)
-                if len(data_agg.data_vars) > 0:
-                    data_agg = data_agg.expand_dims(
-                        [f"category (" f"{cat_terminology_in})"]
-                    )
-                    data_agg = data_agg.assign_coords(
-                        coords={
-                            f"category ({cat_terminology_in})": (
-                                f"category ({cat_terminology_in})",
-                                [cat_to_agg],
-                            )
-                        }
-                    )
-                    if cat_name_present:
-                        cat_name = aggregate_cats_current[cat_to_agg]["name"]
-                        data_agg = data_agg.assign_coords(
-                            coords={
-                                "orig_cat_name": (
-                                    f"category ({cat_terminology_in})",
-                                    [cat_name],
-                                )
-                            }
-                        )
-                    data_country = data_country.pr.merge(
-                        data_agg, tolerance=agg_tolerance
-                    )
-                else:
-                    print(f"no data to aggregate category {cat_to_agg}")
-            data_country = data_country.pr.quantify()
+            data_country = data_country.pr.add_aggregates_coordinates(
+                agg_info=processing_info_country["aggregate_coords"],
+                skipna=True,
+                min_count=1,
+            )
 
         # copy HFCs and PFCs with default factors
         if "basket_copy" in processing_info_country:
@@ -333,13 +320,9 @@ def process_data_for_country(  # noqa PLR0913, PLR0912, PLR0915
 
         # aggregate gases if desired
         if "aggregate_gases" in processing_info_country:
-            # TODO: why use different code here than below. Can this fill non-existen
-            #  gas baskets?
-            for case in processing_info_country["aggregate_gases"].keys():
-                case_info = processing_info_country["aggregate_gases"][case]
-                data_country[
-                    case_info["basket"]
-                ] = data_country.pr.fill_na_gas_basket_from_contents(**case_info)
+            data_country = data_country.pr.add_aggregates_variables(
+                gases=processing_info_country["aggregate_gases"],
+            )
 
     # 3: map categories
     if category_conversion is not None:
@@ -366,40 +349,10 @@ def process_data_for_country(  # noqa PLR0913, PLR0912, PLR0915
         data_country = data_country.pr.loc[{"category": cats_to_keep}]
 
     # create gas baskets
-    entities_present = set(data_country.data_vars)
-    for basket in gas_baskets.keys():
-        basket_contents_present = [
-            gas for gas in gas_baskets[basket] if gas in entities_present
-        ]
-        if len(basket_contents_present) > 0:
-            if basket in list(data_country.data_vars):
-                data_country[basket] = data_country.pr.fill_na_gas_basket_from_contents(
-                    basket=basket,
-                    basket_contents=basket_contents_present,
-                    skipna=True,
-                    min_count=1,
-                )
-            else:
-                try:
-                    # print(data_country.data_vars)
-                    data_country[basket] = xr.full_like(
-                        data_country["CO2"], np.nan
-                    ).pr.quantify(units="Gg CO2 / year")
-                    data_country[basket].attrs = {
-                        "entity": basket.split(" ")[0],
-                        "gwp_context": basket.split(" ")[1][1:-1],
-                    }
-                    data_country[basket] = data_country.pr.gas_basket_contents_sum(
-                        basket=basket,
-                        basket_contents=basket_contents_present,
-                        min_count=1,
-                    )
-                    entities_present.add(basket)
-                except Exception as ex:
-                    print(
-                        f"No gas basket created for {country_code}, {source}, "
-                        f"{scenario}: {ex}"
-                    )
+    if gas_baskets:
+        data_country = data_country.pr.add_aggregates_variables(
+            gas_baskets=gas_baskets, skipna=True, min_count=1
+        )
 
     # amend title and comment
     data_country.attrs["comment"] = (
@@ -423,14 +376,9 @@ def convert_categories(
     """
     convert data from one category terminology to another
 
-    # TODO rewrite to use aggregate_coordinates functions
     """
     print(f"converting categories to {terminology_to}")
 
-    if "orig_cat_name" in ds_input.coords:
-        cat_name_present = True
-    else:
-        cat_name_present = False
     ds_converted = ds_input.copy(deep=True)
     ds_converted.attrs = deepcopy(ds_input.attrs)
     # TODO: change attrs for additional coordinates
@@ -456,57 +404,17 @@ def convert_categories(
             {f"category ({terminology_to})": (f"category ({terminology_to})", to_cats)}
         )
 
-    # redo the list of present cats after mapping, as we have new categories in the
-    # target terminology now
-    cats_present_mapped = list(
-        ds_converted.coords[f"category (" f"{terminology_to})"].values
-    )
     # aggregate categories
     if "aggregate" in conversion:
-        aggregate_cats = conversion["aggregate"]
-        for cat_to_agg in aggregate_cats:
-            if debug:
-                print(f"Category: {cat_to_agg}")
-            source_cats = [
-                cat
-                for cat in aggregate_cats[cat_to_agg]["sources"]
-                if cat in cats_present_mapped
-            ]
-            if debug:
-                print(source_cats)
-            data_agg = ds_converted.pr.loc[{"category": source_cats}].pr.sum(
-                dim="category", skipna=True, min_count=1
-            )
-            nan_vars = [
-                var
-                for var in data_agg.data_vars
-                if data_agg[var].isnull().all().data is True  # noqa: PD003
-            ]
-            data_agg = data_agg.drop(nan_vars)
-            if len(data_agg.data_vars) > 0:
-                data_agg = data_agg.expand_dims([f"category ({terminology_to})"])
-                data_agg = data_agg.assign_coords(
-                    coords={
-                        f"category ({terminology_to})": (
-                            f"category ({terminology_to})",
-                            [cat_to_agg],
-                        )
-                    }
-                )
-                if cat_name_present:
-                    data_agg = data_agg.assign_coords(
-                        coords={
-                            "orig_cat_name": (
-                                f"category ({terminology_to})",
-                                [aggregate_cats[cat_to_agg]["name"]],
-                            )
-                        }
-                    )
-                ds_converted = ds_converted.pr.merge(data_agg, tolerance=tolerance)
-                cats_present_mapped.append(cat_to_agg)
-            else:
-                print(f"no data to aggregate category {cat_to_agg}")
-
+        agg_info = {
+            "category": conversion["aggregate"],
+        }
+        ds_converted = ds_converted.pr.add_aggregates_coordinates(
+            agg_info=agg_info,
+            tolerance=tolerance,
+            skipna=True,
+            min_count=1,
+        )
     return ds_converted
 
 

+ 21 - 16
src/unfccc_ghg_data/unfccc_di_reader/unfccc_di_reader_config.py

@@ -333,33 +333,36 @@ cat_conversion = {
             "7": "5",
         },  # 5.A-D ignored as not fitting 2006 cats
         "aggregate": {
-            "2.B": {"sources": ["M.2.B_2.B", "M.2.B_2.E"], "name": "Chemical Industry"},
-            "2.H": {"sources": ["M.2.H.1_2", "2.H.3"], "name": "Other"},
+            "2.B": {
+                "sources": ["M.2.B_2.B", "M.2.B_2.E"],
+                "orig_cat_name": "Chemical Industry",
+            },
+            "2.H": {"sources": ["M.2.H.1_2", "2.H.3"], "orig_cat_name": "Other"},
             #'2': {'sources': ['2.A', '2.B', '2.C', '2.F', '2.H'],
             #      'name': 'Industrial Processes and Product Use'},
-            "3.A": {"sources": ["3.A.1", "3.A.2"], "name": "Livestock"},
+            "3.A": {"sources": ["3.A.1", "3.A.2"], "orig_cat_name": "Livestock"},
             "3.C.1": {
                 "sources": ["3.C.1.b", "3.C.1.c"],
-                "name": "Emissions from biomass burning",
+                "orig_cat_name": "Emissions from biomass burning",
             },
             "M.3.C.1.AG": {
                 "sources": ["3.C.1.b", "3.C.1.c"],
-                "name": "Emissions from biomass burning (Agriculture)",
+                "orig_cat_name": "Emissions from biomass burning (Agriculture)",
             },
             "3.C": {
                 "sources": ["3.C.1", "M.3.C.45.AG", "3.C.7", "3.C.8"],
-                "name": "Aggregate sources and non-CO2 emissions sources on land",
+                "orig_cat_name": "Aggregate sources and non-CO2 emissions sources on land",
             },
             "M.3.C.AG": {
                 "sources": ["M.3.C.1.AG", "M.3.C.45.AG", "3.C.7", "3.C.8"],
-                "name": "Aggregate sources and non-CO2 emissions sources on land ("
+                "orig_cat_name": "Aggregate sources and non-CO2 emissions sources on land ("
                 "Agriculture)",
             },
             "M.AG.ELV": {
                 "sources": ["M.3.C.AG"],
-                "name": "Agriculture excluding livestock",
+                "orig_cat_name": "Agriculture excluding livestock",
             },
-            "3": {"sources": ["M.AG", "M.LULUCF"], "name": "AFOLU"},
+            "3": {"sources": ["M.AG", "M.LULUCF"], "orig_cat_name": "AFOLU"},
         },
     },
 }
@@ -541,15 +544,15 @@ di_processing_templates = {
             "aggregate_cats": {
                 "2": {
                     "sources": ["2.A", "2.B", "2.C"],
-                    "name": "2.  Industrial Processes",
+                    "orig_cat_name": "2.  Industrial Processes",
                 },
                 "15163": {
                     "sources": ["1", "2", "4", "6"],
-                    "name": "Total GHG emissions excluding LULUCF/LUCF",
+                    "orig_cat_name": "Total GHG emissions excluding LULUCF/LUCF",
                 },
                 "24540": {
                     "sources": ["1", "2", "5", "4", "6"],
-                    "name": "Total GHG emissions including LULUCF/LUCF",
+                    "orig_cat_name": "Total GHG emissions including LULUCF/LUCF",
                 },
             },
         },
@@ -949,7 +952,7 @@ di_processing_templates = {
             "aggregate_cats": {
                 "14637": {
                     "sources": ["14423", "14424"],
-                    "name": "International Bunkers",
+                    "orig_cat_name": "International Bunkers",
                 },
             },
             # downscaling in two steps
@@ -1137,7 +1140,7 @@ di_processing_templates = {
                 "5": {
                     "parent": "24540",
                     "subtract": ["15163"],
-                    "name": "5.  Land-Use Change and Forestry",
+                    "orig_cat_name": "5.  Land-Use Change and Forestry",
                 },
             },
             "downscale": {  # not tested yet
@@ -1454,7 +1457,9 @@ di_processing_templates = {
         },
     },
     "ERI": {
-        "DI2023-05-24": {  # 1994 1995-1999 (partial coverage, KYOTOGHG and total are incomplete), 2000
+        "DI2023-05-24": {
+            # 1994 1995-1999 (partial coverage, KYOTOGHG
+            # and total are incomplete), 2000
             "remove_ts": {
                 "energy_N2O": {  # very high in 1994
                     "category": ["1", "1.A", "15163", "24540"],
@@ -1785,7 +1790,7 @@ di_processing_templates = {
             "aggregate_cats": {
                 "1.B": {
                     "sources": ["1.B.2"],
-                    "name": "1.B  Fugitive Emissions from Fuels",
+                    "orig_cat_name": "1.B  Fugitive Emissions from Fuels",
                 },
             },
         },

+ 202 - 97
src/unfccc_ghg_data/unfccc_reader/Argentina/config_arg_bur5.py

@@ -76,11 +76,11 @@ meta_data = {
 cats_to_agg = {  # name is just for readability, not used
     "1.A.1.c": {
         "sources": ["1.A.1.c.ii"],
-        "name": "Manufacture of Solid Fuels and Other Energy Industries",
+        # "orig_cat_name": "Manufacture of Solid Fuels and Other Energy Industries",
     },
     "1.A.1": {
         "sources": ["1.A.1.a", "1.A.1.b", "1.A.1.c"],
-        "name": "Energy Industries",
+        # "orig_cat_name": "Energy Industries",
     },
     "1.A.2": {
         "sources": [
@@ -95,38 +95,59 @@ cats_to_agg = {  # name is just for readability, not used
             "1.A.2.l",
             "1.A.2.m",
         ],
-        "name": "Manufacturing Industries and Construction",
+        # "orig_cat_name": "Manufacturing Industries and Construction",
+    },
+    "1.A.3.a": {
+        "sources": ["1.A.3.a.ii"],
+        # "orig_cat_name": "Civil Aviation"
     },
-    "1.A.3.a": {"sources": ["1.A.3.a.ii"], "name": "Civil Aviation"},
     "1.A.3.b": {
         "sources": ["1.A.3.b.iii", "1.A.3.b.vii"],
-        "name": "Road Transportation",
+        # "orig_cat_name": "Road Transportation",
+    },
+    "1.A.3.d": {
+        "sources": ["1.A.3.d.ii"],
+        # "orig_cat_name": "Water-Borne Navigation"
+    },
+    "1.A.3.e": {
+        "sources": ["1.A.3.e.i"],
+        # "orig_cat_name": "Other Transportation"
     },
-    "1.A.3.d": {"sources": ["1.A.3.d.ii"], "name": "Water-Borne Navigation"},
-    "1.A.3.e": {"sources": ["1.A.3.e.i"], "name": "Other Transportation"},
     "1.A.3": {
         "sources": ["1.A.3.a", "1.A.3.b", "1.A.3.c", "1.A.3.d", "1.A.3.e"],
-        "name": "Transport",
+        # "orig_cat_name": "Transport",
     },
     "1.A.4.a": {
         "sources": ["1.A.4.a.i", "1.A.4.a.ii", "1.A.4.a.iii"],
-        "name": "Commercial/Institutional",
+        # "orig_cat_name": "Commercial/Institutional",
+    },
+    "1.A.4": {
+        "sources": ["1.A.4.a", "1.A.4.b", "1.A.4.c"],
+        # "orig_cat_name": "Other Sectors"
     },
-    "1.A.4": {"sources": ["1.A.4.a", "1.A.4.b", "1.A.4.c"], "name": "Other Sectors"},
     "1.A": {
         "sources": ["1.A.1", "1.A.2", "1.A.3", "1.A.4"],
-        "name": "Fuel Combustion Activities",
+        # "orig_cat_name": "Fuel Combustion Activities",
     },
     "1.B.1.a.i": {
         "sources": ["1.B.1.a.i.1", "1.B.1.a.i.2"],
-        "name": "Underground mines",
+        # "orig_cat_name": "Underground mines",
+    },
+    "1.B.1.a": {
+        "sources": ["1.B.1.a.i"],
+        # "orig_cat_name": "Coal Mining and Handling"
+    },
+    "1.B.1.c": {
+        "sources": ["1.B.1.c.i"],
+        # "orig_cat_name": "Solid Fuel Transformation"
+    },
+    "1.B.1": {
+        "sources": ["1.B.1.a", "1.B.1.c"],
+        # "orig_cat_name": "Solid Fuels"
     },
-    "1.B.1.a": {"sources": ["1.B.1.a.i"], "name": "Coal Mining and Handling"},
-    "1.B.1.c": {"sources": ["1.B.1.c.i"], "name": "Solid Fuel Transformation"},
-    "1.B.1": {"sources": ["1.B.1.a", "1.B.1.c"], "name": "Solid Fuels"},
     "1.B.2.a": {
         "sources": ["1.B.2.a.i", "1.B.2.a.ii", "1.B.2.a.iii", "1.B.2.a.iv"],
-        "name": "Oil",
+        # "orig_cat_name": "Oil",
     },
     "1.B.2.b": {
         "sources": [
@@ -137,42 +158,66 @@ cats_to_agg = {  # name is just for readability, not used
             "1.B.2.b.v",
             "1.B.2.b.vi",
         ],
-        "name": "Natural Gas",
+        # "orig_cat_name": "Natural Gas",
+    },
+    "1.B.2": {
+        "sources": ["1.B.2.a", "1.B.2.b"],
+        # "orig_cat_name": "Oil and Natural Gas"
+    },
+    "1.B": {
+        "sources": ["1.B.1", "1.B.2"],
+        # "orig_cat_name": "Fugitive Emissions from Fuels"
+    },
+    "1": {
+        "sources": ["1.A", "1.B"],
+        # "orig_cat_name": "Energy"
     },
-    "1.B.2": {"sources": ["1.B.2.a", "1.B.2.b"], "name": "Oil and Natural Gas"},
-    "1.B": {"sources": ["1.B.1", "1.B.2"], "name": "Fugitive Emissions from Fuels"},
-    "1": {"sources": ["1.A", "1.B"], "name": "Energy"},
     "2.A.4": {
         "sources": ["2.A.4.a", "2.A.4.b", "2.A.4.d"],
-        "name": "Other Process Uses of Carbonates",
+        # "orig_cat_name": "Other Process Uses of Carbonates",
+    },
+    "2.A": {
+        "sources": ["2.A.1", "2.A.2", "2.A.4"],
+        # "orig_cat_name": "Mineral Industry"
     },
-    "2.A": {"sources": ["2.A.1", "2.A.2", "2.A.4"], "name": "Mineral Industry"},
     "2.B.8": {
         "sources": ["2.B.8.a", "2.B.8.b", "2.B.8.c", "2.B.8.f"],
-        "name": "Petrochemical and Carbon Black Production",
+        # "orig_cat_name": "Petrochemical and Carbon Black Production",
+    },
+    "2.B.9": {
+        "sources": ["2.B.9.a"],
+        # "orig_cat_name": "Fluorochemical Production"
     },
-    "2.B.9": {"sources": ["2.B.9.a"], "name": "Fluorochemical Production"},
     "2.B": {
         "sources": ["2.B.1", "2.B.2", "2.B.5", "2.B.7", "2.B.8", "2.B.9"],
-        "name": "Chemical Industry",
+        # "orig_cat_name": "Chemical Industry",
+    },
+    "2.C": {
+        "sources": ["2.C.1", "2.C.2", "2.C.3", "2.C.6"],
+        # "orig_cat_name": "Metal Industry"
     },
-    "2.C": {"sources": ["2.C.1", "2.C.2", "2.C.3", "2.C.6"], "name": "Metal Industry"},
     "2.D": {
         "sources": ["2.D.1", "2.D.2"],
-        "name": "Non-Energy Products from Fuels and Solvent Use",
+        # "orig_cat_name": "Non-Energy Products from Fuels and Solvent Use",
     },
     "2.F.1": {
         "sources": ["2.F.1.a", "2.F.1.b"],
-        "name": "Refrigeration and Air Conditioning",
+        # "orig_cat_name": "Refrigeration and Air Conditioning",
     },
     "2.F": {
         "sources": ["2.F.1", "2.F.2", "2.F.3", "2.F.4"],
-        "name": "Product Uses as Substitutes for Ozone Depleting Substances",
+        # "orig_cat_name": "Product Uses as Substitutes for Ozone Depleting Substances",
+    },
+    "2": {
+        "sources": ["2.A", "2.B", "2.C", "2.D", "2.F"],
+        # "orig_cat_name": "IPPU"
     },
-    "2": {"sources": ["2.A", "2.B", "2.C", "2.D", "2.F"], "name": "IPPU"},
     # AFOLU
     # 3.A - Livestock
-    "3.A.1.a": {"sources": ["3.A.1.a.i", "3.A.1.a.ii"], "name": "Cattle"},
+    "3.A.1.a": {
+        "sources": ["3.A.1.a.i", "3.A.1.a.ii"],
+        # "orig_cat_name": "Cattle"
+    },
     "3.A.1": {
         "sources": [
             "3.A.1.a",
@@ -184,9 +229,12 @@ cats_to_agg = {  # name is just for readability, not used
             "3.A.1.g",
             "3.A.1.h",
         ],
-        "name": "Enteric Fermentation",
+        # "orig_cat_name": "Enteric Fermentation",
+    },
+    "3.A.2.a": {
+        "sources": ["3.A.2.a.i", "3.A.2.a.ii"],
+        # "orig_cat_name": "Cattle"
     },
-    "3.A.2.a": {"sources": ["3.A.2.a.i", "3.A.2.a.ii"], "name": "Cattle"},
     "3.A.2": {
         "sources": [
             "3.A.2.a",
@@ -199,73 +247,91 @@ cats_to_agg = {  # name is just for readability, not used
             "3.A.2.h",
             "3.A.2.i",
         ],
-        "name": "Enteric Fermentation",
+        # "orig_cat_name": "Enteric Fermentation",
+    },
+    "3.A": {
+        "sources": ["3.A.1", "3.A.2"],
+        # "orig_cat_name": "Livestock"
     },
-    "3.A": {"sources": ["3.A.1", "3.A.2"], "name": "Livestock"},
     # 3.B - Land
     "3.B.1.a.i": {
         "sources": ["3.B.1.a.i.1", "3.B.1.a.i.2"],
-        "name": "",
+        # "orig_cat_name": "",
     },  # no name, not the normal IPCC category
     "3.B.1.a.ii": {
         "sources": ["3.B.1.a.ii.1", "3.B.1.a.ii.2"],
-        "name": "",
+        # "orig_cat_name": "",
     },  # no name, not the normal IPCC category
     "3.B.1.a": {
         "sources": ["3.B.1.a.i", "3.B.1.a.ii"],
-        "name": "Forest Land Remaining Forest Land",
+        # "orig_cat_name": "Forest Land Remaining Forest Land",
     },
     # '3.B.1.b': {'sources': ['3.B.1.b.i', '3.B.1.b.ii'],
     #             'name': 'Land Converted to Forest Land'},
-    "3.B.1": {"sources": ["3.B.1.a"], "name": "Forest Land"},  # , '3.B.1.b'],
+    "3.B.1": {
+        "sources": ["3.B.1.a"],
+        # "orig_cat_name": "Forest Land"
+    },  # , '3.B.1.b'],
     "3.B.2.b": {
         "sources": ["3.B.2.b.i", "3.B.2.b.ii"],
-        "name": "Land Converted to Cropland",
+        # "orig_cat_name": "Land Converted to Cropland",
+    },
+    "3.B.2": {
+        "sources": ["3.B.2.b"],
+        # "orig_cat_name": "Cropland"
     },
-    "3.B.2": {"sources": ["3.B.2.b"], "name": "Cropland"},
     "3.B.3.b": {
         "sources": ["3.B.3.b.i", "3.B.3.b.ii"],
-        "name": "Land Converted to Grassland",
+        # "orig_cat_name": "Land Converted to Grassland",
+    },
+    "3.B.3": {
+        "sources": ["3.B.3.b"],
+        # "orig_cat_name": "Grassland"
+    },
+    "3.B": {
+        "sources": ["3.B.1", "3.B.2", "3.B.3", "3.B.7"],
+        # "orig_cat_name": "Land"
     },
-    "3.B.3": {"sources": ["3.B.3.b"], "name": "Grassland"},
-    "3.B": {"sources": ["3.B.1", "3.B.2", "3.B.3", "3.B.7"], "name": "Land"},
     # 3.C - Aggregate Sources and Non-CO2 Emissions Sources on Land
     "3.C.1.a": {
         "sources": ["3.C.1.a.i", "3.C.1.a.ii"],
-        "name": "Biomass Burning in Forest Lands",
+        # "orig_cat_name": "Biomass Burning in Forest Lands",
     },
     "3.C.1.b": {
         "sources": ["3.C.1.b.i", "3.C.1.b.ii"],
-        "name": "Biomass Burning in Croplands",
+        # "orig_cat_name": "Biomass Burning in Croplands",
     },
     "M.3.C.1.b.AG": {
         "sources": ["3.C.1.b.i"],
-        "name": "Biomass Burning in Croplands - Agriculture",
+        # "orig_cat_name": "Biomass Burning in Croplands - Agriculture",
     },
     "M.3.C.1.b.LU": {
         "sources": ["3.C.1.b.ii"],
-        "name": "Biomass Burning in Croplands - LULUCF",
+        # "orig_cat_name": "Biomass Burning in Croplands - LULUCF",
     },
     "3.C.1.c": {
         "sources": ["3.C.1.c.i", "3.C.1.c.ii"],
-        "name": "Biomass Burning in Grasslands",
+        # "orig_cat_name": "Biomass Burning in Grasslands",
     },
     "M.3.C.1.c.AG": {
         "sources": ["3.C.1.c.i"],
-        "name": "Biomass Burning in Grasslands - Agriculture",
+        # "orig_cat_name": "Biomass Burning in Grasslands - Agriculture",
     },
     "M.3.C.1.c.LU": {
         "sources": ["3.C.1.c.ii"],
-        "name": "Biomass Burning in Grasslands - LULUCF",
+        # "orig_cat_name": "Biomass Burning in Grasslands - LULUCF",
+    },
+    "3.C.1": {
+        "sources": ["3.C.1.a", "3.C.1.b", "3.C.1.c"],
+        # "orig_cat_name": "Biomass Burning"
     },
-    "3.C.1": {"sources": ["3.C.1.a", "3.C.1.b", "3.C.1.c"], "name": "Biomass Burning"},
     "M.3.C.1.AG": {
         "sources": ["M.3.C.1.b.AG", "M.3.C.1.c.AG"],
-        "name": "Biomass Burning - Agriculture",
+        # "orig_cat_name": "Biomass Burning - Agriculture",
     },
     "M.3.C.1.LU": {
         "sources": ["3.C.1.a", "M.3.C.1.b.LU", "M.3.C.1.c.LU"],
-        "name": "Biomass Burning",
+        # "orig_cat_name": "Biomass Burning",
     },
     "3.C.4.d": {
         "sources": [
@@ -277,11 +343,11 @@ cats_to_agg = {  # name is just for readability, not used
             "3.C.4.d.vi",
             "3.C.4.d.vii",
         ],
-        "name": "",
+        # "orig_cat_name": "",
     },  # not standard IPCC2006
     "3.C.4.g": {
         "sources": ["3.C.4.g.i", "3.C.4.g.ii"],
-        "name": "",
+        # "orig_cat_name": "",
     },  # not standard IPCC2006
     "3.C.4": {
         "sources": [
@@ -295,47 +361,47 @@ cats_to_agg = {  # name is just for readability, not used
             "3.C.4.n",
             "3.C.4.o",
         ],
-        "name": "Direct N2O Emissions from Managed Soils",
+        # "orig_cat_name": "Direct N2O Emissions from Managed Soils",
     },
     "3.C.5.a": {
         "sources": ["3.C.5.a.i", "3.C.5.a.ii"],
-        "name": "",
+        # "orig_cat_name": "",
     },  # not standard IPCC2006
     "3.C.5.b": {
         "sources": ["3.C.5.b.i", "3.C.5.b.ii"],
-        "name": "",
+        # "orig_cat_name": "",
     },  # not standard IPCC2006
     "3.C.5.c": {
         "sources": ["3.C.5.c.i", "3.C.5.c.ii"],
-        "name": "",
+        # "orig_cat_name": "",
     },  # not standard IPCC2006
     "3.C.5.d.i": {
         "sources": ["3.C.5.d.i.1", "3.C.5.d.i.2"],
-        "name": "",
+        # "orig_cat_name": "",
     },  # not standard IPCC2006
     "3.C.5.d.ii": {
         "sources": ["3.C.5.d.ii.1", "3.C.5.d.ii.2"],
-        "name": "",
+        # "orig_cat_name": "",
     },  # not standard IPCC2006
     "3.C.5.d.iii": {
         "sources": ["3.C.5.d.iii.1", "3.C.5.d.iii.2"],
-        "name": "",
+        # "orig_cat_name": "",
     },  # not standard IPCC2006
     "3.C.5.d.iv": {
         "sources": ["3.C.5.d.iv.1", "3.C.5.d.iv.2"],
-        "name": "",
+        # "orig_cat_name": "",
     },  # not standard IPCC2006
     "3.C.5.d.v": {
         "sources": ["3.C.5.d.v.1", "3.C.5.d.v.2"],
-        "name": "",
+        # "orig_cat_name": "",
     },  # not standard IPCC2006
     "3.C.5.d.vi": {
         "sources": ["3.C.5.d.vi.1", "3.C.5.d.vi.2"],
-        "name": "",
+        # "orig_cat_name": "",
     },  # not standard IPCC2006
     "3.C.5.d.vii": {
         "sources": ["3.C.5.d.vii.1", "3.C.5.d.vii.2"],
-        "name": "",
+        # "orig_cat_name": "",
     },  # not standard IPCC2006
     "3.C.5.d": {
         "sources": [
@@ -347,28 +413,31 @@ cats_to_agg = {  # name is just for readability, not used
             "3.C.5.d.vi",
             "3.C.5.d.vii",
         ],
-        "name": "",
+        # "orig_cat_name": "",
+    },  # not standard IPCC2006
+    "3.C.5.f": {
+        "sources": ["3.C.5.f.ii"],
+        # "orig_cat_name": ""
     },  # not standard IPCC2006
-    "3.C.5.f": {"sources": ["3.C.5.f.ii"], "name": ""},  # not standard IPCC2006
     "3.C.5.g.i": {
         "sources": ["3.C.5.g.i.1", "3.C.5.g.i.2"],
-        "name": "",
+        # "orig_cat_name": "",
     },  # not standard IPCC2006
     "3.C.5.g.ii": {
         "sources": ["3.C.5.g.ii.1", "3.C.5.g.ii.2"],
-        "name": "",
+        # "orig_cat_name": "",
     },  # not standard IPCC2006
     "3.C.5.g": {
         "sources": ["3.C.5.g.i", "3.C.5.g.ii"],
-        "name": "",
+        # "orig_cat_name": "",
     },  # not standard IPCC2006
     "3.C.5.n": {
         "sources": ["3.C.5.n.i", "3.C.5.n.ii"],
-        "name": "",
+        # "orig_cat_name": "",
     },  # not standard IPCC2006
     "3.C.5.o": {
         "sources": ["3.C.5.o.i", "3.C.5.o.ii"],
-        "name": "",
+        # "orig_cat_name": "",
     },  # not standard IPCC2006
     "3.C.5": {
         "sources": [
@@ -382,60 +451,96 @@ cats_to_agg = {  # name is just for readability, not used
             "3.C.5.n",
             "3.C.5.o",
         ],
-        "name": "Indirect N2O Emissions from Managed Soils",
+        # "orig_cat_name": "Indirect N2O Emissions from Managed Soils",
     },
-    "3.C.6.a.i": {"sources": ["3.C.6.a.i.1"], "name": ""},  # not standard IPCC2006
+    "3.C.6.a.i": {
+        "sources": ["3.C.6.a.i.1"],
+        # "orig_cat_name": ""
+    },  # not standard IPCC2006
     "3.C.6.a.ii": {
         "sources": ["3.C.6.a.ii.1", "3.C.6.a.ii.2"],
-        "name": "",
+        # "orig_cat_name": "",
     },  # not standard IPCC2006
     "3.C.6.a": {
         "sources": ["3.C.6.a.i", "3.C.6.a.ii"],
-        "name": "",
+        # "orig_cat_name": "",
     },  # not standard IPCC2006
     "3.C.6.h": {
         "sources": ["3.C.6.h.i", "3.C.6.h.ii"],
-        "name": "",
+        # "orig_cat_name": "",
+    },  # not standard IPCC2006
+    "3.C.6.i": {
+        "sources": ["3.C.6.i.i"],
+        # "orig_cat_name": ""
     },  # not standard IPCC2006
-    "3.C.6.i": {"sources": ["3.C.6.i.i"], "name": ""},  # not standard IPCC2006
     "3.C.6": {
         "sources": ["3.C.6.a", "3.C.6.h", "3.C.6.i"],
-        "name": "Indirect N2O Emissions from Manure Management",
+        # "orig_cat_name": "Indirect N2O Emissions from Manure Management",
     },
     "3.C": {
         "sources": ["3.C.1", "3.C.3", "3.C.4", "3.C.5", "3.C.6", "3.C.7"],
-        "name": "Emissions from Biomass Burning",
+        # "orig_cat_name": "Emissions from Biomass Burning",
     },
     "M.3.C.AG": {
         "sources": ["M.3.C.1.AG", "3.C.3", "3.C.4", "3.C.5", "3.C.6", "3.C.7"],
-        "name": "Emissions from Biomass Burning - Agriculture",
+        # "orig_cat_name": "Emissions from Biomass Burning - Agriculture",
+    },
+    "M.AG.ELV": {
+        "sources": ["M.3.C.AG"],
+        # "orig_cat_name": "Agriculture Excluding Livestock"
     },
-    "M.AG.ELV": {"sources": ["M.3.C.AG"], "name": "Agriculture Excluding Livestock"},
     "M.3.C.LU": {
         "sources": ["M.3.C.1.LU"],
-        "name": "Emissions from Biomass Burning - LULUCF",
+        # "orig_cat_name": "Emissions from Biomass Burning - LULUCF",
+    },
+    "3.D": {
+        "sources": ["3.D.1"],
+        # "orig_cat_name": "Other"
+    },
+    "M.3.D.LU": {
+        "sources": ["3.D.1"],
+        # "orig_cat_name": "Other - LULUCF"
+    },
+    "3": {
+        "sources": ["3.A", "3.B", "3.C", "3.D"],
+        # "orig_cat_name": "AFOLU"
+    },
+    "M.AG": {
+        "sources": ["3.A", "M.3.C.AG"],
+        # "orig_cat_name": "Agriculture"
+    },
+    "M.LULUCF": {
+        "sources": ["3.B", "M.3.C.LU", "3.D"],
+        # "orig_cat_name": "LULUCF"
     },
-    "3.D": {"sources": ["3.D.1"], "name": "Other"},
-    "M.3.D.LU": {"sources": ["3.D.1"], "name": "Other - LULUCF"},
-    "3": {"sources": ["3.A", "3.B", "3.C", "3.D"], "name": "AFOLU"},
-    "M.AG": {"sources": ["3.A", "M.3.C.AG"], "name": "Agriculture"},
-    "M.LULUCF": {"sources": ["3.B", "M.3.C.LU", "3.D"], "name": "LULUCF"},
     # waste
-    "4.A": {"sources": ["4.A.1", "4.A.3"], "name": "Solid Waste Disposal"},
-    "4.C": {"sources": ["4.C.1"], "name": "Incineration and Open Burning of Waste"},
+    "4.A": {
+        "sources": ["4.A.1", "4.A.3"],
+        # "orig_cat_name": "Solid Waste Disposal"
+    },
+    "4.C": {
+        "sources": ["4.C.1"],
+        # "orig_cat_name": "Incineration and Open Burning of Waste"
+    },
     "4.D.2": {
         "sources": ["4.D.2.a", "4.D.2.b", "4.D.2.c", "4.D.2.d", "4.D.2.e"],
-        "name": "Industrial Wastewater Treatment and Discharge",
+        # "orig_cat_name": "Industrial Wastewater Treatment and Discharge",
     },
     "4.D": {
         "sources": ["4.D.1", "4.D.2"],
-        "name": "Wastewater Treatment and Discharge",
+        # "orig_cat_name": "Wastewater Treatment and Discharge",
+    },
+    "4": {
+        "sources": ["4.A", "4.B", "4.C", "4.D"],
+        # "orig_cat_name": "Waste"
     },
-    "4": {"sources": ["4.A", "4.B", "4.C", "4.D"], "name": "Waste"},
     # national totals
-    "0": {"sources": ["1", "2", "3", "4"], "name": "National Total"},
+    "0": {
+        "sources": ["1", "2", "3", "4"],
+        # "orig_cat_name": "National Total"
+    },
     "M.0.EL": {
         "sources": ["1", "2", "M.AG", "4"],
-        "name": "National Total Excluding LULUCF",
+        # "orig_cat_name": "National Total Excluding LULUCF",
     },
 }

+ 0 - 1
src/unfccc_ghg_data/unfccc_reader/Argentina/read_ARG_BUR5_from_csv.py

@@ -98,7 +98,6 @@ if __name__ == "__main__":
         data_if,
     )
 
-    data_pm2 = pm2.pm2io.from_interchange_format(data_if)
     encoding = {var: compression for var in data_pm2.data_vars}
     data_pm2.pr.to_netcdf(
         output_folder

+ 20 - 8
src/unfccc_ghg_data/unfccc_reader/Burundi/config_bdi_bur1.py

@@ -187,20 +187,32 @@ country_processing_step1 = {
                 "3.C.7",
                 "3.C.8",
             ],
-            "name": "Aggregate sources and non-CO2 emissions sources on land "
-            "(Agriculture)",
+            # "name": "Aggregate sources and non-CO2 emissions sources on land "
+            # "(Agriculture)",
+        },
+        "M.3.D.AG": {
+            "sources": ["3.D.2"],
+            # "name": "Other (Agriculture)"
         },
-        "M.3.D.AG": {"sources": ["3.D.2"], "name": "Other (Agriculture)"},
         "M.AG.ELV": {
             "sources": ["M.3.C.AG", "M.3.D.AG"],
-            "name": "Agriculture excluding livestock",
+            # "name": "Agriculture excluding livestock",
+        },
+        "M.AG": {
+            "sources": ["3.A", "M.AG.ELV"],
+            # "name": "Agriculture"
+        },
+        "M.3.D.LU": {
+            "sources": ["3.D.1"],
+            # "name": "Other (LULUCF)"
+        },
+        "M.LULUCF": {
+            "sources": ["3.B", "M.3.D.LU"],
+            # "name": "LULUCF"
         },
-        "M.AG": {"sources": ["3.A", "M.AG.ELV"], "name": "Agriculture"},
-        "M.3.D.LU": {"sources": ["3.D.1"], "name": "Other (LULUCF)"},
-        "M.LULUCF": {"sources": ["3.B", "M.3.D.LU"], "name": "LULUCF"},
         "M.0.EL": {
             "sources": ["1", "2", "M.AG", "4", "5"],
-            "name": "National total emissions excluding LULUCF",
+            # "name": "National total emissions excluding LULUCF",
         },
     },
     "basket_copy": {

+ 7 - 7
src/unfccc_ghg_data/unfccc_reader/Chile/config_chl_bur4.py

@@ -305,16 +305,16 @@ cat_mapping = {  # categories not listed here have the same UNFCCC_GHG_data as i
 # '3.A.4.g.ii.',
 
 aggregate_cats = {
-    "3.A": {"sources": ["3.A.1", "3.A.2"], "name": "Livestock"},
+    "3.A": {"sources": ["3.A.1", "3.A.2"], "orig_cat_name": "Livestock"},
     "3.B": {
         "sources": ["3.B.1", "3.B.2", "3.B.3", "3.B.4", "3.B.5", "3.B.6"],
-        "name": "Land",
+        "orig_cat_name": "Land",
     },
     "3.C.1": {
         "sources": ["3.C.1.b", "3.C.1.c"],
-        "name": "Emissions from Biomass Burning",
+        "orig_cat_name": "Emissions from Biomass Burning",
     },
-    "3.C.8": {"sources": ["3.C.8.a", "3.C.8.b"], "name": "Other"},
+    "3.C.8": {"sources": ["3.C.8.a", "3.C.8.b"], "orig_cat_name": "Other"},
     "3.C": {
         "sources": [
             "3.C.1",
@@ -326,8 +326,8 @@ aggregate_cats = {
             "3.C.7",
             "3.C.8",
         ],
-        "name": "Aggregate sources and non-CO2 emissions sources on land",
+        "orig_cat_name": "Aggregate sources and non-CO2 emissions sources on land",
     },
-    "3.D": {"sources": ["3.D.1", "3.D.2"], "name": "Other"},
-    "3": {"sources": ["3.A", "3.B", "3.C", "3.D"], "name": "AFOLU"},
+    "3.D": {"sources": ["3.D.1", "3.D.2"], "orig_cat_name": "Other"},
+    "3": {"sources": ["3.A", "3.B", "3.C", "3.D"], "orig_cat_name": "AFOLU"},
 }

+ 3 - 1
src/unfccc_ghg_data/unfccc_reader/Chile/read_CHL_BUR4_from_xlsx.py

@@ -303,7 +303,9 @@ if __name__ == "__main__":
             ).sum()
 
             df_combine.insert(0, cat_label, cat_to_agg)
-            df_combine.insert(1, "orig_cat_name", aggregate_cats[cat_to_agg]["name"])
+            df_combine.insert(
+                1, "orig_cat_name", aggregate_cats[cat_to_agg]["orig_cat_name"]
+            )
 
             df_combine = df_combine.reset_index()
 

+ 3 - 1
src/unfccc_ghg_data/unfccc_reader/Chile/read_CHL_BUR5_from_xlsx.py

@@ -311,7 +311,9 @@ if __name__ == "__main__":
             )
 
             df_combine.insert(0, cat_label, cat_to_agg)
-            df_combine.insert(1, "orig_cat_name", aggregate_cats[cat_to_agg]["name"])
+            df_combine.insert(
+                1, "orig_cat_name", aggregate_cats[cat_to_agg]["orig_cat_name"]
+            )
 
             df_combine = df_combine.reset_index()
 

+ 363 - 35
src/unfccc_ghg_data/unfccc_reader/China/config_chn_bur3_nc4.py

@@ -12,52 +12,380 @@ re-generated for the processed version of the data.
 ## general config
 gwp_to_use = "SARGWP100"  # see note above
 
+coords_value_mapping = {
+    "entity": {
+        "CF4": "CF4",
+        "CH4": "CH4",
+        "CO2": "CO2",
+        "HFC-125": "HFC125",
+        "HFC-134a": "HFC134a",
+        "HFC-143a": "HFC143a",
+        "HFC-227ea": "HFC227ea",
+        "HFC-23": "HFC23",
+        "HFC-236fa": "HFC236fa",
+        "HFC-245fa": "HFC245fa",
+        "HFC-32": "HFC32",
+        "HFC-365mfc": "HFC365MFC",
+        "HFCs": f"HFCS ({gwp_to_use})",
+        "HFCs HFC-134a": "HFC134a",
+        "HFCs HFC-152a": "HFC152a",
+        "N2O": "N2O",
+        "PFCs": f"PFCS ({gwp_to_use})",
+        "PFCs C2F6": "C2F6",
+        "SF6": "SF6",
+        "Total": f"KYOTOGHG ({gwp_to_use})",
+        "合计": f"KYOTOGHG ({gwp_to_use})",
+    },
+    "category": {
+        "1. Energy": "1",
+        "2. Industrial Processes": "2",
+        "2. Industrial processes": "2",
+        "3. Agriculture": "3",
+        "4. LULUCF": "4",
+        "4. Land-use change and forestry (LUCF)": "4",
+        "5. Waste": "4",
+        "6. Memo Items": "IGNORE",
+        "6. Memo items": "IGNORE",
+        "Agricultural land": "4.B",
+        "Agricultural soils": "3.D",
+        "Agriculture": "3",
+        "Biological treatment": "M.5.A.BIO",  #  HKG, 2006category 4.B
+        "Biomass combustion": "M.BIO",
+        "CO2 emissions from biomass": "M.BIO",
+        "Cement production": "2.A.1",  # sum to 2.A, HKG
+        "Changes in forest and other woody biomass stocks": "4.A.1",  # sum for HKG
+        "Chemical industry": "2.B",
+        "Consumption of halocarbons and SF6": "2.F",
+        "Cropland": "4.B",
+        "Energy": "1",
+        "Energy industries": "1.A.1",
+        "Energy industry": "1.A.1",
+        "Enteric fermentation": "3.A",
+        "Field burning of agricultural residues": "3.F",
+        "Forest conversion": "M.DEF",
+        "Forest land": "4.A",
+        "Fuel combustion": "1.A",
+        "Fugitive emission": "1.B",
+        "Fugitive emissions": "1.B",
+        "Grassland": "4.C",
+        "Harvested wood products": "4.G.1",
+        "Incineration": "5.C",
+        "Industrial Processes": "2",
+        "Industrial processes": "2",
+        "International aviation": "M.1.A",
+        "International marine": "M.1.B",
+        "International navigation": "M.1.B",
+        "LUCF": "4",
+        "LULUCF": "4",
+        "Land-UseChangeand Forestry (LUCF)": "4",
+        "Landfill": "5.A",
+        "Manufacturing and construction industries": "1.A.2",
+        "Manufacturing industries and construction": "1.A.2",
+        "Manure management": "3.B",
+        "Memo Items": "IGNORE",
+        "Metal industry": "2.C",
+        "Metal production": "2.C",
+        "Mineral industry": "2.A",
+        "Mineral products": "2.A",
+        "Non-energy products from fuels and solvent use": "2.D",  # mixture of 1996 and 2006 categories
+        "Oil and natural gas": "1.B.2",
+        "Oil and natural gas system": "1.B.2",
+        "Other factors": "1.A.4",
+        "Other land": "4.F",
+        "Other sectors": "1.A.4",
+        "Prescribed burning of savannas": "3.E",
+        "Production of halocarbons and SF6": "2.E",
+        "Rice cultivation": "3.C",
+        "Settlements": "4.E",
+        "Solid fuel": "1.B.1",
+        "Solid fuels": "1.B.1",
+        "Solid waste disposal": "5.A",
+        "Special regional aviation": "M.SR.A",  # MAC only
+        "Special regional marine": "M.SR.M",  # MAC only
+        "Total": "0",
+        "Total (with LUCF)": "0",
+        "Total (with LULUCF)": "0",
+        "Total (without LUCF)": "M.0.EL",
+        "Total (without LULUCF)": "M.0.EL",
+        "Total emissions": "0",
+        "Transport": "1.A.3",
+        "Waste": "5",
+        "Wastewater handling": "5.B",
+        "Wastewater treatment": "5.B",
+        "Wetlands": "4.D",
+    },
+}
+
+
+catgory_conversion = {
+    "mapping": {
+        "0": "0",
+        "1": "1",
+        "1.A": "1.A",
+        "1.A.1": "1.A.1",
+        "1.A.2": "1.A.2",
+        "1.A.3": "1.A.3",
+        "1.A.4": "1.A.4",
+        "1.B": "1.B",
+        "1.B.1": "1.B.1",
+        "1.B.2": "1.B.2",
+        "2": "2",
+        "2.A": "2.A",
+        "2.A.1": "2.A.1",
+        "2.B": "2.B",
+        "2.C": "2.C",
+        "2.D": "2.D",
+        "2.E": "2.B.9",
+        "2.F": "2.F",
+        "3": "M.AG",
+        "3.A": "3.A.1",
+        "3.B": "3.A.2",
+        "3.C": "3.C.7",
+        "3.D": "M.3.AS",
+        "3.E": "3.C.1.c",
+        "3.F": "3.C.1.b",
+        "4": "M.LULUCF",
+        "4.A": "3.B.1",
+        "4.A.1": "3.B.1.a",
+        "4.B": "3.B.2",
+        "4.C": "3.B.3",
+        "4.D": "3.B.4",
+        "4.E": "3.B.5",
+        "4.F": "3.B.6",
+        "4.G.1": "3.D.1",
+        "5": "4",
+        "5.A": "4.A",
+        "5.B": "4.D",
+        "5.C": "4.C",
+        "M.0.EL": "M.0.EL",
+        "M.1.A": "M.BK.A",
+        "M.1.B": "M.BK.B",
+        "M.5.A.BIO": "4.B",
+        "M.BIO": "M.BIO",
+        #'M.DEF': '', #
+        #'M.SR.A': '',
+        #'M.SR.M': '',
+    },
+    "aggregate": {"category": {}},
+}
 
 ## 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],
+    "table_groups": {
+        "overview": {
+            "pages": {
+                "CHN": [30],
+                "MAC": [218],
+                "HKG": [190],
+            },
+            "year": 2017,
+            "unit": "kt / year",
+        },
+        "inventory": {
+            "pages": {
+                "CHN": [31, 32],
+                "MAC": [219],
+                "HKG": [191],
+            },
+            "year": 2017,
+            "unit": "kt / year",
+        },
+        "fgas": {
+            "pages": {
+                "CHN": [33],
+                "MAC": [],
+                "HKG": [192],
+            },
+            "year": 2017,
+            "unit": "kt / year",
+        },
     },
-    "pages_fgases": {
-        "CHN": [33],
-        "MAC": [],
-        "HKG": [192],
+    "page_defs": {
+        "30": {  # CHN overview 2017
+            "table_areas": ["77,756,520,582"],
+            "split_text": True,
+            "flavor": "stream",
+        },
+        "31": {  # CHN detail 2017
+            "table_areas": ["73,451,518,74"],
+            "columns": ["294,383,470"],
+            "split_text": True,
+            "flavor": "stream",
+        },
+        "32": {  # CHN detail 2017
+            "table_areas": ["73,777,518,563"],
+            "columns": ["290,379,468"],
+            "split_text": True,
+            "flavor": "stream",
+        },
+        "33": {  # CHN f-gases 2017
+            "table_areas": ["74,508,766,235"],
+            "columns": ["152,198,241,289,342,393,448,505,560,620,682,707,737"],
+            "split_text": False,
+            "flavor": "stream",
+            "row_tol": 10,
+            "rows_to_fix": {
+                2: ["Industrial", "- Chemical"],
+                3: ["- Consumption"],
+                4: ["- Non-energy"],
+            },
+        },
+        "190": {  # HKG overview 2017
+            "table_areas": ["50,427,546,268"],
+            "split_text": True,
+            "flavor": "stream",
+        },
+        "191": {  # HKG detail 2017
+            "table_areas": ["73,754,520,178"],
+            "split_text": True,
+            "flavor": "stream",
+        },
+        "192": {  # HKG f-gases 2017
+            "table_areas": ["74,756,517,472"],
+            "columns": ["181,237,282,332,384,440,480"],
+            "split_text": True,
+            "flavor": "stream",
+            "rows_to_fix": {
+                2: ["GHG source"],
+            },
+        },
+        "218": {  # MAC overview 2017
+            "table_areas": ["73,501,489,341"],
+            "split_text": True,
+            "flavor": "stream",
+        },
+        "219": {  # MAC detail 2017
+            "table_areas": ["73,754,520,339"],
+            "columns": ["291,393,458"],
+            "split_text": True,
+            "flavor": "stream",
+        },
     },
 }
 
 ## 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],
+    "table_groups": {
+        "overview": {
+            "pages": {
+                "CHN": [11],
+                "MAC": [63],
+                "HKG": [43],
+            },
+            "year": 2018,
+            "unit": "kt / year",
+        },
+        "inventory": {
+            "pages": {
+                "CHN": [13, 14],
+                "MAC": [64],
+                "HKG": [44],
+            },
+            "year": 2018,
+            "unit": "kt / year",
+        },
+        "fgas": {
+            "pages": {
+                "CHN": [15],
+                # "MAC": [],
+                "HKG": [45],
+            },
+            "year": 2017,
+            "unit": "kt / year",
+        },
+        "recalc": {
+            "pages": {
+                "CHN": [18],
+                "MAC": [67],
+                "HKG": [50],
+            },
+            "year": 2005,
+            "unit": "kt / year",
+        },
     },
-    "pages_recalc": {
-        "CHN": [18],
-        "MAC": [67],
-        "HKG": [50],
+    "page_def": {
+        "11": {  # CHN overview 2018
+            "table_areas": ["67,584,525,482"],
+            "split_text": True,
+            "flavor": "stream",
+        },
+        "13": {  # CHN detail 2018
+            "table_areas": ["71,565,523,76"],
+            "columns": ["325,389,453"],
+            "split_text": False,
+            "flavor": "stream",
+            "row_tol": 10,
+        },
+        "14": {  # CHN detail 2018
+            "table_areas": ["69,771,526,526"],
+            "columns": ["331,388,453"],
+            "split_text": False,
+            "flavor": "stream",
+        },
+        "15": {  # CHN fgases 2018
+            "table_areas": ["62,493,778,226"],
+            "columns": ["133,180,226,276,334,384,442,502,560,620,687,712,752"],
+            "split_text": False,
+            "flavor": "stream",
+            "row_tol": 10,
+            "rows_to_fix": {
+                2: ["Sources", "2. Industrial", "⎯ Mineral", "⎯ Chemical", "⎯ Metal"],
+                3: ["⎯ Consumption"],
+                4: ["⎯ Non-energy"],
+            },
+        },
+        "18": {  # CHN overview 2005
+            "table_areas": ["84,615,507,503"],
+            "split_text": False,
+            "flavor": "stream",
+        },
+        "43": {  # HKG overview 2018
+            "table_areas": ["86,319,501,220"],
+            "split_text": False,
+            "flavor": "stream",
+        },
+        "44": {  # HKG detail 2018
+            "table_areas": ["83,743,508,171"],
+            "split_text": False,
+            "flavor": "stream",
+        },
+        "45": {  # HKG f-gases 2018
+            "table_areas": ["83,752,508,495"],
+            "split_text": False,
+            "flavor": "stream",
+            "row_tol": 10,
+            "rows_to_fix": {
+                3: ["GHG source and sink"],
+            },
+        },
+        "50": {  # HGK overview 2005
+            "table_areas": ["84,753,499,651"],
+            "split_text": False,
+            "flavor": "stream",
+        },
+        "63": {  # MAC overview 2018
+            "table_areas": ["67,336,514,168"],
+            "columns": ["198,231,275,316,366,408,447"],
+            "split_text": False,
+            "flavor": "stream",
+            "row_tol": 10,
+            "strip_text": ".\n",
+            "rows_to_fix": {
+                2: ["Land-UseChangeand"],
+            },
+        },
+        "64": {  # MAC detail 2018
+            "table_areas": ["66,754,526,387"],
+            "columns": ["308,389,458"],
+            "split_text": False,
+            "flavor": "stream",
+        },
+        "67": {  # MAC overview 2005
+            "table_areas": ["65,549,520,438"],
+            "split_text": False,
+            "flavor": "stream",
+        },
     },
 }

+ 82 - 0
src/unfccc_ghg_data/unfccc_reader/China/read_CHN_BUR3_from_pdf.py

@@ -0,0 +1,82 @@
+"""
+Read data from China's BUR3.
+
+Data are read from pdf. The file contains a detailed inventory for 2018 and
+recalculated 2005 data for the main sectors and gases.
+
+Inventories for mainland China (CHN), Hong Kong (HKG) and Macau (MAC) are reported in
+individual inventories.
+"""
+
+
+import camelot
+import primap2 as pm2
+
+from unfccc_ghg_data.helper import (
+    downloaded_data_path,
+    extracted_data_path,
+    fix_rows,
+)
+from unfccc_ghg_data.unfccc_reader.China.config_chn_bur3_nc4 import (
+    config_bur3,
+    coords_value_mapping,
+)
+
+if __name__ == "__main__":
+    # ###
+    # configuration
+    # ###
+    input_folder = downloaded_data_path / "UNFCCC" / "China" / "BUR3"
+    output_folder = extracted_data_path / "UNFCCC" / "China"
+    if not output_folder.exists():
+        output_folder.mkdir()
+
+    output_filename = "CHN_BUR3_"
+    inventory_file = "China_BUR3_English.pdf"
+
+    def repl(m):  # noqa: D103
+        return m.group("code")
+
+    # ###
+    # read the tables from pdf
+    # ###
+
+    for table_group in config_bur3["table_groups"].keys():
+        current_group = config_bur3["table_groups"][table_group]
+        for country in current_group["pages"].keys():
+            for page in current_group["pages"][country]:
+                print(f"Reading {country}, {table_group}, page {page}")
+                page_str = str(page)
+                page_def = config_bur3["page_def"][page_str]
+                if "rows_to_fix" in page_def:
+                    rows_to_fix = page_def.pop("rows_to_fix")
+                else:
+                    rows_to_fix = {}
+                tables_read = camelot.read_pdf(
+                    str(input_folder / inventory_file), pages=page_str, **page_def
+                )
+                table_df = tables_read[0].df
+                # fix split rows
+                if rows_to_fix:
+                    for n_rows in rows_to_fix.keys():
+                        table_df = fix_rows(table_df, rows_to_fix[n_rows], 0, n_rows)
+                # remove unwanted characters
+                table_df[0] = table_df[0].str.replace("\n", " ")
+                table_df[0] = table_df[0].str.replace("⎯ ", "")
+                table_df[0] = table_df[0].str.replace("♦", "")
+                table_df = pm2.pm2io.nir_add_unit_information(
+                    table_df,
+                    unit_row=0,
+                    entity_row=0,
+                    regexp_entity=".*",
+                    default_unit=current_group["unit"],
+                )
+                table_df = table_df.set_index(table_df.columns[0])
+                table_long = pm2.pm2io.nir_convert_df_to_long(
+                    table_df,
+                    year=current_group["year"],
+                    header_long=["category", "entity", "unit", "time", "data"],
+                )
+                table_long["entity"] = table_long["entity"].str.strip()
+
+    print(sorted(list(set(coords_value_mapping["category"].values()))))

+ 20 - 8
src/unfccc_ghg_data/unfccc_reader/Guinea/config_gin_bur1.py

@@ -328,20 +328,32 @@ country_processing_step1 = {
                 "3.C.7",
                 "3.C.8",
             ],
-            "name": "Aggregate sources and non-CO2 emissions sources on land "
-            "(Agriculture)",
+            # "name": "Aggregate sources and non-CO2 emissions sources on land "
+            # "(Agriculture)",
+        },
+        "M.3.D.AG": {
+            "sources": ["3.D.2"],
+            # "name": "Other (Agriculture)"
         },
-        "M.3.D.AG": {"sources": ["3.D.2"], "name": "Other (Agriculture)"},
         "M.AG.ELV": {
             "sources": ["M.3.C.AG", "M.3.D.AG"],
-            "name": "Agriculture excluding livestock",
+            # "name": "Agriculture excluding livestock",
+        },
+        "M.AG": {
+            "sources": ["3.A", "M.AG.ELV"],
+            # "name": "Agriculture"
+        },
+        "M.3.D.LU": {
+            "sources": ["3.D.1"],
+            # "name": "Other (LULUCF)"
+        },
+        "M.LULUCF": {
+            "sources": ["3.B", "M.3.D.LU"],
+            # "name": "LULUCF"
         },
-        "M.AG": {"sources": ["3.A", "M.AG.ELV"], "name": "Agriculture"},
-        "M.3.D.LU": {"sources": ["3.D.1"], "name": "Other (LULUCF)"},
-        "M.LULUCF": {"sources": ["3.B", "M.3.D.LU"], "name": "LULUCF"},
         "M.0.EL": {
             "sources": ["1", "2", "M.AG", "4"],
-            "name": "National total emissions excluding LULUCF",
+            # "name": "National total emissions excluding LULUCF",
         },
     },
     "basket_copy": {

+ 17 - 10
src/unfccc_ghg_data/unfccc_reader/Indonesia/read_IDN_BUR3_from_pdf.py

@@ -156,29 +156,32 @@ if __name__ == "__main__":
     aggregate_cats = {
         "1.A.4": {
             "sources": ["1.A.4.a", "1.A.4.b"],
-            "name": "Other Sectors (calculated)",
+            "orig_cat_name": "Other Sectors (calculated)",
         },
         "2.A.4": {
             "sources": ["2.A.4.a", "2.A.4.b", "2.A.4.d"],
-            "name": "Other Process uses of Carbonates (calculated)",
+            "orig_cat_name": "Other Process uses of Carbonates (calculated)",
         },
         "2.B.8": {
             "sources": ["2.B.8.a", "2.B.8.b", "2.B.8.c", "2.B.8.f"],
-            "name": "Petrochemical and Carbon Black production (calculated)",
+            "orig_cat_name": "Petrochemical and Carbon Black production (calculated)",
         },
         "4.A": {
             "sources": ["4.A.2", "M.4.A.Ind"],
-            "name": "Solid Waste Disposal (calculated)",
+            "orig_cat_name": "Solid Waste Disposal (calculated)",
         },
     }
 
     aggregate_cats_N2O = {
-        "3.A.2": {"sources": ["3.A.2.b"], "name": "3A2 Manure Management"},
-        "3.A": {"sources": ["3.A.2"], "name": "3A Livestock"},
+        "3.A.2": {"sources": ["3.A.2.b"], "orig_cat_name": "3A2 Manure Management"},
+        "3.A": {"sources": ["3.A.2"], "orig_cat_name": "3A Livestock"},
     }
 
     aggregate_cats_CO2CH4N2O = {
-        "3.A.2": {"sources": ["3.A.2", "3.A.2.b"], "name": "3A2 Manure Management"},
+        "3.A.2": {
+            "sources": ["3.A.2", "3.A.2.b"],
+            "orig_cat_name": "3A2 Manure Management",
+        },
     }
 
     df_all = None
@@ -306,7 +309,9 @@ if __name__ == "__main__":
             ).sum(min_count=1)
 
             df_combine.insert(0, cat_label, cat_to_agg)
-            df_combine.insert(1, "orig_cat_name", aggregate_cats[cat_to_agg]["name"])
+            df_combine.insert(
+                1, "orig_cat_name", aggregate_cats[cat_to_agg]["orig_cat_name"]
+            )
 
             df_combine = df_combine.reset_index()
 
@@ -353,7 +358,7 @@ if __name__ == "__main__":
 
             df_combine.insert(0, cat_label, cat_to_agg)
             df_combine.insert(
-                1, "orig_cat_name", aggregate_cats_N2O[cat_to_agg]["name"]
+                1, "orig_cat_name", aggregate_cats_N2O[cat_to_agg]["orig_cat_name"]
             )
 
             df_combine = df_combine.reset_index()
@@ -401,7 +406,9 @@ if __name__ == "__main__":
 
             df_combine.insert(0, cat_label, cat_to_agg)
             df_combine.insert(
-                1, "orig_cat_name", aggregate_cats_CO2CH4N2O[cat_to_agg]["name"]
+                1,
+                "orig_cat_name",
+                aggregate_cats_CO2CH4N2O[cat_to_agg]["orig_cat_name"],
             )
 
             df_combine = df_combine.reset_index()

+ 55 - 22
src/unfccc_ghg_data/unfccc_reader/Israel/config_isr_bur2.py

@@ -253,20 +253,38 @@ meta_data = {
 #### for processing
 # aggregate categories
 cats_to_agg = {
-    "1": {"sources": ["1.A"], "name": "Energy"},  # for trends
+    "1": {
+        "sources": ["1.A"],
+        # "name": "Energy"
+    },  # for trends
     "1.A.4": {
         "sources": ["1.A.4.a", "1.A.4.b", "1.A.4.c", "1.A.4.ab"],
-        "name": "Other sectors",
+        # "name": "Other sectors",
+    },
+    "2.A.4": {
+        "sources": ["2.A.4.b"],
+        # "name": "Soda Ash"
+    },
+    "2.A.7": {
+        "sources": ["2.A.7.a"],
+        # "name": "Other"
     },
-    "2.A.4": {"sources": ["2.A.4.b"], "name": "Soda Ash"},
-    "2.A.7": {"sources": ["2.A.7.a"], "name": "Other"},
     "2.A": {
         "sources": ["2.A.1", "2.A.2", "2.A.4", "2.A.6", "2.A.7"],
-        "name": "Mineral Products",
+        # "name": "Mineral Products",
+    },
+    "2.B.5": {
+        "sources": ["2.B.5.f", "2.B.5.g"],
+        # "name": "Other"
+    },
+    "2.B": {
+        "sources": ["2.B.2", "2.B.5"],
+        # "name": "Chemical Industry"
+    },
+    "6.D": {
+        "sources": ["6.D", "6X.B"],
+        # "name": "Wastewater Treatment and Discharge"
     },
-    "2.B.5": {"sources": ["2.B.5.f", "2.B.5.g"], "name": "Other"},
-    "2.B": {"sources": ["2.B.2", "2.B.5"], "name": "Chemical Industry"},
-    "6.D": {"sources": ["6.D", "6X.B"], "name": "Wastewater Treatment and Discharge"},
     #'6.E': {'sources': ['6.E', '6X.D'], 'Other'}, # currently empty
 }
 
@@ -396,45 +414,60 @@ cat_conversion = {
         "7": "5",
     },  # 5.A-D ignored as not fitting 2006 cats
     "aggregate": {
-        "2.A.4": {"sources": ["2.A.4.b"], "name": "Other uses of soda ashes"},
+        "2.A.4": {
+            "sources": ["2.A.4.b"],
+            # "name": "Other uses of soda ashes"
+        },
         "2.B.8": {
             "sources": ["2.B.8.b"],
-            "name": "Petrochemical and Carbon Black production",
+            # "name": "Petrochemical and Carbon Black production",
+        },
+        "2.B.10": {
+            "sources": ["M.2.B.10.a", "M.2.B.10.b"],
+            # "name": "Other"
         },
-        "2.B.10": {"sources": ["M.2.B.10.a", "M.2.B.10.b"], "name": "Other"},
         "2.B": {
             "sources": ["2.B.2", "2.B.8", "2.B.9", "2.B.10"],
-            "name": "Chemical Industry",
+            # "name": "Chemical Industry",
+        },
+        "2.H": {
+            "sources": ["M.2.H.1_2", "2.H.3"],
+            # "name": "Other"
         },
-        "2.H": {"sources": ["M.2.H.1_2", "2.H.3"], "name": "Other"},
         # '2': {'sources': ['2.A', '2.B', '2.C', '2.F', '2.H'],
         #       'name': 'Industrial Processes and Product Use'},
-        "3.A": {"sources": ["3.A.1", "3.A.2"], "name": "Livestock"},
+        "3.A": {
+            "sources": ["3.A.1", "3.A.2"],
+            # "name": "Livestock"
+        },
         "3.C.1": {
             "sources": ["3.C.1.b", "3.C.1.c"],
-            "name": "Emissions from biomass burning",
+            # "name": "Emissions from biomass burning",
         },
         "M.3.C.1.AG": {
             "sources": ["3.C.1.b", "3.C.1.c"],
-            "name": "Emissions from biomass burning (Agriculture)",
+            # "name": "Emissions from biomass burning (Agriculture)",
         },
         "3.C": {
             "sources": ["3.C.1", "M.3.C.45.AG", "3.C.7", "3.C.8"],
-            "name": "Aggregate sources and non-CO2 emissions sources on land",
+            # "name": "Aggregate sources and non-CO2 emissions sources on land",
         },
         "M.3.C.AG": {
             "sources": ["M.3.C.1.AG", "M.3.C.45.AG", "3.C.7", "3.C.8"],
-            "name": "Aggregate sources and non-CO2 emissions sources on land ("
-            "Agriculture)",
+            # "name": "Aggregate sources and non-CO2 emissions sources on land ("
+            # "Agriculture)",
         },
         "M.AG.ELV": {
             "sources": ["M.3.C.AG"],
-            "name": "Agriculture excluding livestock",
+            # "name": "Agriculture excluding livestock",
+        },
+        "3": {
+            "sources": ["M.AG", "M.LULUCF"],
+            # "name": "AFOLU"
         },
-        "3": {"sources": ["M.AG", "M.LULUCF"], "name": "AFOLU"},
         "M.0.EL": {
             "sources": ["1", "2", "M.AG", "4", "5"],
-            "name": "National total " "excluding LULUCF",
+            # "name": "National total " "excluding LULUCF",
         },
     },
 }

+ 20 - 8
src/unfccc_ghg_data/unfccc_reader/Malaysia/config_mys_bur3.py

@@ -960,20 +960,32 @@ country_processing_step1 = {
                 "3.C.7",
                 "3.C.8",
             ],
-            "name": "Aggregate sources and non-CO2 emissions sources on land "
-            "(Agriculture)",
+            # "name": "Aggregate sources and non-CO2 emissions sources on land "
+            # "(Agriculture)",
+        },
+        "M.3.D.AG": {
+            "sources": ["3.D.2"],
+            # "name": "Other (Agriculture)"
         },
-        "M.3.D.AG": {"sources": ["3.D.2"], "name": "Other (Agriculture)"},
         "M.AG.ELV": {
             "sources": ["M.3.C.AG", "M.3.D.AG"],
-            "name": "Agriculture excluding livestock",
+            # "name": "Agriculture excluding livestock",
+        },
+        "M.AG": {
+            "sources": ["3.A", "M.AG.ELV"],
+            # "name": "Agriculture"
+        },
+        "M.3.D.LU": {
+            "sources": ["3.D.1"],
+            # "name": "Other (LULUCF)"
+        },
+        "M.LULUCF": {
+            "sources": ["3.B", "M.3.D.LU"],
+            # "name": "LULUCF"
         },
-        "M.AG": {"sources": ["3.A", "M.AG.ELV"], "name": "Agriculture"},
-        "M.3.D.LU": {"sources": ["3.D.1"], "name": "Other (LULUCF)"},
-        "M.LULUCF": {"sources": ["3.B", "M.3.D.LU"], "name": "LULUCF"},
         "M.0.EL": {
             "sources": ["1", "2", "M.AG", "4", "5"],
-            "name": "National total emissions excluding LULUCF",
+            # "name": "National total emissions excluding LULUCF",
         },
     },
     "basket_copy": {

+ 20 - 8
src/unfccc_ghg_data/unfccc_reader/Malaysia/config_mys_bur4.py

@@ -371,20 +371,32 @@ country_processing_step1 = {
                 "3.C.7",
                 "3.C.8",
             ],
-            "name": "Aggregate sources and non-CO2 emissions sources on land "
-            "(Agriculture)",
+            # "name": "Aggregate sources and non-CO2 emissions sources on land "
+            # "(Agriculture)",
+        },
+        "M.3.D.AG": {
+            "sources": ["3.D.2"],
+            # "name": "Other (Agriculture)"
         },
-        "M.3.D.AG": {"sources": ["3.D.2"], "name": "Other (Agriculture)"},
         "M.AG.ELV": {
             "sources": ["M.3.C.AG", "M.3.D.AG"],
-            "name": "Agriculture excluding livestock",
+            # "name": "Agriculture excluding livestock",
+        },
+        "M.AG": {
+            "sources": ["3.A", "M.AG.ELV"],
+            # "name": "Agriculture"
+        },
+        "M.3.D.LU": {
+            "sources": ["3.D.1"],
+            # "name": "Other (LULUCF)"
+        },
+        "M.LULUCF": {
+            "sources": ["3.B", "M.3.D.LU"],
+            # "name": "LULUCF"
         },
-        "M.AG": {"sources": ["3.A", "M.AG.ELV"], "name": "Agriculture"},
-        "M.3.D.LU": {"sources": ["3.D.1"], "name": "Other (LULUCF)"},
-        "M.LULUCF": {"sources": ["3.B", "M.3.D.LU"], "name": "LULUCF"},
         "M.0.EL": {
             "sources": ["1", "2", "M.AG", "4", "5"],
-            "name": "National total emissions excluding LULUCF",
+            # "name": "National total emissions excluding LULUCF",
         },
     },
     "basket_copy": {

+ 35 - 17
src/unfccc_ghg_data/unfccc_reader/Morocco/config_mar_bur3.py

@@ -150,7 +150,7 @@ cat_mapping = {
 aggregate_cats = {
     "1.B.2.a.iii": {
         "sources": ["1.B.2.a.iii.4", "1.B.2.a.iii.5", "1.B.2.a.iii.6"],
-        "name": "All Other",
+        # "name": "All Other",
     },
     "1.B.2.b.iii": {
         "sources": [
@@ -159,26 +159,32 @@ aggregate_cats = {
             "1.B.2.b.iii.5",
             "1.B.2.b.iii.6",
         ],
-        "name": "All Other",
+        # "name": "All Other",
+    },
+    "1.B.2.a": {
+        "sources": ["1.B.2.a.iii"],
+        # "name": "Oil"
     },
-    "1.B.2.a": {"sources": ["1.B.2.a.iii"], "name": "Oil"},
     "1.B.2.b": {
         "sources": ["1.B.2.b.i", "1.B.2.b.ii", "1.B.2.b.iii"],
-        "name": "Natural Gas",
+        # "name": "Natural Gas",
     },
     "2.D": {
         "sources": ["2.D.4"],
-        "name": "Non-Energy Products from Fuels and Solvent Use",
+        # "name": "Non-Energy Products from Fuels and Solvent Use",
     },
     "2.F.1": {
         "sources": ["2.F.1.a", "2.F.1.b"],
-        "name": "Refrigeration and Air Conditioning",
+        # "name": "Refrigeration and Air Conditioning",
     },
     "2.F": {
         "sources": ["2.F.1", "2.F.2", "2.F.3", "2.F.4", "2.F.5", "2.F.6"],
-        "name": "Product uses as Substitutes for Ozone Depleting Substances",
+        # "name": "Product uses as Substitutes for Ozone Depleting Substances",
+    },
+    "2.H": {
+        "sources": ["2.H.1", "2.H.2", "2.H.3"],
+        # "name": "Other"
     },
-    "2.H": {"sources": ["2.H.1", "2.H.2", "2.H.3"], "name": "Other"},
     "3.A.2": {
         "sources": [
             "3.A.2.a",
@@ -190,28 +196,40 @@ aggregate_cats = {
             "3.A.2.h",
             "3.A.2.i",
         ],
-        "name": "Manure Management",
+        # "name": "Manure Management",
+    },
+    "3.A": {
+        "sources": ["3.A.1", "3.A.2"],
+        # "name": "Livestock"
     },
-    "3.A": {"sources": ["3.A.1", "3.A.2"], "name": "Livestock"},
     "3.B": {
         "sources": ["3.B.1", "3.B.2", "3.B.3", "3.B.4", "3.B.5", "3.B.6"],
-        "name": "Land",
+        # "name": "Land",
     },
     "3.C": {
         "sources": ["3.C.3", "3.C.4", "3.C.5", "3.C.6", "3.C.7"],
-        "name": "Aggregate sources and non-CO2 emissions sources on land",
+        # "name": "Aggregate sources and non-CO2 emissions sources on land",
     },
     "M.3.C.AG": {
         "sources": ["3.C.3", "3.C.4", "3.C.5", "3.C.6", "3.C.7"],
-        "name": "Aggregate sources and non-CO2 emissions sources on land (Agriculture)",
+        # "name": "Aggregate sources and non-CO2 emissions sources on land (Agriculture)",
+    },
+    "M.AG": {
+        "sources": ["3.A", "M.3.C.AG"],
+        # "name": "Agriculture"
+    },
+    "3": {
+        "sources": ["M.AG", "M.LULUCF"],
+        # "name": "AFOLU"
     },
-    "M.AG": {"sources": ["3.A", "M.3.C.AG"], "name": "Agriculture"},
-    "3": {"sources": ["M.AG", "M.LULUCF"], "name": "AFOLU"},
     "M.AG.ELV": {
         "sources": ["M.3.C.AG"],
-        "name": "Agriculture excluding livestock emissions",
+        # "name": "Agriculture excluding livestock emissions",
+    },
+    "4": {
+        "sources": ["4.A", "4.D"],
+        # "name": "Waste"
     },
-    "4": {"sources": ["4.A", "4.D"], "name": "Waste"},
     "0": {"sources": ["1", "2", "3", "4"]},
     "M.0.EL": {"sources": ["1", "2", "M.AG", "4"]},
 }

+ 11 - 5
src/unfccc_ghg_data/unfccc_reader/Nigeria/config_nga_bur2.py

@@ -385,18 +385,24 @@ processing_info_step2 = {
     "aggregate_cats": {
         "M.AG.ELV": {
             "sources": ["3.C"],
-            "name": "Agriculture excluding livestock emissions",
+            # "name": "Agriculture excluding livestock emissions",
+        },
+        "M.AG": {
+            "sources": ["M.AG.ELV", "3.A"],
+            # "name": "Agriculture"
         },
-        "M.AG": {"sources": ["M.AG.ELV", "3.A"], "name": "Agriculture"},
         "M.LULUCF": {
             "sources": ["3.B", "3.D"],
-            "name": "Land Use, Land Use Change, and Forestry",
+            # "name": "Land Use, Land Use Change, and Forestry",
         },
         "M.0.EL": {
             "sources": ["1", "2", "M.AG", "4", "5"],
-            "name": "National Total Excluding LULUCF",
+            # "name": "National Total Excluding LULUCF",
+        },
+        "0": {
+            "sources": ["1", "2", "3", "4", "5"],
+            # "name": "National Total"
         },
-        "0": {"sources": ["1", "2", "3", "4", "5"], "name": "National Total"},
     },
     "downscale": {
         "sectors": {

+ 11 - 5
src/unfccc_ghg_data/unfccc_reader/Peru/config_per_bur3.py

@@ -527,18 +527,24 @@ cat_conversion = {
     "aggregate": {
         "2": {
             "sources": ["2.A", "2.B", "2.C", "2.D", "2.E", "2.F", "2.G", "2.H"],
-            "name": "IPPU",
+            # "name": "IPPU",
         },
         "M.3.C.AG": {
             "sources": ["3.C"],
-            "name": "Aggregate sources and non-CO2 emissions sources on land (Agriculture)",
+            # "name": "Aggregate sources and non-CO2 emissions sources on land (Agriculture)",
         },
         "M.AG.ELV": {
             "sources": ["M.3.C.AG"],
-            "name": "Agriculture excluding livestock emissions",
+            # "name": "Agriculture excluding livestock emissions",
+        },
+        "3.D": {
+            "sources": ["3.D.1"],
+            # "name": "Other"
+        },
+        "3": {
+            "sources": ["M.AG", "M.LULUCF"],
+            # "name": "AFOLU"
         },
-        "3.D": {"sources": ["3.D.1"], "name": "Other"},
-        "3": {"sources": ["M.AG", "M.LULUCF"], "name": "AFOLU"},
     },
 }
 

+ 16 - 10
src/unfccc_ghg_data/unfccc_reader/Singapore/config_sgp_bur5.py

@@ -478,15 +478,15 @@ meta_data = {
 aggregate_sectors = {
     "2": {
         "sources": ["2.A", "2.B", "2.C", "2.D", "2.E", "2.F", "2.G", "2.H"],
-        "name": "IPPU",
+        # "name": "IPPU",
     },
     "M.3.C.1.AG": {
         "sources": ["3.C.1.b", "3.C.1.c"],
-        "name": "Emissions from Biomass Burning (Agriculture)",
+        # "name": "Emissions from Biomass Burning (Agriculture)",
     },
     "M.3.C.1.LU": {
         "sources": ["3.C.1.a", "3.C.1.d"],
-        "name": "Emissions from Biomass Burning (LULUCF)",
+        # "name": "Emissions from Biomass Burning (LULUCF)",
     },
     "M.3.C.AG": {
         "sources": [
@@ -499,22 +499,28 @@ aggregate_sectors = {
             "3.C.7",
             "3.C.8",
         ],
-        "name": "Aggregate sources and non-CO2 emissions sources on land (Agriculture)",
+        # "name": "Aggregate sources and non-CO2 emissions sources on land (Agriculture)",
     },
     "M.AG.ELV": {
         "sources": ["M.3.C.AG"],
-        "name": "Agriculture excluding livestock emissions",
+        # "name": "Agriculture excluding livestock emissions",
+    },
+    "M.AG": {
+        "sources": ["M.AG.ELV", "3.A"],
+        # "name": "Agriculture"
     },
-    "M.AG": {"sources": ["M.AG.ELV", "3.A"], "name": "Agriculture"},
     "M.LULUCF": {
         "sources": ["M.3.C.1.LU", "3.B", "3.D"],
-        "name": "Land Use, Land Use Change, and Forestry",
+        # "name": "Land Use, Land Use Change, and Forestry",
     },
     "M.0.EL": {
         "sources": ["1", "2", "M.AG", "4", "5"],
-        "name": "National Total Excluding LULUCF",
+        # "name": "National Total Excluding LULUCF",
+    },
+    "0": {
+        "sources": ["1", "2", "3", "4", "5"],
+        # "name": "National Total"
     },
-    "0": {"sources": ["1", "2", "3", "4", "5"], "name": "National Total"},
 }
 
 
@@ -524,7 +530,7 @@ processing_info_step1 = {
     "aggregate_cats": {
         "2": {
             "sources": ["2.A", "2.B", "2.C", "2.D", "2.E", "2.F", "2.G", "2.H"],
-            "name": "IPPU",
+            # "name": "IPPU",
         },
     },
     "tolerance": 1,  # because ch4 is inconsistent

+ 30 - 12
src/unfccc_ghg_data/unfccc_reader/Taiwan/config_twn_nir2023.py

@@ -329,7 +329,7 @@ table_defs_skip = {
 
 
 ##### primap2 metadata
-cat_code_regexp = r"(?P<UNFCCC_GHG_data>^[a-zA-Z0-9\.]{1,7})\s.*"
+cat_code_regexp = r"(?P<code>^[a-zA-Z0-9\.]{1,7})\s.*"
 
 time_format = "%Y"
 
@@ -422,30 +422,48 @@ cat_conversion = {
     "aggregate": {
         "1.A": {
             "sources": ["1.A.1", "1.A.2", "1.A.3", "1.A.4"],
-            "name": "Fuel Combustion Activities",
+            # "name": "Fuel Combustion Activities",
+        },
+        "1.B": {
+            "sources": ["1.B.1", "1.B.2"],
+            # "name": "Fugitive Emissions from Fuels"
         },
-        "1.B": {"sources": ["1.B.1", "1.B.2"], "name": "Fugitive Emissions from Fuels"},
         "2": {
             "sources": ["2.A", "2.B", "2.C", "2.D", "2.E", "2.F", "2.G", "2.H"],
-            "name": "Industrial Process and Product Use Sector",
+            # "name": "Industrial Process and Product Use Sector",
+        },
+        "3.A": {
+            "sources": ["3.A.1", "3.A.2"],
+            # "name": "Livestock"
+        },
+        "3.B": {
+            "sources": ["M.LULUCF"],
+            # "name": "Land"
+        },
+        "3.C.1": {
+            "sources": ["3.C.1.b"],
+            # "name": "Emissions from Biomass Burning"
         },
-        "3.A": {"sources": ["3.A.1", "3.A.2"], "name": "Livestock"},
-        "3.B": {"sources": ["M.LULUCF"], "name": "Land"},
-        "3.C.1": {"sources": ["3.C.1.b"], "name": "Emissions from Biomass Burning"},
         "3.C.5": {
             "sources": ["3.C.5.a", "3.C.5.b"],
-            "name": "Indirect N2O Emissions from Managed Soils",
+            # "name": "Indirect N2O Emissions from Managed Soils",
         },
         "3.C": {
             "sources": ["3.C.1", "3.C.3", "M.3.AS", "3.C.7"],
-            "name": "Aggregate sources and non-CO2 emissions sources on land",
+            # "name": "Aggregate sources and non-CO2 emissions sources on land",
         },
         "M.AG.ELV": {
             "sources": ["3.C"],
-            "name": "Agriculture excluding livestock emissions",
+            # "name": "Agriculture excluding livestock emissions",
+        },
+        "M.AG": {
+            "sources": ["3.A", "3.C"],
+            # "name": "Agriculture"
         },
-        "M.AG": {"sources": ["3.A", "3.C"], "name": "Agriculture"},
-        "3": {"sources": ["M.AG", "M.LULUCF"], "name": "AFOLU"},  # consistency check
+        "3": {
+            "sources": ["M.AG", "M.LULUCF"],
+            # "name": "AFOLU"
+        },  # consistency check
         "M.0.EL": {"sources": ["1", "2", "M.AG", "4"]},  # consistency check
         "0": {"sources": ["1", "2", "3", "4"]},  # consistency check
     },

+ 1 - 1
src/unfccc_ghg_data/unfccc_reader/Taiwan/read_TWN_2023_Inventory_from_pdf.py

@@ -48,7 +48,7 @@ if __name__ == "__main__":
     inventory_file = "2023_NIR_executive_summary_english.pdf"
 
     def repl(m):  # noqa: D103
-        return m.group("UNFCCC_GHG_data")
+        return m.group("code")
 
     # ###
     # read the tables from pdf

+ 34 - 13
src/unfccc_ghg_data/unfccc_reader/Thailand/config_tha_bur3.py

@@ -169,7 +169,7 @@ country_processing_step1 = {
     "aggregate_cats": {
         "2.A.4": {
             "sources": ["2.A.4.b", "2.A.4.d"],
-            "name": "Other Process uses of Carbonates",
+            # "name": "Other Process uses of Carbonates",
         },
     },
     "aggregate_gases": {
@@ -427,14 +427,17 @@ cat_conversion = {
         "M.BIO": "M.BIO",
     },
     "aggregate": {
-        "3.A": {"sources": ["3.A.1", "3.A.2"], "name": "Livestock"},
+        "3.A": {
+            "sources": ["3.A.1", "3.A.2"],
+            # "name": "Livestock"
+        },
         "3.C.1": {
             "sources": ["M.3.C.1.AG", "M.3.C.1.LU"],
-            "name": "Emissions from Biomass Burning",
+            # "name": "Emissions from Biomass Burning",
         },
         "3.C": {
             "sources": ["3.C.1", "3.C.2", "3.C.3", "3.C.4", "3.C.5", "3.C.6", "3.C.7"],
-            "name": "Aggregate sources and non-CO2 emissions sources on land",
+            # "name": "Aggregate sources and non-CO2 emissions sources on land",
         },
         "M.3.C.AG": {
             "sources": [
@@ -446,22 +449,40 @@ cat_conversion = {
                 "3.C.6",
                 "3.C.7",
             ],
-            "name": "Aggregate sources and non-CO2 emissions sources on land (Agriculture)",
+            # "name": "Aggregate sources and non-CO2 emissions sources on land (Agriculture)",
         },
         "M.AG.ELV": {
             "sources": ["M.3.C.AG"],
-            "name": "Agriculture excluding livestock emissions",
+            # "name": "Agriculture excluding livestock emissions",
         },
         "M.3.C.LU": {
             "sources": ["M.3.C.1.LU"],
-            "name": "Aggregate sources and non-CO2 emissions sources on land (Land use)",
+            # "name": "Aggregate sources and non-CO2 emissions sources on land (Land use)",
+        },
+        "3.B.1": {
+            "sources": ["3.B.1.a"],
+            # "name": "Forest Land"
+        },
+        "3.B.2": {
+            "sources": ["3.B.2.a", "3.B.2.b"],
+            # "name": "Cropland"
+        },
+        "3.B.6": {
+            "sources": ["3.B.6.b"],
+            # "name": "Other Land"
+        },
+        "3.B": {
+            "sources": ["3.B.1", "3.B.2", "3.B.6"],
+            # "name": "Land"
+        },
+        "M.LULUCF": {
+            "sources": ["3.B", "N.3.C.LU"],
+            # "name": "LULUCF"
+        },
+        "3": {
+            "sources": ["M.AG", "M.LULUCF"],
+            # "name": "AFOLU"
         },
-        "3.B.1": {"sources": ["3.B.1.a"], "name": "Forest Land"},
-        "3.B.2": {"sources": ["3.B.2.a", "3.B.2.b"], "name": "Cropland"},
-        "3.B.6": {"sources": ["3.B.6.b"], "name": "Other Land"},
-        "3.B": {"sources": ["3.B.1", "3.B.2", "3.B.6"], "name": "Land"},
-        "M.LULUCF": {"sources": ["3.B", "N.3.C.LU"], "name": "LULUCF"},
-        "3": {"sources": ["M.AG", "M.LULUCF"], "name": "AFOLU"},
     },
 }