Browse Source

regenerate docs

Johannes Gütschow 5 months ago
parent
commit
eeea6176ce
25 changed files with 329 additions and 153 deletions
  1. 6 0
      docs/source/api/unfccc_ghg_data.helper.functions.rst
  2. 6 0
      docs/source/api/unfccc_ghg_data.unfccc_crf_reader.crf_specifications.crf2024_specification.rst
  3. 1 0
      docs/source/api/unfccc_ghg_data.unfccc_crf_reader.crf_specifications.rst
  4. 6 0
      docs/source/api/unfccc_ghg_data.unfccc_reader.China.config_chn_bur3_nc4.rst
  5. 6 0
      docs/source/api/unfccc_ghg_data.unfccc_reader.China.read_CHN_BUR3_from_pdf.rst
  6. 6 0
      docs/source/api/unfccc_ghg_data.unfccc_reader.China.read_CHN_NC4_from_pdf.rst
  7. 14 0
      docs/source/api/unfccc_ghg_data.unfccc_reader.China.rst
  8. 6 0
      docs/source/api/unfccc_ghg_data.unfccc_reader.Japan.config_jpn_inv2024.rst
  9. 6 0
      docs/source/api/unfccc_ghg_data.unfccc_reader.Japan.read_JPN_2024_Inventory_from_xlsx.rst
  10. 13 0
      docs/source/api/unfccc_ghg_data.unfccc_reader.Japan.rst
  11. 6 0
      docs/source/api/unfccc_ghg_data.unfccc_reader.Mauritania.config_mrt_bur2.rst
  12. 6 0
      docs/source/api/unfccc_ghg_data.unfccc_reader.Mauritania.read_MRT_BUR2_from_pdf.rst
  13. 13 0
      docs/source/api/unfccc_ghg_data.unfccc_reader.Mauritania.rst
  14. 6 0
      docs/source/api/unfccc_ghg_data.unfccc_reader.United_Arab_Emirates.config_are_bur1.rst
  15. 6 0
      docs/source/api/unfccc_ghg_data.unfccc_reader.United_Arab_Emirates.read_ARE_BUR1_from_csv.rst
  16. 13 0
      docs/source/api/unfccc_ghg_data.unfccc_reader.United_Arab_Emirates.rst
  17. 4 0
      docs/source/api/unfccc_ghg_data.unfccc_reader.rst
  18. 1 0
      extracted_data/non-UNFCCC/Japan/JPN_2024-Inventory_IPCC1996_2006_Japan_INV.csv
  19. 1 0
      extracted_data/non-UNFCCC/Japan/JPN_2024-Inventory_IPCC1996_2006_Japan_INV.nc
  20. 22 0
      extracted_data/non-UNFCCC/Japan/JPN_2024-Inventory_IPCC1996_2006_Japan_INV.yaml
  21. 1 0
      extracted_data/non-UNFCCC/Japan/JPN_2024-Inventory_IPCC2006_PRIMAP.csv
  22. 1 0
      extracted_data/non-UNFCCC/Japan/JPN_2024-Inventory_IPCC2006_PRIMAP.nc
  23. 24 0
      extracted_data/non-UNFCCC/Japan/JPN_2024-Inventory_IPCC2006_PRIMAP.yaml
  24. 0 0
      src/unfccc_ghg_data/unfccc_reader/Japan/config_jpn_inv2024.py
  25. 155 153
      src/unfccc_ghg_data/unfccc_reader/Japan/read_JPN_2024_Inventory_from_xlsx.py

+ 6 - 0
docs/source/api/unfccc_ghg_data.helper.functions.rst

@@ -73,6 +73,12 @@ find\_and\_replace\_values
 .. autofunction:: find_and_replace_values
 
 
+set\_to\_nan\_in\_ds
+====================
+
+.. autofunction:: set_to_nan_in_ds
+
+
 assert\_values
 ==============
 

+ 6 - 0
docs/source/api/unfccc_ghg_data.unfccc_crf_reader.crf_specifications.crf2024_specification.rst

@@ -0,0 +1,6 @@
+unfccc\_ghg\_data.unfccc\_crf\_reader.crf\_specifications.crf2024\_specification
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. automodule:: unfccc_ghg_data.unfccc_crf_reader.crf_specifications.crf2024_specification
+
+.. currentmodule:: unfccc_ghg_data.unfccc_crf_reader.crf_specifications.crf2024_specification

+ 1 - 0
docs/source/api/unfccc_ghg_data.unfccc_crf_reader.crf_specifications.rst

@@ -13,5 +13,6 @@ unfccc\_ghg\_data.unfccc\_crf\_reader.crf\_specifications
   unfccc_ghg_data.unfccc_crf_reader.crf_specifications.crf2022_specification
   unfccc_ghg_data.unfccc_crf_reader.crf_specifications.crf2023_aus_specification
   unfccc_ghg_data.unfccc_crf_reader.crf_specifications.crf2023_specification
+  unfccc_ghg_data.unfccc_crf_reader.crf_specifications.crf2024_specification
   unfccc_ghg_data.unfccc_crf_reader.crf_specifications.crt1_specification
   unfccc_ghg_data.unfccc_crf_reader.crf_specifications.util

+ 6 - 0
docs/source/api/unfccc_ghg_data.unfccc_reader.China.config_chn_bur3_nc4.rst

@@ -0,0 +1,6 @@
+unfccc\_ghg\_data.unfccc\_reader.China.config\_chn\_bur3\_nc4
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. automodule:: unfccc_ghg_data.unfccc_reader.China.config_chn_bur3_nc4
+
+.. currentmodule:: unfccc_ghg_data.unfccc_reader.China.config_chn_bur3_nc4

+ 6 - 0
docs/source/api/unfccc_ghg_data.unfccc_reader.China.read_CHN_BUR3_from_pdf.rst

@@ -0,0 +1,6 @@
+unfccc\_ghg\_data.unfccc\_reader.China.read\_CHN\_BUR3\_from\_pdf
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. automodule:: unfccc_ghg_data.unfccc_reader.China.read_CHN_BUR3_from_pdf
+
+.. currentmodule:: unfccc_ghg_data.unfccc_reader.China.read_CHN_BUR3_from_pdf

+ 6 - 0
docs/source/api/unfccc_ghg_data.unfccc_reader.China.read_CHN_NC4_from_pdf.rst

@@ -0,0 +1,6 @@
+unfccc\_ghg\_data.unfccc\_reader.China.read\_CHN\_NC4\_from\_pdf
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. automodule:: unfccc_ghg_data.unfccc_reader.China.read_CHN_NC4_from_pdf
+
+.. currentmodule:: unfccc_ghg_data.unfccc_reader.China.read_CHN_NC4_from_pdf

+ 14 - 0
docs/source/api/unfccc_ghg_data.unfccc_reader.China.rst

@@ -0,0 +1,14 @@
+unfccc\_ghg\_data.unfccc\_reader.China
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. automodule:: unfccc_ghg_data.unfccc_reader.China
+
+.. currentmodule:: unfccc_ghg_data.unfccc_reader.China
+
+
+.. autosummary::
+  :toctree: ./
+
+  unfccc_ghg_data.unfccc_reader.China.config_chn_bur3_nc4
+  unfccc_ghg_data.unfccc_reader.China.read_CHN_BUR3_from_pdf
+  unfccc_ghg_data.unfccc_reader.China.read_CHN_NC4_from_pdf

+ 6 - 0
docs/source/api/unfccc_ghg_data.unfccc_reader.Japan.config_jpn_inv2024.rst

@@ -0,0 +1,6 @@
+unfccc\_ghg\_data.unfccc\_reader.Japan.config\_jpn\_inv2024
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. automodule:: unfccc_ghg_data.unfccc_reader.Japan.config_jpn_inv2024
+
+.. currentmodule:: unfccc_ghg_data.unfccc_reader.Japan.config_jpn_inv2024

+ 6 - 0
docs/source/api/unfccc_ghg_data.unfccc_reader.Japan.read_JPN_2024_Inventory_from_xlsx.rst

@@ -0,0 +1,6 @@
+unfccc\_ghg\_data.unfccc\_reader.Japan.read\_JPN\_2024\_Inventory\_from\_xlsx
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. automodule:: unfccc_ghg_data.unfccc_reader.Japan.read_JPN_2024_Inventory_from_xlsx
+
+.. currentmodule:: unfccc_ghg_data.unfccc_reader.Japan.read_JPN_2024_Inventory_from_xlsx

+ 13 - 0
docs/source/api/unfccc_ghg_data.unfccc_reader.Japan.rst

@@ -0,0 +1,13 @@
+unfccc\_ghg\_data.unfccc\_reader.Japan
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. automodule:: unfccc_ghg_data.unfccc_reader.Japan
+
+.. currentmodule:: unfccc_ghg_data.unfccc_reader.Japan
+
+
+.. autosummary::
+  :toctree: ./
+
+  unfccc_ghg_data.unfccc_reader.Japan.config_jpn_inv2024
+  unfccc_ghg_data.unfccc_reader.Japan.read_JPN_2024_Inventory_from_xlsx

+ 6 - 0
docs/source/api/unfccc_ghg_data.unfccc_reader.Mauritania.config_mrt_bur2.rst

@@ -0,0 +1,6 @@
+unfccc\_ghg\_data.unfccc\_reader.Mauritania.config\_mrt\_bur2
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. automodule:: unfccc_ghg_data.unfccc_reader.Mauritania.config_mrt_bur2
+
+.. currentmodule:: unfccc_ghg_data.unfccc_reader.Mauritania.config_mrt_bur2

+ 6 - 0
docs/source/api/unfccc_ghg_data.unfccc_reader.Mauritania.read_MRT_BUR2_from_pdf.rst

@@ -0,0 +1,6 @@
+unfccc\_ghg\_data.unfccc\_reader.Mauritania.read\_MRT\_BUR2\_from\_pdf
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. automodule:: unfccc_ghg_data.unfccc_reader.Mauritania.read_MRT_BUR2_from_pdf
+
+.. currentmodule:: unfccc_ghg_data.unfccc_reader.Mauritania.read_MRT_BUR2_from_pdf

+ 13 - 0
docs/source/api/unfccc_ghg_data.unfccc_reader.Mauritania.rst

@@ -0,0 +1,13 @@
+unfccc\_ghg\_data.unfccc\_reader.Mauritania
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. automodule:: unfccc_ghg_data.unfccc_reader.Mauritania
+
+.. currentmodule:: unfccc_ghg_data.unfccc_reader.Mauritania
+
+
+.. autosummary::
+  :toctree: ./
+
+  unfccc_ghg_data.unfccc_reader.Mauritania.config_mrt_bur2
+  unfccc_ghg_data.unfccc_reader.Mauritania.read_MRT_BUR2_from_pdf

+ 6 - 0
docs/source/api/unfccc_ghg_data.unfccc_reader.United_Arab_Emirates.config_are_bur1.rst

@@ -0,0 +1,6 @@
+unfccc\_ghg\_data.unfccc\_reader.United\_Arab\_Emirates.config\_are\_bur1
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. automodule:: unfccc_ghg_data.unfccc_reader.United_Arab_Emirates.config_are_bur1
+
+.. currentmodule:: unfccc_ghg_data.unfccc_reader.United_Arab_Emirates.config_are_bur1

+ 6 - 0
docs/source/api/unfccc_ghg_data.unfccc_reader.United_Arab_Emirates.read_ARE_BUR1_from_csv.rst

@@ -0,0 +1,6 @@
+unfccc\_ghg\_data.unfccc\_reader.United\_Arab\_Emirates.read\_ARE\_BUR1\_from\_csv
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. automodule:: unfccc_ghg_data.unfccc_reader.United_Arab_Emirates.read_ARE_BUR1_from_csv
+
+.. currentmodule:: unfccc_ghg_data.unfccc_reader.United_Arab_Emirates.read_ARE_BUR1_from_csv

+ 13 - 0
docs/source/api/unfccc_ghg_data.unfccc_reader.United_Arab_Emirates.rst

@@ -0,0 +1,13 @@
+unfccc\_ghg\_data.unfccc\_reader.United\_Arab\_Emirates
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. automodule:: unfccc_ghg_data.unfccc_reader.United_Arab_Emirates
+
+.. currentmodule:: unfccc_ghg_data.unfccc_reader.United_Arab_Emirates
+
+
+.. autosummary::
+  :toctree: ./
+
+  unfccc_ghg_data.unfccc_reader.United_Arab_Emirates.config_are_bur1
+  unfccc_ghg_data.unfccc_reader.United_Arab_Emirates.read_ARE_BUR1_from_csv

+ 4 - 0
docs/source/api/unfccc_ghg_data.unfccc_reader.rst

@@ -12,11 +12,14 @@ unfccc\_ghg\_data.unfccc\_reader
   unfccc_ghg_data.unfccc_reader.Argentina
   unfccc_ghg_data.unfccc_reader.Burundi
   unfccc_ghg_data.unfccc_reader.Chile
+  unfccc_ghg_data.unfccc_reader.China
   unfccc_ghg_data.unfccc_reader.Colombia
   unfccc_ghg_data.unfccc_reader.Guinea
   unfccc_ghg_data.unfccc_reader.Indonesia
   unfccc_ghg_data.unfccc_reader.Israel
+  unfccc_ghg_data.unfccc_reader.Japan
   unfccc_ghg_data.unfccc_reader.Malaysia
+  unfccc_ghg_data.unfccc_reader.Mauritania
   unfccc_ghg_data.unfccc_reader.Mexico
   unfccc_ghg_data.unfccc_reader.Mongolia
   unfccc_ghg_data.unfccc_reader.Montenegro
@@ -27,5 +30,6 @@ unfccc\_ghg\_data.unfccc\_reader
   unfccc_ghg_data.unfccc_reader.Singapore
   unfccc_ghg_data.unfccc_reader.Taiwan
   unfccc_ghg_data.unfccc_reader.Thailand
+  unfccc_ghg_data.unfccc_reader.United_Arab_Emirates
   unfccc_ghg_data.unfccc_reader.get_submissions_info
   unfccc_ghg_data.unfccc_reader.read_UNFCCC_submission

+ 1 - 0
extracted_data/non-UNFCCC/Japan/JPN_2024-Inventory_IPCC1996_2006_Japan_INV.csv

@@ -0,0 +1 @@
+../../../.git/annex/objects/4q/46/MD5E-s88116--6162c7090fa21790ec994b4506163ca8.csv/MD5E-s88116--6162c7090fa21790ec994b4506163ca8.csv

+ 1 - 0
extracted_data/non-UNFCCC/Japan/JPN_2024-Inventory_IPCC1996_2006_Japan_INV.nc

@@ -0,0 +1 @@
+../../../.git/annex/objects/76/Qp/MD5E-s101627--f2cae4c452bc87dcbfa99a1f86ffa8df.nc/MD5E-s101627--f2cae4c452bc87dcbfa99a1f86ffa8df.nc

+ 22 - 0
extracted_data/non-UNFCCC/Japan/JPN_2024-Inventory_IPCC1996_2006_Japan_INV.yaml

@@ -0,0 +1,22 @@
+attrs:
+  references: https://www.nies.go.jp/gio/en/aboutghg/index.html
+  rights: ''
+  contact: mail@johannes-guetschow.de
+  title: National GHG Inventory of Japan, 2024
+  comment: Read fom xlsx file by Johannes Gütschow
+  institution: National Institute for Environmental Studies Japan
+  cat: category (IPCC1996_2006_Japan_INV)
+  area: area (ISO3)
+  scen: scenario (PRIMAP)
+time_format: '%Y'
+dimensions:
+  '*':
+  - time
+  - scenario (PRIMAP)
+  - category (IPCC1996_2006_Japan_INV)
+  - source
+  - provenance
+  - area (ISO3)
+  - entity
+  - unit
+data_file: JPN_2024-Inventory_IPCC1996_2006_Japan_INV.csv

+ 1 - 0
extracted_data/non-UNFCCC/Japan/JPN_2024-Inventory_IPCC2006_PRIMAP.csv

@@ -0,0 +1 @@
+../../../.git/annex/objects/FP/3p/MD5E-s555063--c1bdbdbd7f2f12bff9f797009a885910.csv/MD5E-s555063--c1bdbdbd7f2f12bff9f797009a885910.csv

+ 1 - 0
extracted_data/non-UNFCCC/Japan/JPN_2024-Inventory_IPCC2006_PRIMAP.nc

@@ -0,0 +1 @@
+../../../.git/annex/objects/f0/XZ/MD5E-s339908--de3448e119d10b9fdd6a44f9cb2b3203.nc/MD5E-s339908--de3448e119d10b9fdd6a44f9cb2b3203.nc

+ 24 - 0
extracted_data/non-UNFCCC/Japan/JPN_2024-Inventory_IPCC2006_PRIMAP.yaml

@@ -0,0 +1,24 @@
+attrs:
+  references: https://www.nies.go.jp/gio/en/aboutghg/index.html
+  rights: ''
+  contact: mail@johannes-guetschow.de
+  title: National GHG Inventory of Japan, 2024 Processed on 2024-07-29
+  comment: Read fom xlsx file by Johannes Gütschow Processed on 2024-07-29
+  institution: National Institute for Environmental Studies Japan
+  cat: category (IPCC2006_PRIMAP)
+  area: area (ISO3)
+  scen: scenario (PRIMAP)
+  entity: PFCS
+  gwp_context: AR6GWP100
+time_format: '%Y'
+dimensions:
+  '*':
+  - time
+  - scenario (PRIMAP)
+  - category (IPCC2006_PRIMAP)
+  - source
+  - provenance
+  - area (ISO3)
+  - entity
+  - unit
+data_file: JPN_2024-Inventory_IPCC2006_PRIMAP.csv

+ 0 - 0
src/unfccc_ghg_data/unfccc_reader/Japan/config_JPN_INV2024.py → src/unfccc_ghg_data/unfccc_reader/Japan/config_jpn_inv2024.py


+ 155 - 153
src/unfccc_ghg_data/unfccc_reader/Japan/read_JPN_2024_Inventory_from_xlsx.py

@@ -10,7 +10,13 @@ import sys
 
 import pandas as pd
 import primap2 as pm2
-from config_JPN_INV2024 import (
+
+from unfccc_ghg_data.helper import (
+    downloaded_data_path,
+    extracted_data_path,
+    process_data_for_country,
+)
+from unfccc_ghg_data.unfccc_reader.Japan.config_jpn_inv2024 import (
     basket_copy,
     cat_conversion,
     coords_cols,
@@ -25,167 +31,163 @@ from config_JPN_INV2024 import (
     time_format,
 )
 
-from unfccc_ghg_data.helper import (
-    downloaded_data_path,
-    extracted_data_path,
-    process_data_for_country,
-)
-
-pd.set_option("future.no_silent_downcasting", True)
-
-# ###
-# configuration
-# ###
-
-# folders and files
-input_folder = downloaded_data_path / "non-UNFCCC" / "Japan" / "2024-Inventory"
-output_folder = extracted_data_path / "non-UNFCCC" / "Japan"
-if not output_folder.exists():
-    output_folder.mkdir()
-
-output_filename = "JPN_2023-Inventory_2024_"
-
-inventory_file = "L5-7gas_2024_gioweb_ver1.0.xlsx"
-
-# time_format = "%Y"
-name_for_cat_col = "category"
-compression = dict(zlib=True, complevel=9)
-
-# ###
-# start data reading
-# ###
-
-# change working directory to script directory for proper folder names
-script_path = os.path.abspath(sys.argv[0])
-script_dir_name = os.path.dirname(script_path)
-os.chdir(script_dir_name)
-
-data_pm2 = None
-
-for sheet in sheets_to_read:
-    # read sheet for the year. Each sheet contains several tables,
-    # we only read the upper row as the other tables are summary tables
-    current_sheet_config = sheets_to_read[sheet]
-    df_current = pd.read_excel(
-        input_folder / inventory_file,
-        sheet_name=sheet,
-        engine="openpyxl",
-        **current_sheet_config["xls_params"],
+if __name__ == "__main__":
+    pd.set_option("future.no_silent_downcasting", True)
+
+    # ###
+    # configuration
+    # ###
+
+    # folders and files
+    input_folder = downloaded_data_path / "non-UNFCCC" / "Japan" / "2024-Inventory"
+    output_folder = extracted_data_path / "non-UNFCCC" / "Japan"
+    if not output_folder.exists():
+        output_folder.mkdir()
+
+    output_filename = "JPN_2024-Inventory_"
+
+    inventory_file = "L5-7gas_2024_gioweb_ver1.0.xlsx"
+
+    # time_format = "%Y"
+    name_for_cat_col = "category"
+    compression = dict(zlib=True, complevel=9)
+
+    # ###
+    # start data reading
+    # ###
+
+    # change working directory to script directory for proper folder names
+    script_path = os.path.abspath(sys.argv[0])
+    script_dir_name = os.path.dirname(script_path)
+    os.chdir(script_dir_name)
+
+    data_pm2 = None
+
+    for sheet in sheets_to_read:
+        # read sheet for the year. Each sheet contains several tables,
+        # we only read the upper row as the other tables are summary tables
+        current_sheet_config = sheets_to_read[sheet]
+        df_current = pd.read_excel(
+            input_folder / inventory_file,
+            sheet_name=sheet,
+            engine="openpyxl",
+            **current_sheet_config["xls_params"],
+        )
+
+        # process category and entity
+        if current_sheet_config["entity"].startswith("COL_"):
+            # processing with entity
+            entity_col = current_sheet_config["entity"][4:]
+            df_current[entity_col] = df_current[entity_col].ffill()
+            df_current[current_sheet_config["cat_cols"]] = df_current[
+                current_sheet_config["cat_cols"]
+            ].fillna(value="Total")
+            df_current[entity_col] = df_current[entity_col].str.replace("\n", "")
+            df_current[entity_col] = df_current[entity_col].str.strip()
+        else:
+            # entity given for whole table
+            # print('not implemented')
+            df_current[current_sheet_config["cat_cols"]] = df_current[
+                current_sheet_config["cat_cols"]
+            ].bfill(axis=1)
+            df_current = df_current.drop(columns=current_sheet_config["cat_cols"][1:])
+        df_current = df_current.rename(
+            columns={current_sheet_config["cat_cols"][0]: name_for_cat_col}
+        )
+        df_current[name_for_cat_col] = df_current[name_for_cat_col].str.replace(
+            "\n", ""
+        )
+        df_current[name_for_cat_col] = df_current[name_for_cat_col].str.strip()
+
+        # convert to primap2 format
+        coords_value_mapping_current = coords_value_mapping.copy()
+        coords_value_mapping_current["category"] = current_sheet_config["cat_mapping"]
+        coords_cols_current = coords_cols.copy()
+        coords_defaults_current = coords_defaults.copy()
+        coords_defaults_current["unit"] = current_sheet_config["unit"]
+        if current_sheet_config["entity"].startswith("COL_"):
+            coords_cols_current["entity"] = entity_col
+        else:
+            coords_defaults_current["entity"] = current_sheet_config["entity"]
+
+        # make sure all column names are str
+        df_current.columns = df_current.columns.astype(str)
+
+        data_current_if = pm2.pm2io.convert_wide_dataframe_if(
+            df_current,
+            coords_cols=coords_cols_current,
+            add_coords_cols=None,
+            coords_defaults=coords_defaults_current,
+            coords_terminologies=coords_terminologies,
+            coords_value_mapping=coords_value_mapping_current,
+            # coords_value_filling=None,
+            filter_remove=filter_remove,
+            # filter_keep=filter_keep,
+            meta_data=meta_data,
+            time_format=time_format,
+        )
+        data_current_pm2 = pm2.pm2io.from_interchange_format(data_current_if)
+
+        if data_pm2 is None:
+            data_pm2 = data_current_pm2
+        else:
+            data_pm2 = data_pm2.pr.merge(data_current_pm2)
+
+    # convert back to IF to have units in the fixed format
+    data_if = data_pm2.pr.to_interchange_format()
+
+    # ###
+    # save data to IF and native format
+    # ###
+    pm2.pm2io.write_interchange_format(
+        output_folder / (output_filename + coords_terminologies["category"]), data_if
     )
 
-    # process category and entity
-    if current_sheet_config["entity"].startswith("COL_"):
-        # processing with entity
-        entity_col = current_sheet_config["entity"][4:]
-        df_current[entity_col] = df_current[entity_col].ffill()
-        df_current[current_sheet_config["cat_cols"]] = df_current[
-            current_sheet_config["cat_cols"]
-        ].fillna(value="Total")
-        df_current[entity_col] = df_current[entity_col].str.replace("\n", "")
-        df_current[entity_col] = df_current[entity_col].str.strip()
-    else:
-        # entity given for whole table
-        # print('not implemented')
-        df_current[current_sheet_config["cat_cols"]] = df_current[
-            current_sheet_config["cat_cols"]
-        ].bfill(axis=1)
-        df_current = df_current.drop(columns=current_sheet_config["cat_cols"][1:])
-    df_current = df_current.rename(
-        columns={current_sheet_config["cat_cols"][0]: name_for_cat_col}
+    encoding = {var: compression for var in data_pm2.data_vars}
+    data_pm2.pr.to_netcdf(
+        output_folder / (output_filename + coords_terminologies["category"] + ".nc"),
+        encoding=encoding,
     )
-    df_current[name_for_cat_col] = df_current[name_for_cat_col].str.replace("\n", "")
-    df_current[name_for_cat_col] = df_current[name_for_cat_col].str.strip()
-
-    # convert to primap2 format
-    coords_value_mapping_current = coords_value_mapping.copy()
-    coords_value_mapping_current["category"] = current_sheet_config["cat_mapping"]
-    coords_cols_current = coords_cols.copy()
-    coords_defaults_current = coords_defaults.copy()
-    coords_defaults_current["unit"] = current_sheet_config["unit"]
-    if current_sheet_config["entity"].startswith("COL_"):
-        coords_cols_current["entity"] = entity_col
-    else:
-        coords_defaults_current["entity"] = current_sheet_config["entity"]
-
-    # make sure all column names are str
-    df_current.columns = df_current.columns.astype(str)
-
-    data_current_if = pm2.pm2io.convert_wide_dataframe_if(
-        df_current,
-        coords_cols=coords_cols_current,
-        add_coords_cols=None,
-        coords_defaults=coords_defaults_current,
-        coords_terminologies=coords_terminologies,
-        coords_value_mapping=coords_value_mapping_current,
-        # coords_value_filling=None,
-        filter_remove=filter_remove,
-        # filter_keep=filter_keep,
-        meta_data=meta_data,
-        time_format=time_format,
-    )
-    data_current_pm2 = pm2.pm2io.from_interchange_format(data_current_if)
-
-    if data_pm2 is None:
-        data_pm2 = data_current_pm2
-    else:
-        data_pm2 = data_pm2.pr.merge(data_current_pm2)
 
-# convert back to IF to have units in the fixed format
-data_if = data_pm2.pr.to_interchange_format()
-
-# ###
-# save data to IF and native format
-# ###
-pm2.pm2io.write_interchange_format(
-    output_folder / (output_filename + coords_terminologies["category"]), data_if
-)
-
-encoding = {var: compression for var in data_pm2.data_vars}
-data_pm2.pr.to_netcdf(
-    output_folder / (output_filename + coords_terminologies["category"] + ".nc"),
-    encoding=encoding,
-)
+    # ###
+    # conversion to ipcc 2006 categories
+    # ###
 
-# ###
-# conversion to ipcc 2006 categories
-# ###
+    data_pm2_2006 = data_pm2.copy()
 
-data_pm2_2006 = data_pm2.copy()
+    # actual processing
 
-# actual processing
+    country_processing = {
+        "basket_copy": basket_copy,
+    }
 
-country_processing = {
-    "basket_copy": basket_copy,
-}
-
-data_pm2_2006 = process_data_for_country(
-    data_pm2_2006,
-    entities_to_ignore=[],
-    gas_baskets=gas_baskets,
-    processing_info_country=country_processing,
-    cat_terminology_out=terminology_proc,
-    category_conversion=cat_conversion,
-    # sectors_out=sectors_to_save,
-)
-
-# adapt source and metadata
-# TODO: processing info is present twice
-current_source = data_pm2_2006.coords["source"].to_numpy()[0]
-data_temp = data_pm2_2006.pr.loc[{"source": current_source}]
-data_pm2_2006 = data_pm2_2006.pr.set("source", "AI_INV", data_temp)
-data_pm2_2006 = data_pm2_2006.pr.loc[{"source": ["AI_INV"]}]
+    data_pm2_2006 = process_data_for_country(
+        data_pm2_2006,
+        entities_to_ignore=[],
+        gas_baskets=gas_baskets,
+        processing_info_country=country_processing,
+        cat_terminology_out=terminology_proc,
+        category_conversion=cat_conversion,
+        # sectors_out=sectors_to_save,
+    )
 
+    # adapt source and metadata
+    # TODO: processing info is present twice
+    current_source = data_pm2_2006.coords["source"].to_numpy()[0]
+    data_temp = data_pm2_2006.pr.loc[{"source": current_source}]
+    data_pm2_2006 = data_pm2_2006.pr.set("source", "AI_INV", data_temp)
+    data_pm2_2006 = data_pm2_2006.pr.loc[{"source": ["AI_INV"]}]
 
-# convert back to IF to have units in the fixed format
-data_if_2006 = data_pm2_2006.pr.to_interchange_format()
+    # convert back to IF to have units in the fixed format
+    data_if_2006 = data_pm2_2006.pr.to_interchange_format()
 
-pm2.pm2io.write_interchange_format(
-    output_folder / (output_filename + terminology_proc),
-    data_if_2006,
-)
+    pm2.pm2io.write_interchange_format(
+        output_folder / (output_filename + terminology_proc),
+        data_if_2006,
+    )
 
-encoding = {var: compression for var in data_pm2_2006.data_vars}
-data_pm2_2006.pr.to_netcdf(
-    output_folder / (output_filename + terminology_proc + ".nc"),
-    encoding=encoding,
-)
+    encoding = {var: compression for var in data_pm2_2006.data_vars}
+    data_pm2_2006.pr.to_netcdf(
+        output_folder / (output_filename + terminology_proc + ".nc"),
+        encoding=encoding,
+    )