Browse Source

CRT reading ready for testing

Johannes Gütschow 9 months ago
parent
commit
fd8821ad0a

+ 93 - 80
dodo.py

@@ -10,8 +10,12 @@ from doit import get_var
 root_path = "."
 os.environ["UNFCCC_GHG_ROOT_PATH"] = root_path
 
+from unfccc_ghg_data.unfccc_crf_reader.unfccc_crf_reader_devel import (  # noqa: E402
+    read_year_to_test_specs,
+)
 from unfccc_ghg_data.unfccc_crf_reader.unfccc_crf_reader_prod import (  # noqa: E402
     read_crf_for_country_datalad,
+    read_new_crf_for_year_datalad,
 )
 
 
@@ -400,6 +404,7 @@ read_config_crf = {
     "countries": get_var("countries", None),
     "data_year": get_var("data_year", None),
     "totest": get_var("totest", None),
+    "type": get_var("type", "CRF"),
 }
 
 
@@ -416,6 +421,7 @@ def task_read_unfccc_crf_submission():
             submission_year=int(read_config_crf["submission_year"]),
             submission_date=read_config_crf["submission_date"],
             re_read=re_read,
+            type=read_config_crf["type"],
         )
 
     return {
@@ -429,86 +435,93 @@ def task_read_unfccc_crf_submission():
     }
 
 
-#
-# def task_read_new_unfccc_crf_for_year():
-#     """
-#     Read CRF submission for all countries for given submission year.
-#
-#     By default only reads data not present yet. Only reads the latest updated
-#     submission for each country.
-#     """
-#     actions = [
-#         f"python src/unfccc_ghg_data/unfccc_crf_reader"
-#         f"/read_new_unfccc_crf_for_year_datalad.py "
-#         f"--submission_year={read_config_crf['submission_year']} ",
-#         "python src/unfccc_ghg_data/helper/folder_mapping.py "
-#         "--folder=extracted_data/UNFCCC",
-#     ]
-#     # specifying countries is currently disabled duo to problems with command line
-#     # list arguments
-#     # if read_config_crf["countries"] is not None:
-#     #        actions[0] = actions[0] + f"--countries={read_config_crf['countries']} "
-#     if read_config_crf["re_read"] == "True":
-#         actions[0] = actions[0] + " --re_read"
-#     return {
-#         #'basename': "Read_CRF_year",
-#         "actions": actions,
-#         "task_dep": ["set_env"],
-#         "verbosity": 2,
-#         "setup": ["in_venv"],
-#     }
-#
-#
-# def task_test_read_unfccc_crf_for_year():
-#     """
-#     Test CRF reading.
-#
-#     Test CRF with a single year only for speed and logging to extend specifications
-#     if necessary.
-#     """
-#     actions = [
-#         f"python "
-#         f"src/unfccc_ghg_data/unfccc_crf_reader"
-#         f"/test_read_unfccc_crf_for_year.py "
-#         f"--submission_year={read_config_crf['submission_year']} "
-#         f"--country={read_config_crf['country']} "
-#     ]
-#     if read_config_crf["totest"] == "True":
-#         actions[0] = actions[0] + " --totest"
-#
-#     if read_config_crf["data_year"] is not None:
-#         actions[0] = actions[0] + f"--data_year={read_config_crf['data_year']} "
-#     return {
-#         #'basename': "Read_CRF_year",
-#         "actions": actions,
-#         "task_dep": ["set_env"],
-#         "verbosity": 2,
-#         "setup": ["in_venv"],
-#     }
-#
-#
-# def task_compile_raw_unfccc_crf_for_year():
-#     """
-#     Collect all latest CRF submissions for a given year
-#
-#     Reads the latest data fromt he extracted data folder for each country.
-#     Notifies the user if new data are available in the downloaded_data folder
-#     which have not yet been read.
-#
-#     Data are saved in the datasets/UNFCCC/CRFYYYY folder.
-#     """
-#     actions = [
-#         f"python "
-#         f"src/unfccc_ghg_data/unfccc_crf_reader/crf_raw_for_year.py "
-#         f"--submission_year={read_config_crf['submission_year']} "
-#     ]
-#     return {
-#         "actions": actions,
-#         "task_dep": ["set_env"],
-#         "verbosity": 2,
-#         "setup": ["in_venv"],
-#     }
-#
+def task_read_new_unfccc_crf_for_year():
+    """
+    Read CRF/CRT submission for all countries for given submission year.
+
+    By default only reads data not present yet. Only reads the latest updated
+    submission for each country.
+    """
+
+    def read_new_CRF():
+        if read_config_crf["re_read"] == "True":
+            re_read = True
+        else:
+            re_read = False
+        read_new_crf_for_year_datalad(
+            submission_year=int(read_config_crf["submission_year"]),
+            countries=read_config_crf["countries"],
+            re_read=re_read,
+            type=read_config_crf["type"],
+        )
+
+    return {
+        "actions": [
+            (read_new_CRF,),
+            (map_folders, ["extracted_data/UNFCCC"]),
+        ],
+        "task_dep": ["set_env"],
+        "verbosity": 2,
+        "setup": ["in_venv"],
+    }
+
+
+def task_test_read_unfccc_crf_for_year():
+    """
+    Test CRF/CRT reading.
+
+    Test CRF/CRT with a single year only for speed and logging to extend specifications
+    if necessary.
+    """
+
+    def read_CRF():
+        if read_config_crf["totest"] == "True":
+            totest = True
+        else:
+            totest = False
+        if read_config_crf["data_year"] is not None:
+            data_year = int(read_config_crf["data_year"])
+        else:
+            data_year = None
+        read_year_to_test_specs(
+            submission_year=int(read_config_crf["submission_year"]),
+            data_year=data_year,
+            totest=totest,
+            country_code=read_config_crf["country"],
+            type=read_config_crf["type"],
+        )
+
+    return {
+        "actions": [(read_CRF,)],
+        "verbosity": 2,
+        "setup": ["in_venv"],
+    }
+
+
+def task_compile_raw_unfccc_crf_for_year():
+    """
+    Collect all latest CRF/CRT submissions for a given year / submission round
+
+    Reads the latest data from the extracted data folder for each country.
+    Notifies the user if new data are available in the downloaded_data folder
+    which have not yet been read.
+
+    Data are saved in the datasets/UNFCCC/[CRFYYYY|CRTX] folder.
+    """
+    actions = [
+        f"python "
+        f"src/unfccc_ghg_data/unfccc_crf_reader/crf_raw_for_year.py "
+        f"--submission_year={read_config_crf['submission_year']} "
+        f"--type={read_config_crf['type']} "
+    ]
+    return {
+        "actions": actions,
+        "task_dep": ["set_env"],
+        "verbosity": 2,
+        "setup": ["in_venv"],
+    }
+
+
 #
 # # tasks for DI reader
 # # datalad run is called from within the read_unfccc_di_for_country.py script

+ 8 - 1
src/unfccc_ghg_data/unfccc_crf_reader/crf_specifications/__init__.py

@@ -6,5 +6,12 @@ from .crf2021_specification import CRF2021
 from .crf2022_specification import CRF2022
 from .crf2023_aus_specification import CRF2023_AUS
 from .crf2023_specification import CRF2023
+from .crt1_specification import CRT1
 
-__all__ = ["CRF2021", "CRF2022", "CRF2023", "CRF2023_AUS"]
+__all__ = [
+    "CRF2021",
+    "CRF2022",
+    "CRF2023",
+    "CRF2023_AUS",
+    "CRT1",
+]

+ 1738 - 0
src/unfccc_ghg_data/unfccc_crf_reader/crf_specifications/crt1_specification.py

@@ -0,0 +1,1738 @@
+"""
+
+CRT1 specification So far based on Australia only.
+
+Since 2023 Australia reports in the CRT (common reporting tables) format which is
+similar but not identical to CRF. Some tables are different and it is more
+consistent in using sector titles etc. Thus it needs a special specification.
+
+Currently not all tables are included. Extend if you need all country
+specific items in categories XXXXX
+
+Tables included:
+
+* **Energy:** 'Table1', 'Table1.A(a)s1', 'Table1.A(a)s2', 'Table1.A(a)s3',
+  'Table1.A(a)s4', 'Table1.B.1', 'Table1.B.2', 'Table1.C',
+* **Industrial processes:** 'Table2(I), 'Table2(II)',
+* **Agriculture:** 'Table3', 'Table3.A', 'Table3.B(a)', 'Table3.B(b)', 'Table3.C', 'Table3.D',
+* **LULUCF:**  'Table4',
+* **Waste:**  'Table5',
+* **Summary:** 'Summary1'
+
+Missing tables are:
+
+* **Energy:** 'Table1.A(b)', 'Table1.A(c)', 'Table1.A(d)', 'Table1.D'
+* **Industrial processes:** 'Table2(I).A-H', 'Table2(II)B-Hs1', 'Table2(II)B-Hs2',
+* **Agriculture:** 'Table3.E', 'Table3.F', 'Table3.G-I',
+* **LULUCF**: All tables except Table4
+* **Waste**:  'Table5.A', 'Table5.B', 'Table5.C', 'Table5.D'
+* **Summary:** 'Summary2', 'Summary3', 'Flex_summary',
+* **other:** 'Table6', 'Table7', 'Table8s1', 'Table8s2',
+  'Table9', 'Table10s1', 'Table10s2', 'Table10s3', 'Table10s4', 'Table10s5',
+  'Table10s6'
+
+
+
+TODO:
+* Add missing tables
+* Add activity data
+
+"""
+
+import numpy as np
+
+from .util import unit_info
+
+gwp_to_use = "AR5GWP100"
+
+CRT1 = {
+    # Table1 instead of 1s1 and 1s2
+    "Table1": {
+        "status": "tested",
+        "table": {
+            "firstrow": 8,
+            "lastrow": 59,
+            "header": ["entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category"],
+            "cols_to_ignore": [],
+            "stop_cats": ["", np.nan],
+            "unit_info": unit_info["industry"],
+        },
+        "sector_mapping": [
+            ["Total Energy", ["1"]],
+            ["1.A. Fuel combustion activities (sectoral approach)", ["1.A"]],
+            ["1.A.1. Energy industries", ["1.A.1"]],
+            ["1.A.1.a. Public electricity and heat production", ["1.A.1.a"]],
+            ["1.A.1.b. Petroleum refining", ["1.A.1.b"]],
+            [
+                "1.A.1.c. Manufacture of solid fuels and other energy industries",
+                ["1.A.1.c"],
+            ],
+            ["1.A.2. Manufacturing industries and construction", ["1.A.2"]],
+            ["1.A.2.a. Iron and steel", ["1.A.2.a"]],
+            ["1.A.2.b. Non-ferrous metals", ["1.A.2.b"]],
+            ["1.A.2.c. Chemicals", ["1.A.2.c"]],
+            ["1.A.2.d. Pulp, paper and print", ["1.A.2.d"]],
+            ["1.A.2.e. Food processing, beverages and tobacco", ["1.A.2.e"]],
+            ["1.A.2.f. Non-metallic minerals", ["1.A.2.f"]],
+            ["1.A.2.g. Other", ["1.A.2.g"]],
+            ["1.A.3. Transport", ["1.A.3"]],
+            ["1.A.3.a. Domestic aviation", ["1.A.3.a"]],
+            ["1.A.3.b. Road transportation", ["1.A.3.b"]],
+            ["1.A.3.c. Railways", ["1.A.3.c"]],
+            ["1.A.3.d. Domestic navigation", ["1.A.3.d"]],
+            ["1.A.3.e. Other transportation", ["1.A.3.e"]],
+            ["1.A.4. Other sectors", ["1.A.4"]],
+            ["1.A.4.a. Commercial/institutional", ["1.A.4.a"]],
+            ["1.A.4.b. Residential", ["1.A.4.b"]],
+            ["1.A.4.c. Agriculture/forestry/fishing", ["1.A.4.c"]],
+            ["1.A.5. Other", ["1.A.5"]],
+            ["1.A.5.a. Stationary", ["1.A.5.a"]],
+            ["1.A.5.b. Mobile", ["1.A.5.b"]],
+            ["1.B. Fugitive emissions from fuels", ["1.B"]],
+            ["1.B.1. Solid fuels", ["1.B.1"]],
+            ["1.B.1.a. Coal mining and handling", ["1.B.1.a"]],
+            ["1.B.1.b. Fuel transformation", ["1.B.1.b"]],
+            ["1.B.1.c. Other", ["1.B.1.c"]],
+            [
+                "1.B.2. Oil and natural gas and other emissions from energy production",
+                ["1.B.2"],
+            ],
+            ["1.B.2.a. Oil", ["1.B.2.a"]],
+            ["1.B.2.b. Natural gas", ["1.B.2.b"]],
+            ["1.B.2.c. Venting and flaring", ["1.B.2.c"]],
+            ["1.B.2.d. Other", ["1.B.2.d"]],
+            ["1.C. CO2 Transport and storage", ["1.C"]],
+            ["1.C.1. Transport of CO2", ["1.C.1"]],
+            ["1.C.2. Injection and storage", ["1.C.2"]],
+            ["1.C.3. Other", ["1.C.3"]],
+            ["1.D. Memo items: (3)", ["\\IGNORE"]],
+            ["1.D.1. International bunkers", ["M.Memo.Int"]],
+            ["1.D.1.a. Aviation", ["M.Memo.Int.Avi"]],
+            ["1.D.1.b.Navigation", ["M.Memo.Int.Mar"]],
+            ["1.D.2. Multilateral operations", ["M.Memo.Mult"]],
+            ["1.D.3. CO2 emissions from biomass", ["M.Memo.Bio"]],
+            ["1.D.4. CO2 captured", ["M.Memo.CO2Cap"]],
+            ["1.D.4.a. For domestic storage", ["M.Memo.CO2Cap.Dom"]],
+            ["1.D.4.b. For storage in other countries", ["M.Memo.CO2Cap.Exp"]],
+        ],
+        "entity_mapping": {
+            "NOX": "NOx",
+            "Total GHG emissions (1)": f"KYOTOGHG ({gwp_to_use})",
+        },
+        "coords_defaults": {
+            "class": "Total",
+        },
+    },  # tested
+    "Table1.A(a)s1": {
+        "status": "tested",
+        "table": {
+            "firstrow": 7,
+            "lastrow": 88,
+            "header": ["group", "entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category", "class"],
+            "cols_to_ignore": [
+                "AGGREGATE ACTIVITY DATA Consumption",
+                "AGGREGATE ACTIVITY DATA Consumption",
+                "IMPLIED EMISSION FACTORS CO2 (1)",
+                "IMPLIED EMISSION FACTORS CH4",
+                "IMPLIED EMISSION FACTORS N2O",
+                "AMOUNT CAPTURED (4) CO2",
+            ],
+            "stop_cats": ["", np.nan],
+            "unit_info": unit_info["default"],
+        },
+        "sector_mapping": [
+            ["1.A. Fuel combustion", ["1.A", "Total"], 0],
+            ["Liquid fuels", ["1.A", "Liquid"], 1],
+            ["Solid fuels", ["1.A", "Solid"], 1],
+            ["Gaseous fuels (6)", ["1.A", "Gaseous"], 1],
+            ["Other fossil fuels (7)", ["1.A", "OtherFF"], 1],
+            ["Peat (8)", ["1.A", "Peat"], 1],
+            ["Biomass (3)", ["1.A", "Biomass"], 1],
+            # 1.A.1. Energy industries
+            ["1.A.1. Energy industries", ["1.A.1", "Total"], 1],
+            ["Liquid fuels", ["1.A.1", "Liquid"], 2],
+            ["Solid fuels", ["1.A.1", "Solid"], 2],
+            ["Gaseous fuels (6)", ["1.A.1", "Gaseous"], 2],
+            ["Other fossil fuels (7)", ["1.A.1", "OtherFF"], 2],
+            ["Peat (8)", ["1.A.1", "Peat"], 2],
+            ["Biomass (3)", ["1.A.1", "Biomass"], 2],
+            # a. Public electricity and heat production
+            [
+                "1.A.1.a. Public electricity and heat production (9)",
+                ["1.A.1.a", "Total"],
+                2,
+            ],
+            ["Liquid fuels", ["1.A.1.a", "Liquid"], 3],
+            ["Solid fuels", ["1.A.1.a", "Solid"], 3],
+            ["Gaseous fuels (6)", ["1.A.1.a", "Gaseous"], 3],
+            ["Other fossil fuels (7)", ["1.A.1.a", "OtherFF"], 3],
+            ["Peat (8)", ["1.A.1.a", "Peat"], 3],
+            ["Biomass (3)", ["1.A.1.a", "Biomass"], 3],
+            ["Drop-down list:", ["\\IGNORE", "\\IGNORE"], 3],  # (empty)
+            # 1.A.1.a.i Electricity Generation
+            ["1.A.1.a.i. Electricity generation", ["1.A.1.a.i", "Total"], 3],
+            ["Liquid fuels", ["1.A.1.a.i", "Liquid"], 4],
+            ["Solid fuels", ["1.A.1.a.i", "Solid"], 4],
+            ["Gaseous fuels (6)", ["1.A.1.a.i", "Gaseous"], 4],
+            ["Other fossil fuels (7)", ["1.A.1.a.i", "OtherFF"], 4],
+            ["Peat (8)", ["1.A.1.a.i", "Peat"], 4],
+            ["Biomass (3)", ["1.A.1.a.i", "Biomass"], 4],
+            # 1.A.1.a.ii Combined heat and power generation
+            [
+                "1.A.1.a.ii. Combined heat and power generation",
+                ["1.A.1.a.ii", "Total"],
+                3,
+            ],
+            ["Liquid fuels", ["1.A.1.a.ii", "Liquid"], 4],
+            ["Solid fuels", ["1.A.1.a.ii", "Solid"], 4],
+            ["Gaseous fuels (6)", ["1.A.1.a.ii", "Gaseous"], 4],
+            ["Other fossil fuels (7)", ["1.A.1.a.ii", "OtherFF"], 4],
+            ["Peat (8)", ["1.A.1.a.ii", "Peat"], 4],
+            ["Biomass (3)", ["1.A.1.a.ii", "Biomass"], 4],
+            # 1.A.1.a.iii heat plants
+            ["1.A.1.a.iii. Heat plants", ["1.A.1.a.iii", "Total"], 3],
+            ["Liquid fuels", ["1.A.1.a.iii", "Liquid"], 4],
+            ["Solid fuels", ["1.A.1.a.iii", "Solid"], 4],
+            ["Gaseous fuels (6)", ["1.A.1.a.iii", "Gaseous"], 4],
+            ["Other fossil fuels (7)", ["1.A.1.a.iii", "OtherFF"], 4],
+            ["Peat (8)", ["1.A.1.a.iii", "Peat"], 4],
+            ["Biomass (3)", ["1.A.1.a.iii", "Biomass"], 4],
+            # b. Petroleum refining
+            ["1.A.1.b. Petroleum refining", ["1.A.1.b", "Total"], 2],
+            ["Liquid fuels", ["1.A.1.b", "Liquid"], 3],
+            ["Solid fuels", ["1.A.1.b", "Solid"], 3],
+            ["Gaseous fuels (6)", ["1.A.1.b", "Gaseous"], 3],
+            ["Other fossil fuels (7)", ["1.A.1.b", "OtherFF"], 3],
+            ["Peat (8)", ["1.A.1.b", "Peat"], 3],
+            ["Biomass (3)", ["1.A.1.b", "Biomass"], 3],
+            # c. Manufacture of solid fuels and other energy industries
+            [
+                "1.A.1.c. Manufacture of solid fuels and other energy industries (10)",
+                ["1.A.1.c", "Total"],
+                2,
+            ],
+            ["Liquid fuels", ["1.A.1.c", "Liquid"], 3],
+            ["Solid fuels", ["1.A.1.c", "Solid"], 3],
+            ["Gaseous fuels (6)", ["1.A.1.c", "Gaseous"], 3],
+            ["Other fossil fuels (7)", ["1.A.1.c", "OtherFF"], 3],
+            ["Peat (8)", ["1.A.1.c", "Peat"], 3],
+            ["Biomass (3)", ["1.A.1.c", "Biomass"], 3],
+            ["Drop-down list:", ["\\IGNORE", "\\IGNORE"], 3],  # (empty)
+            # 1.A.1.c.i Manufacture of solid fuels
+            ["1.A.1.c.i. Manufacture of solid fuels", ["1.A.1.c.i", "Total"], 3],
+            ["Liquid fuels", ["1.A.1.c.i", "Liquid"], 4],
+            ["Solid fuels", ["1.A.1.c.i", "Solid"], 4],
+            ["Gaseous fuels (6)", ["1.A.1.c.i", "Gaseous"], 4],
+            ["Other fossil fuels (7)", ["1.A.1.c.i", "OtherFF"], 4],
+            ["Peat (8)", ["1.A.1.c.i", "Peat"], 4],
+            ["Biomass (3)", ["1.A.1.c.i", "Biomass"], 4],
+            # 1.A.1.c.ii Oil and gas extraction
+            ["1.A.1.c.ii. Oil and gas extraction", ["1.A.1.c.ii", "Total"], 3],
+            ["Liquid fuels", ["1.A.1.c.ii", "Liquid"], 4],
+            ["Solid fuels", ["1.A.1.c.ii", "Solid"], 4],
+            ["Gaseous fuels (6)", ["1.A.1.c.ii", "Gaseous"], 4],
+            ["Other fossil fuels (7)", ["1.A.1.c.ii", "OtherFF"], 4],
+            ["Peat (8)", ["1.A.1.c.ii", "Peat"], 4],
+            ["Biomass (3)", ["1.A.1.c.ii", "Biomass"], 4],
+            # 1.A.1.c.iii Other energy industries
+            ["1.A.1.c.iii. Other energy industries", ["1.A.1.c.iii", "Total"], 3],
+            ["Liquid fuels", ["1.A.1.c.iii", "Liquid"], 4],
+            ["Solid fuels", ["1.A.1.c.iii", "Solid"], 4],
+            ["Gaseous fuels (6)", ["1.A.1.c.iii", "Gaseous"], 4],
+            ["Other fossil fuels (7)", ["1.A.1.c.iii", "OtherFF"], 4],
+            ["Peat (8)", ["1.A.1.c.iii", "Peat"], 4],
+            ["Biomass (3)", ["1.A.1.c.iii", "Biomass"], 4],
+        ],
+        "entity_mapping": {
+            "EMISSIONS CH4": "CH4",
+            "EMISSIONS CO2 (2,3)": "CO2",
+            "EMISSIONS N2O": "N2O",
+        },
+    },  # tested
+    "Table1.A(a)s2": {
+        "status": "tested",
+        "table": {
+            "firstrow": 7,
+            "lastrow": 119,
+            "header": ["group", "entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category", "class"],
+            "cols_to_ignore": [
+                "AGGREGATE ACTIVITY DATA Consumption",
+                "AGGREGATE ACTIVITY DATA Consumption",
+                "IMPLIED EMISSION FACTORS CO2 (1)",
+                "IMPLIED EMISSION FACTORS CH4",
+                "IMPLIED EMISSION FACTORS N2O",
+                "AMOUNT CAPTURED (4) CO2",
+            ],
+            "stop_cats": ["", np.nan],
+            "unit_info": unit_info["default"],
+        },
+        "sector_mapping": [
+            ["1.A.2 Manufacturing industries and construction", ["1.A.2", "Total"], 0],
+            ["Liquid fuels", ["1.A.2", "Liquid"], 1],
+            ["Solid fuels", ["1.A.2", "Solid"], 1],
+            ["Gaseous fuels (6)", ["1.A.2", "Gaseous"], 1],
+            ["Other fossil fuels (7)", ["1.A.2", "OtherFF"], 1],
+            ["Peat (8)", ["1.A.2", "Peat"], 1],
+            ["Biomass (3)", ["1.A.2", "Biomass"], 1],
+            # a. Iron and Steel
+            ["1.A.2.a. Iron and steel", ["1.A.2.a", "Total"], 1],
+            ["Liquid fuels", ["1.A.2.a", "Liquid"], 2],
+            ["Solid fuels", ["1.A.2.a", "Solid"], 2],
+            ["Gaseous fuels (6)", ["1.A.2.a", "Gaseous"], 2],
+            ["Other fossil fuels (7)", ["1.A.2.a", "OtherFF"], 2],
+            ["Peat (8)", ["1.A.2.a", "Peat"], 2],
+            ["Biomass (3)", ["1.A.2.a", "Biomass"], 2],
+            # b. non-ferrous metals
+            ["1.A.2.b. Non-ferrous metals", ["1.A.2.b", "Total"], 1],
+            ["Liquid fuels", ["1.A.2.b", "Liquid"], 2],
+            ["Solid fuels", ["1.A.2.b", "Solid"], 2],
+            ["Gaseous fuels (6)", ["1.A.2.b", "Gaseous"], 2],
+            ["Other fossil fuels (7)", ["1.A.2.b", "OtherFF"], 2],
+            ["Peat (8)", ["1.A.2.b", "Peat"], 2],
+            ["Biomass (3)", ["1.A.2.b", "Biomass"], 2],
+            # c. Chemicals
+            ["1.A.2.c. Chemicals", ["1.A.2.c", "Total"], 1],
+            ["Liquid fuels", ["1.A.2.c", "Liquid"], 2],
+            ["Solid fuels", ["1.A.2.c", "Solid"], 2],
+            ["Gaseous fuels (6)", ["1.A.2.c", "Gaseous"], 2],
+            ["Other fossil fuels (7)", ["1.A.2.c", "OtherFF"], 2],
+            ["Peat (8)", ["1.A.2.c", "Peat"], 2],
+            ["Biomass (3)", ["1.A.2.c", "Biomass"], 2],
+            # d. Pulp paper print
+            ["1.A.2.d. Pulp, paper and print", ["1.A.2.d", "Total"], 1],
+            ["Liquid fuels", ["1.A.2.d", "Liquid"], 2],
+            ["Solid fuels", ["1.A.2.d", "Solid"], 2],
+            ["Gaseous fuels (6)", ["1.A.2.d", "Gaseous"], 2],
+            ["Other fossil fuels (7)", ["1.A.2.d", "OtherFF"], 2],
+            ["Peat (8)", ["1.A.2.d", "Peat"], 2],
+            ["Biomass (3)", ["1.A.2.d", "Biomass"], 2],
+            # e. Food processing, beverages and tobacco
+            [
+                "1.A.2.e. Food processing, beverages and tobacco",
+                ["1.A.2.e", "Total"],
+                1,
+            ],
+            ["Liquid fuels", ["1.A.2.e", "Liquid"], 2],
+            ["Solid fuels", ["1.A.2.e", "Solid"], 2],
+            ["Gaseous fuels (6)", ["1.A.2.e", "Gaseous"], 2],
+            ["Other fossil fuels (7)", ["1.A.2.e", "OtherFF"], 2],
+            ["Peat (8)", ["1.A.2.e", "Peat"], 2],
+            ["Biomass (3)", ["1.A.2.e", "Biomass"], 2],
+            # f. non-metallic minerals
+            ["1.A.2.f. Non-metallic minerals", ["1.A.2.f", "Total"], 1],
+            ["Liquid fuels", ["1.A.2.f", "Liquid"], 2],
+            ["Solid fuels", ["1.A.2.f", "Solid"], 2],
+            ["Gaseous fuels (6)", ["1.A.2.f", "Gaseous"], 2],
+            ["Other fossil fuels (7)", ["1.A.2.f", "OtherFF"], 2],
+            ["Peat (8)", ["1.A.2.f", "Peat"], 2],
+            ["Biomass (3)", ["1.A.2.f", "Biomass"], 2],
+            # g. other
+            ["1.A.2.g. Other (11)", ["1.A.2.g", "Total"], 1],
+            ["Liquid fuels", ["1.A.2.f", "Liquid"], 2],
+            ["Solid fuels", ["1.A.2.f", "Solid"], 2],
+            ["Gaseous fuels (6)", ["1.A.2.f", "Gaseous"], 2],
+            ["Other fossil fuels (7)", ["1.A.2.f", "OtherFF"], 2],
+            ["Peat (8)", ["1.A.2.f", "Peat"], 2],
+            ["Biomass (3)", ["1.A.2.f", "Biomass"], 2],
+            ["Drop-down list:", ["\\IGNORE", "\\IGNORE"], 2],
+            # 1.A.2.g.i Manufacturing of machinery
+            ["1.A.2.g.i. Manufacturing of machinery", ["1.A.2.g.i", "Total"], 2],
+            ["Liquid fuels", ["1.A.2.g.i", "Liquid"], 3],
+            ["Solid fuels", ["1.A.2.g.i", "Solid"], 3],
+            ["Gaseous fuels (6)", ["1.A.2.g.i", "Gaseous"], 3],
+            ["Other fossil fuels (7)", ["1.A.2.g.i", "OtherFF"], 3],
+            ["Peat (8)", ["1.A.2.g.i", "Peat"], 3],
+            ["Biomass (3)", ["1.A.2.g.i", "Biomass"], 3],
+            # 1.A.2.g.ii Manufacturing of transport equipment
+            [
+                "1.A.2.g.ii. Manufacturing of transport equipment",
+                ["1.A.2.g.ii", "Total"],
+                2,
+            ],
+            ["Liquid fuels", ["1.A.2.g.ii", "Liquid"], 3],
+            ["Solid fuels", ["1.A.2.g.ii", "Solid"], 3],
+            ["Gaseous fuels (6)", ["1.A.2.g.ii", "Gaseous"], 3],
+            ["Other fossil fuels (7)", ["1.A.2.g.ii", "OtherFF"], 3],
+            ["Peat (8)", ["1.A.2.g.ii", "Peat"], 3],
+            ["Biomass (3)", ["1.A.2.g.ii", "Biomass"], 3],
+            # 1.A.2.g.iii Mining (excluding fuels) and quarrying
+            [
+                "1.A.2.g.iii. Mining (excluding fuels) and quarrying",
+                ["1.A.2.g.iii", "Total"],
+                2,
+            ],
+            ["Liquid fuels", ["1.A.2.g.iii", "Liquid"], 3],
+            ["Solid fuels", ["1.A.2.g.iii", "Solid"], 3],
+            ["Gaseous fuels (6)", ["1.A.2.g.iii", "Gaseous"], 3],
+            ["Other fossil fuels (7)", ["1.A.2.g.iii", "OtherFF"], 3],
+            ["Peat (8)", ["1.A.2.g.iii", "Peat"], 3],
+            ["Biomass (3)", ["1.A.2.g.iii", "Biomass"], 3],
+            # 1.A.2.g.iv Wood and wood products
+            ["1.A.2.g.iv. Wood and wood products", ["1.A.2.g.iv", "Total"], 2],
+            ["Liquid fuels", ["1.A.2.g.iv", "Liquid"], 3],
+            ["Solid Fuels", ["1.A.2.g.iv", "Solid"], 3],
+            ["Gaseous fuels (6)", ["1.A.2.g.iv", "Gaseous"], 3],
+            ["Other fossil fuels (7)", ["1.A.2.g.iv", "OtherFF"], 3],
+            ["Peat (8)", ["1.A.2.g.iv", "Peat"], 3],
+            ["Biomass (3)", ["1.A.2.g.iv", "Biomass"], 3],
+            # 1.A.2.g.v Construction
+            ["1.A.2.g.v. Construction", ["1.A.2.g.v", "Total"], 2],
+            ["Liquid fuels", ["1.A.2.g.v", "Liquid"], 3],
+            ["Solid fuels", ["1.A.2.g.v", "Solid"], 3],
+            ["Gaseous fuels (6)", ["1.A.2.g.v", "Gaseous"], 3],
+            ["Other fossil fuels (7)", ["1.A.2.g.v", "OtherFF"], 3],
+            ["Peat (8)", ["1.A.2.g.v", "Peat"], 3],
+            ["Biomass (3)", ["1.A.2.g.v", "Biomass"], 3],
+            # 1.A.2.g.vi Textile and leather
+            ["1.A.2.g.vi. Textile and leather", ["1.A.2.g.vi", "Total"], 2],
+            ["Liquid fuels", ["1.A.2.g.vi", "Liquid"], 3],
+            ["Solid fuels", ["1.A.2.g.vi", "Solid"], 3],
+            ["Gaseous fuels (6)", ["1.A.2.g.vi", "Gaseous"], 3],
+            ["Other fossil fuels (7)", ["1.A.2.g.vi", "OtherFF"], 3],
+            ["Peat (8)", ["1.A.2.g.vi", "Peat"], 3],
+            ["Biomass (3)", ["1.A.2.g.vi", "Biomass"], 3],
+            # 1.A.2.g.vii Off-road vehicles and other machinery
+            [
+                "1.A.2.g.vii. Off-road vehicles and other machinery",
+                ["1.A.2.g.vii", "Total"],
+                2,
+            ],
+            ["Gasoline", ["1.A.2.g.vii", "Gasoline"], 3],
+            ["Diesel oil", ["1.A.2.g.vii", "DieselOil"], 3],
+            ["Liquefied petroleum gases (LPG)", ["1.A.2.g.vii", "LPG"], 3],
+            ["Other liquid fuels (please specify)", ["1.A.2.g.vii", "OtherLiquid"], 3],
+            ["NA", ["\\IGNORE", "\\IGNORE"], 3],
+            ["Gaseous fuels (6)", ["1.A.2.g.vii", "Gaseous"], 3],
+            ["Other fossil fuels (7)", ["1.A.2.g.vii", "OtherFF"], 3],
+            ["Biomass (3)", ["1.A.2.g.vii", "Biomass"], 3],
+            # 1.A.2.g.viii Other (please specify)
+            ["1.A.2.g.viii. Other (please specify)", ["1.A.2.g.viii", "Total"], 2],
+            ["All Other Manufacturing", ["1.A.2.g.viii.3", "Total"], 3],
+            ["Liquid fuels", ["1.A.2.g.viii.3", "Liquid"], 4],
+            ["Solid fuels", ["1.A.2.g.viii.3", "Solid"], 4],
+            ["Gaseous fuels (6)", ["1.A.2.g.viii.3", "Gaseous"], 4],
+            ["Other fossil fuels (7)", ["1.A.2.g.viii.3", "OtherFF"], 4],
+            ["Peat (8)", ["1.A.2.g.viii.3", "Peat"], 4],
+            ["Biomass (3)", ["1.A.2.g.viii.3", "Biomass"], 4],
+        ],
+        "entity_mapping": {
+            "EMISSIONS CH4": "CH4",
+            "EMISSIONS CO2 (2,3)": "CO2",
+            "EMISSIONS N2O": "N2O",
+        },
+    },  # tested
+    "Table1.A(a)s3": {
+        "status": "tested",
+        "table": {
+            "firstrow": 7,
+            "lastrow": 121,
+            "header": ["group", "entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category", "class"],
+            "cols_to_ignore": [
+                "AGGREGATE ACTIVITY DATA Consumption",
+                "AGGREGATE ACTIVITY DATA Consumption",
+                "IMPLIED EMISSION FACTORS CO2 (1)",
+                "IMPLIED EMISSION FACTORS CH4",
+                "IMPLIED EMISSION FACTORS N2O",
+            ],
+            "stop_cats": ["", np.nan],
+            "unit_info": unit_info["default"],
+        },
+        "sector_mapping": [
+            ["1.A.3 Transport", ["1.A.3", "Total"], 0],
+            ["Liquid fuels", ["1.A.3", "Liquid"], 1],
+            ["Solid fuels", ["1.A.3", "Solid"], 1],
+            ["Gaseous fuels (6)", ["1.A.3", "Gaseous"], 1],
+            ["Other fossil fuels (7)", ["1.A.3", "OtherFF"], 1],
+            ["Biomass (3)", ["1.A.3", "Biomass"], 1],
+            # a. Domestic Aviation
+            ["1.A.3.a. Domestic aviation (12)", ["1.A.3.a", "Total"], 1],
+            ["Aviation gasoline", ["1.A.3.a", "AvGasoline"], 2],
+            ["Jet kerosene", ["1.A.3.a", "JetKerosene"], 2],
+            ["Biomass", ["1.A.3.a", "Biomass"], 2],
+            # b. road Transportation
+            ["1.A.3.b. Road transportation (13)", ["1.A.3.b", "Total"], 1],
+            ["Gasoline", ["1.A.3.b", "Gasoline"], 2],
+            ["Diesel oil", ["1.A.3.b", "DieselOil"], 2],
+            ["Liquefied petroleum gases (LPG)", ["1.A.3.b", "LPG"], 2],
+            ["Other liquid fuels", ["1.A.3.b", "OtherLiquid"], 2],
+            ["NA", ["\\IGNORE", "\\IGNORE"], 3],
+            ["Gaseous fuels (6)", ["1.A.3.b", "Gaseous"], 2],
+            ["Biomass (3)", ["1.A.3.b", "Biomass"], 2],
+            ["Other fossil fuels (7)", ["1.A.3.b", "OtherFF"], 2],
+            ["Lubricants", ["1.A.3.b", "OFFLubricants"], 3],
+            # i. Cars
+            ["1.A.3.b.i. Cars", ["1.A.3.b.i", "Total"], 2],
+            ["Gasoline", ["1.A.3.b.i", "Gasoline"], 3],
+            ["Diesel oil", ["1.A.3.b.i", "DieselOil"], 3],
+            ["Liquefied petroleum gases (LPG)", ["1.A.3.b.i", "LPG"], 3],
+            ["Other liquid fuels (please specify)", ["1.A.3.b.i", "OtherLiquid"], 3],
+            ["NA", ["\\IGNORE", "\\IGNORE"], 4],
+            ["Gaseous fuels (6)", ["1.A.3.b.i", "Gaseous"], 3],
+            ["Biomass (3)", ["1.A.3.b.i", "Biomass"], 3],
+            ["Other fossil fuels (please specify)(7)", ["1.A.3.b.i", "OtherFF"], 3],
+            ["Lubricants", ["1.A.3.b.i", "OFFLubricants"], 4],
+            # ii. Light duty trucks
+            ["1.A.3.b.ii. Light duty trucks", ["1.A.3.b.ii", "Total"], 2],
+            ["Gasoline", ["1.A.3.b.ii", "Gasoline"], 3],
+            ["Diesel oil", ["1.A.3.b.ii", "DieselOil"], 3],
+            ["Liquefied petroleum gases (LPG)", ["1.A.3.b.ii", "LPG"], 3],
+            ["Other liquid fuels (please specify)", ["1.A.3.b.ii", "OtherLiquid"], 3],
+            ["NA", ["\\IGNORE", "\\IGNORE"], 4],
+            ["Gaseous fuels (6)", ["1.A.3.b.ii", "Gaseous"], 3],
+            ["Biomass (3)", ["1.A.3.b.ii", "Biomass"], 3],
+            ["Other fossil fuels (please specify)(7)", ["1.A.3.b.ii", "OtherFF"], 3],
+            ["Lubricants", ["1.A.3.b.ii", "OFFLubricants"], 4],
+            # iii. Heavy duty trucks and buses
+            ["1.A.3.b.iii. Heavy duty trucks and buses", ["1.A.3.b.iii", "Total"], 2],
+            ["Gasoline", ["1.A.3.b.iii", "Gasoline"], 3],
+            ["Diesel oil", ["1.A.3.b.iii", "DieselOil"], 3],
+            ["Liquefied petroleum gases (LPG)", ["1.A.3.b.iii", "LPG"], 3],
+            ["Other liquid fuels (please specify)", ["1.A.3.b.iii", "OtherLiquid"], 3],
+            ["NA", ["\\IGNORE", "\\IGNORE"], 4],
+            ["Gaseous fuels (6)", ["1.A.3.b.iii", "Gaseous"], 3],
+            ["Biomass (3)", ["1.A.3.b.iii", "Biomass"], 3],
+            ["Other fossil fuels (please specify)(7)", ["1.A.3.b.iii", "OtherFF"], 3],
+            ["Lubricants", ["1.A.3.b.iii", "OFFLubricants"], 4],
+            # iv. Motorcycles
+            ["1.A.3.b.iv. Motorcycles", ["1.A.3.b.iv", "Total"], 2],
+            ["Gasoline", ["1.A.3.b.iv", "Gasoline"], 3],
+            ["Diesel oil", ["1.A.3.b.iv", "DieselOil"], 3],
+            ["Liquefied petroleum gases (LPG)", ["1.A.3.b.iv", "LPG"], 3],
+            ["Other liquid fuels (please specify)", ["1.A.3.b.iv", "OtherLiquid"], 3],
+            ["NA", ["\\IGNORE", "\\IGNORE"], 4],
+            ["Gaseous fuels (6)", ["1.A.3.b.iv", "Gaseous"], 3],
+            ["Biomass (3)", ["1.A.3.b.iv", "Biomass"], 3],
+            ["Other fossil fuels (please specify)(7)", ["1.A.3.b.iv", "OtherFF"], 3],
+            ["Lubricants", ["1.A.3.b.iv", "OFFLubricants"], 4],
+            # v. Other
+            ["1.A.3.b.v. Other (please specify)", ["1.A.3.b.v", "Total"], 2],
+            ["NA", ["\\IGNORE", "\\IGNORE"], 3],
+            ["Gasoline", ["1.A.3.b.v", "Gasoline"], 4],
+            ["Diesel oil", ["1.A.3.b.v", "DieselOil"], 4],
+            ["Liquefied petroleum gases (LPG)", ["1.A.3.b.v", "LPG"], 4],
+            ["Other liquid fuels (please specify)", ["1.A.3.b.v", "OtherLiquid"], 4],
+            ["NA", ["\\IGNORE", "\\IGNORE"], 5],
+            ["Gaseous fuels (6)", ["1.A.3.b.v", "Gaseous"], 4],
+            ["Biomass (3)", ["1.A.3.b.v", "Biomass"], 4],
+            ["Other fossil fuels (please specify)(7)", ["1.A.3.b.v", "OtherFF"], 4],
+            ["Lubricants", ["1.A.3.b.v", "OFFLubricants"], 5],
+            # c. Railways
+            ["1.A.3.c. Railways", ["1.A.3.c", "Total"], 1],
+            ["Liquid fuels", ["1.A.3.c", "Liquid"], 2],
+            ["Solid fuels", ["1.A.3.c", "Solid"], 2],
+            ["Gaseous fuels (6)", ["1.A.3.c", "Gaseous"], 2],
+            ["Biomass (3)", ["1.A.3.c", "Biomass"], 2],
+            ["Other fossil fuels (please specify)(7)", ["1.A.3.c", "OtherFF"], 2],
+            ["Lubricants", ["1.A.3.c", "OFFLubricants"], 3],
+            # d. Domestic navigation
+            ["1.A.3.d. Domestic Navigation (12)", ["1.A.3.d", "Total"], 1],
+            ["Residual fuel oil", ["1.A.3.d", "ResFuelOil"], 2],
+            ["Gas/diesel oil", ["1.A.3.d", "GasDieselOil"], 2],
+            ["Gasoline", ["1.A.3.d", "Gasoline"], 2],
+            ["Other liquid fuels (please specify)", ["1.A.3.d", "OtherLiquid"], 2],
+            ["NA", ["\\IGNORE", "\\IGNORE"], 3],
+            ["Gaseous fuels (6)", ["1.A.3.d", "Gaseous"], 2],
+            ["Biomass (3)", ["1.A.3.d", "Biomass"], 2],
+            ["Other fossil fuels (please specify)(7)", ["1.A.3.d", "OtherFF"], 2],
+            ["Coal", ["1.A.3.d", "OFFCoal"], 3],
+            ["Lubricants", ["1.A.3.d", "OFFLubricants"], 3],
+            # e. other transportation
+            # keep details also for top category as it's present
+            ["1.A.3.e. Other transportation", ["1.A.3.e", "Total"], 1],
+            ["Liquid fuels", ["1.A.3.e", "Liquid"], 2],
+            ["Solid fuels", ["1.A.3.e", "Solid"], 2],
+            ["Gaseous fuels (6)", ["1.A.3.e", "Gaseous"], 2],
+            ["Other fossil fuels (7)", ["1.A.3.e", "OtherFF"], 2],
+            ["Biomass (3)", ["1.A.3.e", "Biomass"], 2],
+            # i. pipeline
+            ["1.A.3.e.i. Pipeline transport", ["1.A.3.e.i", "Total"], 2],
+            ["Liquid fuels", ["1.A.3.e.i", "Liquid"], 3],
+            ["Solid fuels", ["1.A.3.e.i", "Solid"], 3],
+            ["Gaseous fuels (6)", ["1.A.3.e.i", "Gaseous"], 3],
+            ["Other fossil fuels (7)", ["1.A.3.e.i", "OtherFF"], 3],
+            ["Biomass (3)", ["1.A.3.e.i", "Biomass"], 3],
+            # ii other
+            ["1.A.3.e.ii. Other (please specify)", ["1.A.3.e.ii", "Total"], 2],
+            ["Off-road vehicles", ["1.A.3.e.ii.1", "Total"], 3],
+            ["Gasoline", ["1.A.3.e.ii.1", "Gasoline"], 4],
+            ["Gas/Diesel oil", ["1.A.3.e.ii.1", "DieselOil"], 4],
+            ["Liquefied petroleum gases (LPG)", ["1.A.3.e.ii.1", "LPG"], 4],
+            ["Other liquid fuels (please specify)", ["1.A.3.e.ii.1", "OtherLiquid"], 4],
+            ["NA", ["\\IGNORE", "\\IGNORE"], 5],
+            ["Solid fuels", ["1.A.3.e.ii.1", "Solid"], 4],
+            ["Gaseous fuels (6)", ["1.A.3.e.ii.1", "Gaseous"], 4],
+            ["Biomass (3)", ["1.A.3.e.ii.1", "Biomass"], 4],
+            ["Other fossil fuels (7)", ["1.A.3.e.ii.1", "OtherFF"], 4],
+            ["Biomass (3)", ["1.A.3.e.ii.1", "Biomass"], 4],
+        ],
+        "entity_mapping": {
+            "EMISSIONS CH4": "CH4",
+            "EMISSIONS CO2 (2,3)": "CO2",
+            "EMISSIONS N2O": "N2O",
+        },
+    },  # tested
+    "Table1.A(a)s4": {
+        "status": "tested",
+        "table": {
+            "firstrow": 7,
+            "lastrow": 118,
+            "header": ["group", "entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category", "class"],
+            "cols_to_ignore": [
+                "AGGREGATE ACTIVITY DATA Consumption",
+                "AGGREGATE ACTIVITY DATA Consumption",
+                "IMPLIED EMISSION FACTORS CO2 (1)",
+                "IMPLIED EMISSION FACTORS CH4",
+                "IMPLIED EMISSION FACTORS N2O",
+                "AMOUNT CAPTURED (4) CO2",
+            ],
+            "stop_cats": ["", np.nan],
+            "unit_info": unit_info["default"],
+        },
+        "sector_mapping": [
+            ["1.A.4 Other sectors", ["1.A.4", "Total"], 0],
+            ["Liquid fuels", ["1.A.4", "Liquid"], 1],
+            ["Solid fuels", ["1.A.4", "Solid"], 1],
+            ["Gaseous fuels (6)", ["1.A.4", "Gaseous"], 1],
+            ["Other fossil fuels (7)", ["1.A.4", "OtherFF"], 1],
+            ["Peat (8)", ["1.A.4", "Peat"], 1],
+            ["Biomass(3)", ["1.A.4", "Biomass"], 1],
+            # a. Commercial/institutional(12)
+            ["1.A.4.a. Commercial/institutional (14)", ["1.A.4.a", "Total"], 1],
+            ["Liquid fuels", ["1.A.4.a", "Liquid"], 2],
+            ["Solid fuels", ["1.A.4.a", "Solid"], 2],
+            ["Gaseous fuels (6)", ["1.A.4.a", "Gaseous"], 2],
+            ["Other fossil fuels (7)", ["1.A.4.a", "OtherFF"], 2],
+            ["Peat (8)", ["1.A.4.a", "Peat"], 2],
+            ["Biomass (3)", ["1.A.4.a", "Biomass"], 2],
+            ["Drop-down list:", ["\\IGNORE", "\\IGNORE"], 2],  # (empty)
+            # 1.A.4.a.i Stationary combustion
+            ["1.A.4.a.i. Stationary combustion", ["1.A.4.a.i", "Total"], 2],
+            ["Liquid fuels", ["1.A.4.a.i", "Liquid"], 3],
+            ["Solid fuels", ["1.A.4.a.i", "Solid"], 3],
+            ["Gaseous fuels (6)", ["1.A.4.a.i", "Gaseous"], 3],
+            ["Other fossil fuels (7)", ["1.A.4.a.i", "OtherFF"], 3],
+            ["Peat (8)", ["1.A.4.a.i", "Peat"], 3],
+            ["Biomass (3)", ["1.A.4.a.i", "Biomass"], 3],
+            # 1.A.4.a.ii Off-road vehicles and other machinery
+            [
+                "1.A.4.a.ii. Off-road vehicles and other machinery",
+                ["1.A.4.a.ii", "Total"],
+                2,
+            ],
+            ["Liquid fuels", ["1.A.4.a.ii", "Liquid"], 3],
+            ["Solid fuels", ["1.A.4.a.ii", "Solid"], 3],
+            ["Gaseous fuels (6)", ["1.A.4.a.ii", "Gaseous"], 3],
+            ["Other fossil fuels (7)", ["1.A.4.a.ii", "OtherFF"], 3],
+            ["Biomass (3)", ["1.A.4.a.ii", "Biomass"], 3],
+            # b. Residential(13)
+            ["1.A.4.b. Residential (14)", ["1.A.4.b", "Total"], 1],
+            ["Liquid fuels", ["1.A.4.b", "Liquid"], 2],
+            ["Solid fuels", ["1.A.4.b", "Solid"], 2],
+            ["Gaseous fuels (6)", ["1.A.4.b", "Gaseous"], 2],
+            ["Other fossil fuels (7)", ["1.A.4.b", "OtherFF"], 2],
+            ["Peat (8)", ["1.A.4.b", "Peat"], 2],
+            ["Biomass (3)", ["1.A.4.b", "Biomass"], 2],
+            ["Drop-down list:", ["\\IGNORE", "\\IGNORE"], 2],  # (empty)
+            # 1.A.4.b.i Stationary combustion
+            ["1.A.4.b.i. Stationary combustion", ["1.A.4.b.i", "Total"], 2],
+            ["Liquid fuels", ["1.A.4.b.i", "Liquid"], 3],
+            ["Solid fuels", ["1.A.4.b.i", "Solid"], 3],
+            ["Gaseous fuels (6)", ["1.A.4.b.i", "Gaseous"], 3],
+            ["Other fossil fuels (7)", ["1.A.4.b.i", "OtherFF"], 3],
+            ["Peat (8)", ["1.A.4.b.i", "Peat"], 3],
+            ["Biomass (3)", ["1.A.4.b.i", "Biomass"], 3],
+            # 1.A.4.b.ii Off-road vehicles and other machinery
+            [
+                "1.A.4.b.ii. Off-road vehicles and other machinery",
+                ["1.A.4.b.ii", "Total"],
+                2,
+            ],
+            ["Liquid fuels", ["1.A.4.b.ii", "Liquid"], 3],
+            ["Solid fuels", ["1.A.4.b.ii", "Solid"], 3],
+            ["Gaseous fuels (6)", ["1.A.4.b.ii", "Gaseous"], 3],
+            ["Other fossil fuels (7)", ["1.A.4.b.ii", "OtherFF"], 3],
+            ["Peat (8)", ["1.A.4.b.ii", "Peat"], 3],
+            ["Biomass (3)", ["1.A.4.b.ii", "Biomass"], 3],
+            # c. Agriculture/forestry/fishing
+            ["1.A.4.c. Agriculture/forestry/fishing", ["1.A.4.c", "Total"], 1],
+            ["Liquid fuels", ["1.A.4.c", "Liquid"], 2],
+            ["Solid fuels", ["1.A.4.c", "Solid"], 2],
+            ["Gaseous fuels (6)", ["1.A.4.c", "Gaseous"], 2],
+            ["Other fossil fuels (7)", ["1.A.4.c", "OtherFF"], 2],
+            ["Peat (8)", ["1.A.4.c", "Peat"], 2],
+            ["Biomass (3)", ["1.A.4.c", "Biomass"], 2],
+            # i. Stationary
+            ["1.A.4.c.i. Stationary", ["1.A.4.c.i", "Total"], 2],
+            ["Liquid fuels", ["1.A.4.c.i", "Liquid"], 3],
+            ["Solid fuels", ["1.A.4.c.i", "Solid"], 3],
+            ["Gaseous fuels (6)", ["1.A.4.c.i", "Gaseous"], 3],
+            ["Other fossil fuels (7)", ["1.A.4.c.i", "OtherFF"], 3],
+            ["Peat (8)", ["1.A.4.c.i", "Peat"], 3],
+            ["Biomass (3)", ["1.A.4.c.i", "Biomass"], 3],
+            # ii. Off-road vehicles and other machinery
+            [
+                "1.A.4.c.ii. Off-road vehicles and other machinery",
+                ["1.A.4.c.ii", "Total"],
+                2,
+            ],
+            ["Gasoline", ["1.A.4.c.ii", "Gasoline"], 3],
+            ["Diesel oil", ["1.A.4.c.ii", "DieselOil"], 3],
+            ["Liquefied petroleum gases (LPG)", ["1.A.4.c.ii", "LPG"], 3],
+            ["Other liquid fuels (please specify)", ["1.A.4.c.ii", "OtherLiquid"], 3],
+            ["NA", ["\\IGNORE", "\\IGNORE"], 4],
+            ["Gaseous fuels (6)", ["1.A.4.c.ii", "Gaseous"], 3],
+            ["Biomass (3)", ["1.A.4.c.ii", "Biomass"], 3],
+            ["Other fossil fuels (please specify)(7)", ["1.A.4.c.ii", "OtherFF"], 3],
+            ["NA", ["\\IGNORE", "\\IGNORE"], 4],
+            # iii. Fishing
+            ["1.A.4.c.iii. Fishing", ["1.A.4.c.iii", "Total"], 2],
+            ["Residual fuel oil", ["1.A.4.c.iii", "ResFuelOil"], 3],
+            ["Gas/diesel oil", ["1.A.4.c.iii", "GasDieselOil"], 3],
+            ["Gasoline", ["1.A.4.c.iii", "Gasoline"], 3],
+            ["Other liquid fuels (please specify)", ["1.A.4.c.iii", "OtherLiquid"], 3],
+            ["NA", ["\\IGNORE", "\\IGNORE"], 4],
+            ["Gaseous fuels (6)", ["1.A.4.c.iii", "Gaseous"], 3],
+            ["Biomass(3)", ["1.A.4.c.iii", "Biomass"], 3],
+            ["Other fossil fuels (please specify)(7)", ["1.A.4.c.iii", "OtherFF"], 3],
+            ["NA", ["\\IGNORE", "\\IGNORE"], 4],
+            # 1.A.5 Other (Not specified elsewhere)(14)
+            ["1.A.5 Other (Not specified elsewhere)(15)", ["1.A.5", "Total"], 0],
+            ["Liquid fuels", ["1.A.5", "Liquid"], 1],
+            ["Solid fuels", ["1.A.5", "Solid"], 1],
+            ["Gaseous fuels (6)", ["1.A.5", "Gaseous"], 1],
+            ["Other fossil fuels(7)", ["1.A.5", "OtherFF"], 1],
+            ["Peat (8)", ["1.A.5", "Peat"], 1],
+            ["Biomass (3)", ["1.A.5", "Biomass"], 1],
+            # a. Stationary (please specify)
+            ["1.A.5.a. Stationary (please specify)", ["1.A.5.a", "Total"], 1],
+            ["NA", ["\\IGNORE", "\\IGNORE"], 2],
+            ["Liquid fuels", ["1.A.5.a", "Liquid"], 2],
+            ["Solid fuels", ["1.A.5.a", "Solid"], 2],
+            ["Gaseous fuels (6)", ["1.A.5.a", "Gaseous"], 2],
+            ["Other fossil fuels(7)", ["1.A.5.a", "OtherFF"], 2],
+            ["Peat (8)", ["1.A.5.a", "Peat"], 2],
+            ["Biomass (3)", ["1.A.5.a", "Biomass"], 2],
+            # b. Mobile (please specify)
+            ["1.A.5.b. Mobile (please specify)", ["1.A.5.b", "Total"], 1],
+            ["Military Transport", ["1.A.5.b.xii", "Total"], 2],
+            ["Liquid fuels", ["1.A.5.b.xii", "Liquid"], 3],
+            ["Solid fuels", ["1.A.5.b.xii", "Solid"], 3],
+            ["Gaseous fuels (6)", ["1.A.5.b.xii", "Gaseous"], 3],
+            ["Other fossil fuels (7)", ["1.A.5.b.xii", "OtherFF"], 3],
+            ["Biomass(3)", ["1.A.5.b.xii", "Biomass"], 3],
+            # Information Item
+            ["Information item: (16)", ["\\IGNORE", "\\IGNORE"], 0],
+            [
+                "Waste incineration with energy recovery included as:",
+                ["\\IGNORE", "\\IGNORE"],
+                1,
+            ],
+            ["Biomass (3)", ["\\IGNORE", "\\IGNORE"], 1],
+            ["Fossil fuels (7)", ["\\IGNORE", "\\IGNORE"], 1],
+        ],
+        "entity_mapping": {
+            "EMISSIONS CH4": "CH4",
+            "EMISSIONS CO2 (2,3)": "CO2",
+            "EMISSIONS N2O": "N2O",
+        },
+    },  # tested
+    "Table1.B.1": {
+        "status": "tested",
+        "table": {
+            "firstrow": 7,
+            "lastrow": 32,
+            "header": ["group", "entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category"],
+            "cols_to_ignore": [
+                "ACTIVITY DATA Amount of fuel produced",
+                "IMPLIED EMISSION FACTORS CH4 (3)",
+                "IMPLIED EMISSION FACTORS CO2",
+            ],
+            "stop_cats": ["", np.nan],
+            "unit_info": unit_info["default"],
+        },
+        "sector_mapping": [
+            ["1. B. 1. a. Coal mining and handling", ["1.B.1.a"], 0],
+            ["1.B.1.a.i. Underground mines (4)", ["1.B.1.a.i"], 1],
+            ["1.B.1.a.i.1. Mining activities", ["1.B.1.a.i.1"], 2],
+            ["1.B.1.a.i.2. Post-mining activities", ["1.B.1.a.i.2"], 2],
+            [
+                "1.B.1.a.i.3. Abandoned underground mines (number of mines)",
+                ["1.B.1.a.i.3"],
+                2,
+            ],
+            [
+                "1.B.1.a.i.4. Flaring of drained methane or conversion of "
+                "methane to CO2 (5)",
+                ["1.B.1.a.i.4"],
+                2,
+            ],
+            ["1.B.1.a.i.5. Other (please specify)", ["1.B.1.a.i.5"], 2],
+            ["NA", ["\\IGNORE"], 3],
+            ["1.B.1.a.ii. Surface mines (4)", ["1.B.1.a.ii"], 1],
+            ["1.B.1.a.ii.1. Mining activities", ["1.B.1.a.ii.1"], 2],
+            ["1.B.1.a.ii.2. Post-mining activities", ["1.B.1.a.ii.2"], 2],
+            ["1.B.1.a.ii.3. Other (please specify)", ["1.B.1.a.ii.3"], 2],
+            ["NA", ["\\IGNORE"], 3],
+            ["1. B. 1. b. Fuel transformation (6)", ["1.B.1.b"], 0],
+            ["Drop down list:", ["\\IGNORE"], 1],
+            ["1.B.1.b.i. Charcoal and biochar production (7)", ["1.B.1.b.i"], 1],
+            ["1.B.1.b.ii. Coke production", ["1.B.1.b.ii"], 1],
+            ["1.B.1.b.iii. Coal to liquids", ["1.B.1.b.iii"], 1],
+            ["1.B.1.b.iv. Gas to liquids", ["1.B.1.b.iv"], 1],
+            ["1.B.1.b.v. Other (please specify)", ["1.B.1.b.v"], 1],
+            ["NA", ["\\IGNORE"], 2],
+            ["1. B. 1. c. Other (please specify) (8)", ["1.B.1.c"], 0],
+            ["NA", ["\\IGNORE"], 1],
+        ],
+        "entity_mapping": {
+            "EMISSIONS (1) CH4": "CH4 emissions",  # this is necessary because there
+            # is an error in the table and the CH4 emissions don't have the removals
+            # subtracted which would be correct according to the footnotes
+            "EMISSIONS (1) CO2": "CO2",  #  emissions",
+            "RECOVERY/FLARING (2) CH4": "CH4 removals",
+            "RECOVERY/FLARING (2) CO2": "CO2 removals",
+        },
+        "coords_defaults": {
+            "class": "Total",
+        },
+    },  # tested
+    "Table1.B.2": {
+        "status": "tested",
+        "table": {
+            "firstrow": 7,
+            "lastrow": 45,
+            "header": ["group", "entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category"],
+            "cols_to_ignore": [
+                "ACTIVITY DATA (1) Description (1)",
+                "ACTIVITY DATA (1) Unit (1)",
+                "ACTIVITY DATA (1) Value",
+                "IMPLIED EMISSION FACTORS CO2 (3)",
+                "IMPLIED EMISSION FACTORS CH4",
+                "IMPLIED EMISSION FACTORS N2O",
+            ],
+            "stop_cats": [".", np.nan],
+            "unit_info": unit_info["default"],
+        },
+        "sector_mapping": [
+            ["1.B.2.a. Oil (7)", ["1.B.2.a"], 0],
+            ["1.B.2.a.i. Exploration", ["1.B.2.a.1"], 1],
+            ["1.B.2.a.ii. Production and upgrading (8)", ["1.B.2.a.2"], 1],
+            ["1.B.2.a.iii. Transport", ["1.B.2.a.3"], 1],
+            ["1.B.2.a.iv. Refining/storage", ["1.B.2.a.4"], 1],
+            ["1.B.2.a.v. Distribution of oil products", ["1.B.2.a.5"], 1],
+            ["1.B.2.a.vi. Other", ["1.B.2.a.6"], 1],
+            ["Drop down list:", ["\\IGNORE"], 2],
+            ["1.B.2.a.vi.1. Abandoned wells", ["1.B.2.a.6.1"], 2],
+            ["1.B.2.a.vi.2. Other (please specify)", ["1.B.1.a.6.2"], 2],
+            ["NA", ["\\IGNORE"], 3],
+            ["1.B.2.b. Natural gas", ["1.B.2.b"], 0],
+            ["1.B.2.b.i. Exploration", ["1.B.2.b.1"], 1],
+            ["1.B.2.b.ii. Production and gathering (8)", ["1.B.2.b.2"], 1],
+            ["1.B.2.b.iii. Processing", ["1.B.2.b.3"], 1],
+            ["1.B.2.b.iv. Transmission and storage", ["1.B.2.b.4"], 1],
+            ["1.B.2.b.v. Distribution", ["1.B.2.b.5"], 1],
+            ["1.B.2.b.vi. Other", ["1.B.2.b.6"], 1],
+            ["Drop down list:", ["\\IGNORE"], 2],
+            ["1.B.2.b.vi.1. Gas post-meter", ["1.B.2.b.6.1"], 3],
+            ["1.B.2.b.vi.2. Abandoned wells", ["1.B.2.b.6.2"], 3],
+            ["1.B.2.b.vi.3. Other (please specify)", ["1.B.2.b.6.3"], 3],
+            ["LNG Terminals", ["1.B.2.b.6.3.a"], 4],
+            ["LNG Storage", ["1.B.2.b.6.3.b"], 4],
+            ["Natural Gas Storage", ["1.B.2.b.6.3.c"], 4],
+            ["1.B.2.c. Venting and flaring", ["1.B.2.c"], 0],
+            ["1.B.2.c.i. Venting", ["1.B.2.c-ven"], 1],
+            ["1.B.2.c.i.1. Oil", ["1.B.2.c-ven.i"], 2],
+            ["1.B.2.c.i.2. Gas", ["1.B.2.c-ven.ii"], 2],
+            ["1.B.2.c.i.3. Combined", ["1.B.2.c-ven.iii"], 2],
+            ["1.B.2.c.ii. Flaring (9)", ["1.B.2.c-fla"], 1],
+            ["1.B.2.c.ii.1. Oil", ["1.B.2.c-fla.i"], 2],
+            ["1.B.2.c.ii.2. Gas", ["1.B.2.c-fla.ii"], 2],
+            ["1.B.2.c.ii.3. Combined", ["1.B.2.c-fla.iii"], 2],
+            ["1.B.2.d. Other (please specify) (10)", ["1.B.2.d"], 0],
+            ["NA", ["\\IGNORE"], 1],
+        ],
+        "entity_mapping": {
+            "EMISSIONS CH4 (5)": "CH4",
+            "EMISSIONS CO2 (4)": "CO2",  # "CO2 emissions",
+            "EMISSIONS N2O": "N2O",
+            "RECOVERY (2) CO2": "CO2 removals",
+        },
+        "coords_defaults": {
+            "class": "Total",
+        },
+    },  # tested
+    "Table1.C": {
+        "status": "tested",
+        "table": {
+            "firstrow": 7,
+            "lastrow": 29,
+            "header": ["group", "entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category"],
+            "cols_to_ignore": [
+                "ACTIVITY DATA CO2 transported or injected (1)",
+                "IMPLIED EMISSION FACTORS CO2",
+            ],
+            "stop_cats": ["", np.nan],
+            "unit_info": unit_info["default"],
+        },
+        "sector_mapping": [
+            ["1.C.1. Transport of CO2", ["1.C.1"], 0],
+            ["1.C.1.a. Pipelines", ["1.C.1.a"], 1],
+            ["1.C.1.b. Ships", ["1.C.1.b"], 1],
+            ["1.C.1.c. Other (please specify)", ["1.C.1.c"], 1],
+            ["NA", ["\\IGNORE"], 2],
+            ["1.C.2. Injection and storage (3)", ["1.C.2"], 0],
+            ["1.C.2.a. Injection", ["1.C.2.a"], 1],
+            ["1.C.2.b. Storage", ["1.C.2.b"], 1],
+            ["1.C.3. Other (please specify)", ["1.C.3"], 0],
+            ["NA", ["\\IGNORE"], 1],
+            ["Information item (kt CO2) (4, 5, 6)", ["\\IGNORE"], 0],
+            ["Total amount captured for storage (7)", ["M.Info.A.TACS"], 1],
+            ["Total amount of imports for storage (7)", ["M.Info.A.TAIS"], 1],
+            ["Total A", ["M.Info.A"], 1],
+            ["Total amount of exports for storage", ["M.Info.B.TAES"], 1],
+            ["Total amount of CO2 injected at storage sites", ["M.Info.B.TAI"], 1],
+            ["CO2 injected for operational usage (8)", ["M.Info.B.IOU"], 1],
+            [
+                "Total leakage from transport, injection and storage",
+                ["M.Info.B.TLTIS"],
+                1,
+            ],
+            ["Total B", ["M.Info.B"], 1],
+            ["Difference (A-B)(6)", ["\\IGNORE"], 1],
+        ],
+        "entity_mapping": {
+            "EMISSIONS CO2 (2)": "CO2",
+        },
+        "coords_defaults": {
+            "class": "Total",
+        },
+    },  # tested
+    "Table1.D": {
+        "status": "TODO",
+        "table": {
+            "firstrow": 7,
+            "lastrow": 24,
+            "header": ["group", "entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category", "class"],
+            "cols_to_ignore": [],
+            "stop_cats": ["", np.nan],
+            "unit_info": unit_info["default"],
+        },
+        "sector_mapping": [],
+        "entity_mapping": [],
+        "coords_defaults": {
+            "class": "Total",
+        },
+    },  # TODO
+    "Table2(I)": {
+        "status": "tested",
+        "table": {
+            "firstrow": 8,
+            "lastrow": 58,
+            "header": ["entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category"],
+            "cols_to_ignore": [],
+            "stop_cats": ["", np.nan],
+            "unit_info": unit_info["industry"],
+        },
+        "sector_mapping": [
+            ["2. Total industrial processes", ["2"]],
+            ["2.A. Mineral industry", ["2.A"]],
+            ["2.A.1. Cement production", ["2.A.1"]],
+            ["2.A.2. Lime production", ["2.A.2"]],
+            ["2.A.3. Glass production", ["2.A.3"]],
+            ["2.A.4. Other process uses of carbonates", ["2.A.4"]],
+            ["2.B. Chemical industry", ["2.B"]],
+            ["2.B.1. Ammonia production", ["2.B.1"]],
+            ["2.B.2. Nitric acid production", ["2.B.2"]],
+            ["2.B.3. Adipic acid production", ["2.B.3"]],
+            ["2.B.4. Caprolactam, glyoxal and glyoxylic acid production", ["2.B.4"]],
+            ["2.B.5. Carbide production", ["2.B.5"]],
+            ["2.B.6. Titanium dioxide production", ["2.B.6"]],
+            ["2.B.7. Soda ash production", ["2.B.7"]],
+            ["2.B.8. Petrochemical and carbon black production", ["2.B.8"]],
+            ["2.B.9. Fluorochemical production", ["2.B.9"]],
+            ["2.B.10. Other", ["2.B.10"]],
+            ["2.C. Metal industry", ["2.C"]],
+            ["2.C.1. Iron and steel production", ["2.C.1"]],
+            ["2.C.2. Ferroalloys production", ["2.C.2"]],
+            ["2.C.3. Aluminium production", ["2.C.3"]],
+            ["2.C.4. Magnesium production", ["2.C.4"]],
+            ["2.C.5. Lead production", ["2.C.5"]],
+            ["2.C.6. Zinc production", ["2.C.6"]],
+            ["2.C.7. Other", ["2.C.7"]],
+            ["2.D. Non-energy products from fuels and solvent use (4)", ["2.D"]],
+            ["2.D.1. Lubricant use", ["2.D.1"]],
+            ["2.D.2. Paraffin wax use", ["2.D.2"]],
+            ["2.D.3. Other", ["2.D.3"]],
+            ["2.E. Electronics industry", ["2.E"]],
+            ["2.E.1. Integrated circuit or semiconductor", ["2.E.1"]],
+            ["2.E.2. TFT flat panel display", ["2.E.2"]],
+            ["2.E.3. Photovoltaics", ["2.E.3"]],
+            ["2.E.4. Heat transfer fluid", ["2.E.4"]],
+            ["2.E.5. Other", ["2.E.5"]],
+            ["2.F. Product uses as substitutes for ODS", ["2.F"]],
+            ["2.F.1. Refrigeration and air conditioning", ["2.F.1"]],
+            ["2.F.2. Foam blowing agents", ["2.F.2"]],
+            ["2.F.3. Fire protection", ["2.F.3"]],
+            ["2.F.4. Aerosols", ["2.F.4"]],
+            ["2.F.5. Solvents", ["2.F.5"]],
+            ["2.F.6. Other applications", ["2.F.6"]],
+            ["2.G. Other product manufacture and use", ["2.G"]],
+            ["2.G.1. Electrical equipment", ["2.G.1"]],
+            ["2.G.2. SF6 and PFCs from other product use", ["2.G.2"]],
+            ["2.G.3. N2O from product uses", ["2.G.3"]],
+            ["2.G.4. Other", ["2.G.4"]],
+            ["2.H. Other (please specify) (5)", ["2.H"]],
+            ["2.H.2. Food and Beverages Industry", ["2.H.2"]],
+        ],
+        "entity_mapping": {
+            "HFCs (1)": f"HFCS ({gwp_to_use})",
+            "PFCs (1)": f"PFCS ({gwp_to_use})",
+            "Unspecified mix of HFCs and PFCs (1)": f"UnspMixOfHFCsPFCs ({gwp_to_use})",
+            "Total GHG emissions (2)": f"KYOTOGHG ({gwp_to_use})",
+        },
+        "coords_defaults": {
+            "class": "Total",
+        },
+    },  # tested
+    "Table2(II)": {
+        "status": "tested",
+        "table": {
+            "firstrow": 8,
+            "lastrow": 37,  # ignore the totals
+            "header": ["entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category"],
+            "cols_to_ignore": [],
+            "stop_cats": [".", np.nan],
+            "unit_info": unit_info["fgases"],
+        },
+        "sector_mapping": [
+            [
+                "2. Total actual emissions of halocarbons (by chemical), SF6 and NF3",
+                ["2"],
+            ],
+            ["2.B. Chemical industry", ["2.B"]],
+            ["2.B.9. Fluorochemical production", ["2.B.9"]],
+            ["2.B.9.a. By-product emissions", ["2.B.9.a"]],
+            ["2.B.9.b. Fugitive emissions", ["2.B.9.b"]],
+            ["2.B.10. Other", ["2.B.10"]],
+            ["2.C. Metal industry", ["2.C"]],
+            ["2.C.3. Aluminium production", ["2.C.3"]],
+            ["2.C.4. Magnesium production", ["2.C.4"]],
+            ["2.C.7. Other", ["2.C.7"]],
+            ["2.E. Electronics industry", ["2.E"]],
+            ["2.E.1. Integrated circuit or semiconductor", ["2.E.1"]],
+            ["2.E.2. TFT flat panel display", ["2.E.2"]],
+            ["2.E.3. Photovoltaics", ["2.E.3"]],
+            ["2.E.4. Heat transfer fluid", ["2.E.4"]],
+            ["2.E.5. Other", ["2.E.5"]],
+            ["2.F. Product uses as substitutes for ODS", ["2.F"]],
+            ["2.F.1. Refrigeration and air conditioning", ["2.F.1"]],
+            ["2.F.2. Foam blowing agents", ["2.F.2"]],
+            ["2.F.3. Fire protection", ["2.F.3"]],
+            ["2.F.4. Aerosols", ["2.F.4"]],
+            ["2.F.5. Solvents", ["2.F.5"]],
+            ["2.F.6. Other applications", ["2.F.6"]],
+            ["2.G. Other product manufacture and use", ["2.G"]],
+            ["2.G.1. Electrical equipment", ["2.G.1"]],
+            ["2.G.2. SF6 and PFCs from other product use", ["2.G.2"]],
+            ["2.G.4. Other", ["2.G.4"]],
+            ["2.H. Other", ["2.H"]],
+            ["2.H.1 Pulp and paper", ["2.H.1"]],
+            ["2.H.2 Food and beverages industry", ["2.H.2"]],
+            ["2.H.3 Other (please specify)", ["2.H.3"]],
+        ],
+        "entity_mapping": {
+            #'C3F8': 'C3F8',
+            #'C10F18' 'C2F6' 'C4F10' 'C5F12' 'C6F14' 'CF4'
+            "HFC-125": "HFC125",
+            "HFC-134": "HFC134",
+            "HFC-134a": "HFC134a",
+            "HFC-143": "HFC143",
+            "HFC-143a": "HFC143a",
+            "HFC-152": "HFC152",
+            "HFC-152a": "HFC152a",
+            "HFC-161": "HFC161",
+            "HFC-227ea": "HFC227ea",
+            "HFC-23": "HFC23",
+            "HFC-236cb": "HFC236cb",
+            "HFC-236ea": "HFC236ea",
+            "HFC-236fa": "HFC236fa",
+            "HFC-245ca": "HFC245ca",
+            "HFC-245fa": "HFC245fa",
+            "HFC-32": "HFC32",
+            "HFC-365mfc": "HFC365mfc",
+            "HFC-41": "HFC41",
+            "HFC-43-10mee": "HFC4310mee",
+            "Unspecified mix of HFCs (1)": f"UnspMixOfHFCs ({gwp_to_use})",
+            "Unspecified mix of HFCs and PFCs(1)": f"UnspMixOfHFCsPFCs ({gwp_to_use})",
+            "Unspecified mix of PFCs (1)": f"UnspMixOfPFCs ({gwp_to_use})",
+            "c-C3F6": "cC3F6",
+            "c-C4F8": "cC4F8",
+        },
+        "coords_defaults": {
+            "class": "Total",
+        },
+    },  # tested
+    "Table3": {  # Agriculture summary
+        "status": "tested",
+        "table": {
+            "firstrow": 8,
+            "lastrow": 48,
+            "header": ["entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND",
+            "categories": ["category"],
+            "cols_to_ignore": [],
+            "stop_cats": ["", np.nan],
+            "unit_info": unit_info["industry"],
+        },
+        "sector_mapping": [
+            ["3. Total agriculture", ["3"], 0],
+            # A. Enteric fermentation
+            ["3.A. Enteric fermentation", ["3.A"], 1],
+            ["3.A.1. Cattle(3)", ["3.A.1"], 2],
+            ["Option A:", ["\\IGNORE"], 3],
+            ["3.A.1.a. Dairy cattle", ["3.A.1.Aa"], 4],
+            ["3.A.1.b. Non-dairy cattle", ["3.A.1.Ab"], 4],
+            ["Option B (country-specific):", ["\\IGNORE"], 3],
+            ["3.A.1.a. Other", ["3.A.1.C"], 4],
+            # Other livestock
+            ["3.A.2. Sheep", ["3.A.2"], 2],
+            ["3.A.3. Swine", ["3.A.3"], 2],
+            ["3.A.4. Other livestock", ["3.A.4"], 2],
+            # Manure Management
+            ["3.B. Manure management", ["3.B"], 1],
+            ["3.B.1. Cattle(3)", ["3.B.1"], 2],
+            ["Option A:", ["\\IGNORE"], 3],
+            ["3.B.1.a. Dairy cattle", ["3.B.1.Aa"], 4],
+            ["3.B.1.b. Non-dairy cattle", ["3.B.1.Ab"], 4],
+            ["Option B (country-specific):", ["\\IGNORE"], 3],
+            ["3.B.1.a. Other", ["3.B.1.C"], 4],
+            ["3.B.2. Sheep", ["3.B.2"], 2],
+            ["3.B.3. Swine", ["3.B.3"], 2],
+            ["3.B.4. Other livestock", ["3.B.4"], 2],
+            ["3.B.5. Indirect N2O emissions", ["3.B.5"], 2],
+            ["3.C. Rice cultivation", ["3.C"], 1],
+            ["3.D. Agricultural soils(4,5)", ["3.D"], 1],
+            ["3.D.1. Direct N2O emissions from managed soils", ["3.D.a"], 2],
+            ["3.D.1.a. Inorganic N fertilizers", ["3.D.a.1"], 3],
+            ["3.D.1.b. Organic N fertilizers", ["3.D.a.2"], 3],
+            ["3.D.1.c. Urine and dung deposited by grazing animals", ["3.D.a.3"], 3],
+            ["3.D.1.d. Crop residues", ["3.D.a.4"], 3],
+            [
+                "3.D.1.e. Mineralization/immobilization associated with loss/gain of "
+                "soil organic matter",
+                ["3.D.a.5"],
+                3,
+            ],
+            ["3.D.1.f. Cultivation of organic soils (i.e. histosols)", ["3.D.a.6"], 3],
+            ["3.D.1.g. Other", ["3.D.a.7"], 3],
+            ["3.D.2. Indirect N2O Emissions from managed soils", ["3.D.b"], 2],
+            ["3.E. Prescribed burning of savannahs", ["3.E"], 1],
+            ["3.F. Field burning of agricultural residues", ["3.F"], 1],
+            ["3.G. Liming", ["3.G"], 1],
+            ["3.H. Urea application", ["3.H"], 1],
+            ["3.I. Other carbon-containing fertilizers", ["3.I"], 1],
+            ["3.J. Other (please specify)", ["3.J"], 1],
+            ["NA", ["\\IGNORE"], 2],
+        ],
+        "entity_mapping": {"Total GHG emissions (1)": f"KYOTOGHG ({gwp_to_use})"},
+        "coords_defaults": {
+            "class": "Total",
+        },
+    },  # tested
+    "Table3.A": {  # Enteric fermentation
+        "status": "tested",
+        "table": {
+            "firstrow": 7,
+            "lastrow": 45,
+            "header": ["entity", "entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category"],
+            "cols_to_ignore": [
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Population size (1)",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Average gross energy intake (GE)",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Average CH4 conversion rate (Ym) (2)",
+                "IMPLIED EMISSION FACTORS CH4",
+            ],
+            "stop_cats": ["", np.nan],
+            "unit_info": unit_info["default"],
+        },
+        "sector_mapping": [
+            ["3.A.1. Cattle", ["3.A.1"], 0],
+            ["Option A:", ["\\IGNORE"], 1],
+            ["3.A.1.a. Dairy cattle", ["3.A.1.Aa"], 2],
+            ["3.A.1.b. Non-dairy cattle", ["3.A.1.Ab"], 2],
+            ["Option B (country-specific): (3)", ["\\IGNORE"], 1],
+            ["3.A.1.a. Other", ["\\IGNORE"], 2],
+            ["Drop-down list:", ["\\IGNORE"], 3],
+            ["3.A.1.a.i. Mature dairy cattle", ["\\IGNORE"], 3],
+            ["3.A.1.a.ii. Other mature cattle", ["\\IGNORE"], 3],
+            ["3.A.1.a.iii. Growing cattle", ["\\IGNORE"], 3],
+            ["3.A.1.a.iv. Other (please specify)", ["3.A.1.C"], 3],
+            ["Dairy Cattle", ["3.A.1.C-AUS-a"], 4],
+            ["Beef Cattle - Pasture", ["3.A.1.C-AUS-b"], 4],
+            ["Beef Cattle - Feedlot", ["3.A.1.C-AUS-c"], 4],
+            ["3.A.2. Sheep", ["3.A.2"], 0],
+            ["3.A.2.a. Other (please specify)", ["\\IGNORE"], 1],
+            ["Sheep", ["\\IGNORE"], 2],
+            ["3.A.3. Swine", ["3.A.3"], 0],
+            ["3.A.3.a. Other (please specify)", ["\\IGNORE"], 1],
+            ["Swine", ["\\IGNORE"], 2],
+            ["3.A.4. Other livestock (4)", ["3.A.4"], 0],
+            ["Drop down list:", ["\\IGNORE"], 1],
+            ["3.A.4.a. Buffalo", ["3.A.4.a"], 2],
+            ["3.A.4.b. Camels", ["3.A.4.b"], 2],
+            ["3.A.4.c. Deer", ["3.A.4.c"], 2],
+            ["3.A.4.d. Goats", ["3.A.4.d"], 2],
+            ["3.A.4.e. Horses", ["3.A.4.e"], 2],
+            ["3.A.4.f. Mules and asses", ["3.A.4.f"], 2],
+            ["3.A.4.g. Poultry", ["3.A.4.g"], 2],
+            ["3.A.4.h. Other", ["3.A.4.h"], 2],
+            ["3.A.4.h.i. Rabbit", ["3.A.4.h.i"], 3],
+            ["3.A.4.h.ii. Reindeer", ["3.A.4.h.ii"], 3],
+            ["3.A.4.h.iii. Ostrich", ["3.A.4.h.iii"], 3],
+            ["3.A.4.h.iv. Fur-bearing animals (5)", ["3.A.4.h.iv"], 3],
+            ["3.A.4.h.v. Other (please specify)", ["3.A.4.h.v"], 3],
+            ["Alpacas", ["\\IGNORE"], 4],
+        ],
+        "entity_mapping": {"EMISSIONS CH4": "CH4"},
+        "coords_defaults": {
+            "class": "Total",
+        },
+    },  # tested
+    "Table3.B(a)": {  # Manure management CH4
+        "status": "tested",
+        "table": {
+            "firstrow": 6,
+            "lastrow": 45,
+            "header": ["entity", "entity", "entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category"],
+            "cols_to_ignore": [
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Population size",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Allocation by climate region (1) Cool",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Allocation by climate region (1) Temperate",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Allocation by climate region (1) Warm",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Typical animal mass (average) Warm",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION VS(2) daily excretion (average) Warm",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION CH4 producing potential (Bo) (2) (average) Warm",
+                "IMPLIED EMISSION FACTORS CH4 producing potential (Bo) (2) (average) CH4",
+            ],
+            "stop_cats": ["", np.nan],
+            "unit_info": unit_info["default"],
+        },
+        "sector_mapping": [
+            ["3.B.1. Cattle", ["3.B.1"], 0],
+            ["Option A:", ["\\IGNORE"], 1],
+            ["3.B.1.a. Dairy cattle", ["3.B.1.Aa"], 2],
+            ["3.B.1.b. Non-dairy cattle", ["3.B.1.Ab"], 2],
+            ["Option B (country-specific): (3)", ["\\IGNORE"], 1],
+            ["3.B.1.a. Other", ["\\IGNORE"], 2],
+            ["Drop down list:", ["\\IGNORE"], 3],
+            ["3.B.1.a.i. Mature dairy cattle", ["\\IGNORE"], 3],
+            ["3.B.1.a.ii. Other mature cattle", ["\\IGNORE"], 3],
+            ["3.B.1.a.iii. Growing cattle", ["\\IGNORE"], 3],
+            ["3.B.1.a.iv. Other (please specify)", ["3.B.1.C"], 3],
+            ["Dairy Cattle", ["3.B.1.C-AUS-a"], 4],
+            ["Beef Cattle - Pasture", ["3.B.1.C-AUS-b"], 4],
+            ["Beef Cattle - Feedlot", ["3.B.1.C-AUS-c"], 4],
+            ["3.B.2. Sheep", ["3.B.2"], 0],
+            ["3.B.2.a. Other (please specify)", ["\\IGNORE"], 1],
+            ["Sheep", ["\\IGNORE"], 2],
+            ["3.B.3. Swine", ["3.B.3"], 0],
+            ["3.B.3.a. Other (please specify)", ["\\IGNORE"], 1],
+            ["Swine", ["\\IGNORE"], 2],
+            ["3.B.4. Other livestock (4)", ["3.B.4"], 0],
+            ["Drop-down list:", ["\\IGNORE"], 1],
+            ["3.B.4.a. Buffalo", ["3.B.4.a"], 2],
+            ["3.B.4.b. Camels", ["3.B.4.b"], 2],
+            ["3.B.4.c. Deer", ["3.B.4.c"], 2],
+            ["3.B.4.d. Goats", ["3.B.4.d"], 2],
+            ["3.B.4.e. Horses", ["3.B.4.e"], 2],
+            ["3.B.4.f. Mules and Asses", ["3.B.4.f"], 2],
+            ["3.B.4.g. Poultry", ["3.B.4.g"], 2],
+            ["3.B.4.h. Other", ["3.B.4.h"], 2],
+            ["Drop-down list:", ["\\IGNORE"], 3],
+            ["3.B.4.h.i. Rabbit", ["3.B.4.h.i"], 3],
+            ["3.B.4.h.ii. Reindeer", ["3.B.4.h.ii"], 3],
+            ["3.B.4.h.iii. Ostrich", ["3.B.4.h.iii"], 3],
+            ["3.B.4.h.iv. Fur-bearing animals (5)", ["3.B.4.h.iv"], 3],
+            ["3.B.4.h.v. Other (please specify)", ["3.B.4.h.v"], 3],
+            ["Alpacas", ["\\IGNORE"], 4],
+        ],
+        "entity_mapping": {
+            "EMISSIONS CH4 producing potential (Bo) (2) (average) CH4": "CH4"
+        },
+        "coords_defaults": {
+            "class": "Total",
+        },
+    },  # tested
+    "Table3.B(b)": {  # Manure management N2O
+        "status": "tested",
+        "table": {
+            "firstrow": 5,
+            "lastrow": 46,  # don't read indirect emissions as we have them from
+            # Table3 and reading them makes the specification very complicated
+            "header": ["entity", "entity", "entity", "entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category"],
+            "cols_to_ignore": [
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Population size (1000s)",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Nitrogen excretion rate "
+                "(kg N/ head/yr)",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Typical animal mass "
+                "(average) (kg/ head)",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Nitrogen excretion per "
+                "manure management system (MMS) (kg N/yr) Anaerobic lagoon",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Nitrogen excretion per "
+                "manure management system (MMS) (kg N/yr) Liquid system",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Nitrogen excretion per "
+                "manure management system (MMS) (kg N/yr) Daily spread",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Nitrogen excretion per "
+                "manure management system (MMS) (kg N/yr) Solid storage",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Nitrogen excretion per "
+                "manure management system (MMS) (kg N/yr) Pit storage",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Nitrogen excretion per "
+                "manure management system (MMS) (kg N/yr) Dry lot",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Nitrogen excretion per "
+                "manure management system (MMS) (kg N/yr) Deep bedding",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Nitrogen excretion per "
+                "manure management system (MMS) (kg N/yr) Pasture range and paddock (1)",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Nitrogen excretion per "
+                "manure management system (MMS) (kg N/yr) Composting",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Nitrogen excretion per "
+                "manure management system (MMS) (kg N/yr) Digesters",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Nitrogen excretion per "
+                "manure management system (MMS) (kg N/yr) Burned for fuel or as waste (2)",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Nitrogen excretion per "
+                "manure management system (MMS) (kg N/yr) Other (3)",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Total N excreted Other (3)",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Total N volatilised as "
+                "NH3, NOX and N2 (4)",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION N lost through leaching "
+                "and run-off",
+                "IMPLIED EMISSION FACTORS Emission factor per animals Direct and run-off",
+                "IMPLIED EMISSION FACTORS Emission factor per animals Indirect "
+                "Atmospheric deposition",
+                "IMPLIED EMISSION FACTORS Emission factor per animals Indirect "
+                "Nitrogen leaching and run-off",
+                "EMISSIONS N2O Indirect Atmospheric deposition",
+                "EMISSIONS N2O Indirect Nitrogen leaching and run-off",
+            ],
+            "stop_cats": ["", np.nan, "3.B.5. Indirect N2O emissions"],
+            "unit_info": unit_info["default"],
+        },
+        "sector_mapping": [
+            ["3.B.1. Cattle", ["3.B.1"], 0],
+            ["Option A:", ["\\IGNORE"], 1],
+            ["3.B.1.a. Dairy cattle", ["3.B.1.Aa"], 2],
+            ["3.B.1.b. Non-dairy cattle", ["3.B.1.Ab"], 2],
+            ["Option B (country-specific): (5)", ["\\IGNORE"], 1],
+            ["3.B.1.a. Other", ["\\IGNORE"], 2],
+            ["Drop-down list", ["\\IGNORE"], 3],
+            ["3.B.1.a.i. Mature dairy cattle", ["\\IGNORE"], 3],
+            ["3.B.1.a.ii. Other mature cattle", ["\\IGNORE"], 3],
+            ["3.B.1.a.iii. Growing cattle", ["\\IGNORE"], 3],
+            ["3.B.1.a.iv. Other (please specify)", ["3.B.1.C"], 3],
+            ["Dairy Cattle", ["3.B.1.C-AUS-a"], 4],
+            ["Beef Cattle - Pasture", ["3.B.1.C-AUS-b"], 4],
+            ["Beef Cattle - Feedlot", ["3.B.1.C-AUS-c"], 4],
+            ["3.B.2. Sheep", ["3.B.2"], 0],
+            ["3.B.2.a. Other (please specify)", ["\\IGNORE"], 1],
+            ["Sheep", ["\\IGNORE"], 2],
+            ["3.B.3. Swine", ["3.B.3"], 0],
+            ["3.B.3.a. Other (please specify)", ["\\IGNORE"], 1],
+            ["Swine", ["\\IGNORE"], 2],
+            ["3.B.4. Other livestock (6)", ["3.B.4"], 0],
+            ["Drop-down list", ["\\IGNORE"], 1],
+            ["3.B.4.a. Buffalo", ["3.B.4.a"], 2],
+            ["3.B.4.b. Camels", ["3.B.4.b"], 2],
+            ["3.B.4.c. Deer", ["3.B.4.c"], 2],
+            ["3.B.4.d. Goats", ["3.B.4.d"], 2],
+            ["3.B.4.e. Horses", ["3.B.4.e"], 2],
+            ["3.B.4.f. Mules and asses", ["3.B.4.f"], 2],
+            ["3.B.4.g. Poultry", ["3.B.4.g"], 2],
+            ["3.B.4.h. Other", ["3.B.4.h"], 2],
+            ["Drop-down list:", ["\\IGNORE"], 3],
+            ["3.B.4.h.i. Rabbit", ["3.B.4.h.i"], 3],
+            ["3.B.4.h.ii. Reindeer", ["3.B.4.h.ii"], 3],
+            ["3.B.4.h.iii. Ostrich", ["3.B.4.h.iii"], 3],
+            ["3.B.4.h.iv Fur-bearing animals (7)", ["3.B.4.h.iv"], 3],
+            ["3.B.4.h.v. Other (please specify)", ["3.B.4.h.v"], 3],
+            ["Alpacas", ["\\IGNORE"], 4],
+        ],
+        "entity_mapping": {
+            "EMISSIONS N2O Direct Nitrogen leaching and run-off": "N2O",
+        },
+        "coords_defaults": {
+            "class": "Total",
+        },
+    },  # tested
+    # TODO: tables 3.A and 3.B for livestock details as they are not contained in table3
+    "Table3.C": {  # rice cultivation details
+        "status": "tested",
+        "table": {
+            "firstrow": 7,
+            "lastrow": 25,
+            "header": ["group", "entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category"],
+            "cols_to_ignore": [
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Harvested area (2)",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Organic amendments added (3)",
+                "IMPLIED EMISSION FACTOR (1) CH4",
+            ],
+            "stop_cats": ["", np.nan],
+            "unit_info": unit_info["default"],
+        },
+        "sector_mapping": [
+            ["3.C.1. Irrigated", ["3.C.1"]],
+            ["3.C.1.a. Continuously flooded", ["3.C.1.a"]],
+            ["3.C.1.b. Intermittently flooded", ["3.C.1.b"]],
+            ["3.C.1.b.i. Single aeration", ["3.C.1.b.i"]],
+            ["3.C.1.b.ii.Multiple aeration", ["3.C.1.b.ii"]],
+            ["3.C.2. Rain-fed", ["3.C.2"]],
+            ["3.C.2.a. Flood-prone", ["3.C.2.a"]],
+            ["3.C.2.b. Drought-prone", ["3.C.2.b"]],
+            ["3.C.3. Deep water", ["3.C.3"]],
+            ["3.C.3.a. Water depth 50–100 cm", ["3.C.3.a"]],  # noqa: RUF001
+            ["3.C.3.b. Water depth > 100 cm", ["3.C.3.b"]],
+            ["3.C.4. Other (please specify)", ["3.C.4"]],
+            ["NA", ["\\IGNORE"]],
+            ["Upland rice(4)", ["\\IGNORE"]],
+            ["Total(4)", ["\\IGNORE"]],
+        ],
+        "entity_mapping": {
+            "EMISSIONS CH4": "CH4",
+        },
+        "coords_defaults": {
+            "class": "Total",
+        },
+    },  # tested
+    "Table3.D": {  # direct and indirect N2O from soils
+        "status": "tested",
+        "table": {
+            "firstrow": 7,
+            "lastrow": 23,
+            "header": ["group", "entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category"],
+            "cols_to_ignore": [
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Description",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Value",
+                "IMPLIED EMISSION FACTORS Value",
+                # "Fraction (a) FracGASF",
+                # "Description Fraction of synthetic fertilizer N applied to soils that "
+                # "volatilises as NH3 and NOX",
+                # "Value 0.11",
+            ],
+            "stop_cats": ["", np.nan],
+            "unit_info": unit_info["default"],
+        },
+        "sector_mapping": [
+            ["3.D.1. Direct N2O emissions from managed soils", ["3.D.a"]],
+            ["3.D.1.a. Inorganic N fertilizers (3)", ["3.D.a.1"]],
+            ["3.D.1.b. Organic N fertilizers (3)", ["3.D.a.2"]],
+            ["3.D.1.b.i. Animal manure applied to soils", ["3.D.a.2.a"]],
+            ["3.D.1.b.ii. Sewage sludge applied to soils", ["3.D.a.2.b"]],
+            ["3.D.1.b.iii. Other organic fertilizers applied to soils", ["3.D.a.2.c"]],
+            ["3.D.1.c. Urine and dung deposited by grazing animals", ["3.D.a.3"]],
+            ["3.D.1.d. Crop residues", ["3.D.a.4"]],
+            [
+                "3.D.1.e. Mineralization/immobilization associated with loss/gain of "
+                "soil organic matter (4,5)",
+                ["3.D.a.5"],
+            ],
+            ["3.D.1.f. Cultivation of organic soils (i.e. histosols) (2)", ["3.D.a.6"]],
+            ["3.D.1.g. Other", ["3.D.a.7"]],
+            ["3.D.2. Indirect N2O Emissions from managed soils", ["3.D.b"]],
+            ["3.D.2.a. Atmospheric deposition (6)", ["3.D.b.1"]],
+            ["3.D.2.b. Nitrogen leaching and run-off", ["3.D.b.2"]],
+        ],
+        "entity_mapping": {
+            "EMISSIONS N2O": "N2O",
+        },
+        "coords_defaults": {
+            "class": "Total",
+        },
+    },  # tested
+    "Table3.E": {  # savanna burning details
+        "status": "TODO",  # actually done but empty and crashes
+        "table": {
+            "firstrow": 7,
+            "lastrow": 13,
+            "header": ["group", "entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category"],
+            "cols_to_ignore": [
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Area of savannah burned",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Average above-ground biomass density",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Biomass burned",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Fraction of savannah "
+                "burned",
+                "ACTIVITY DATA AND OTHER RELATED INFORMATION Nitrogen fraction in biomass",
+                "IMPLIED EMISSION FACTORS CH4",
+                "IMPLIED EMISSION FACTORS N2O",
+            ],
+            "stop_cats": ["", ".", np.nan],
+            "unit_info": unit_info["default"],
+        },
+        "sector_mapping": [
+            ["3.E.1. Forest land (specify ecological zone) (2)", ["3.E.1"], 0],
+            ["NA", ["\\IGNORE"], 1],
+            ["3.E.2. Grassland (specify ecological zone) (2)", ["3.E.2"], 0],
+            ["NA", ["\\IGNORE"], 1],
+        ],
+        "entity_mapping": {
+            "EMISSIONS (2) CH4": "CH4",
+            "EMISSIONS (2) N2O": "N2O",
+        },
+        "coords_defaults": {
+            "class": "Total",
+        },
+    },  # TODO
+    "Table3.F": {  # field burning details
+        "status": "TODO",
+        "table": {
+            "firstrow": 7,
+            "lastrow": 29,
+            "header": ["group", "entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category"],
+            "cols_to_ignore": [],
+            "stop_cats": ["", np.nan],
+            "unit_info": unit_info["default"],
+        },
+        "sector_mapping": [],
+        "entity_mapping": [],
+        "coords_defaults": {
+            "class": "Total",
+        },
+    },  # TODO
+    "Table3.G-I": {  # liming, urea, carbon containing fertilizer
+        "status": "TODO",
+        "table": {
+            "firstrow": 5,
+            "lastrow": 13,
+            "header": ["group", "entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category"],
+            "cols_to_ignore": [],
+            "stop_cats": ["", np.nan],
+            "unit_info": unit_info["default"],
+        },
+        "sector_mapping": [],
+        "entity_mapping": [],
+        "coords_defaults": {
+            "class": "Total",
+        },
+    },  # TODO
+    "Table4": {  # LULUCF overview
+        "status": "tested",
+        "table": {
+            "firstrow": 8,
+            "lastrow": 33,
+            "header": ["entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category"],
+            "cols_to_ignore": [],
+            "stop_cats": ["", ".", np.nan],
+            "unit_info": unit_info["industry"],
+        },
+        "sector_mapping": [
+            ["4. Total LULUCF", ["4"]],
+            ["4.A. Forest land", ["4.A"]],
+            ["4.A.1. Forest land remaining forest land", ["4.A.1"]],
+            ["4.A.2. Land converted to forest land", ["4.A.2"]],
+            ["4.B. Cropland", ["4.B"]],
+            ["4.B.1. Cropland remaining cropland", ["4.B.1"]],
+            ["4.B.2. Land converted to cropland", ["4.B.2"]],
+            ["4.C. Grassland", ["4.C"]],
+            ["4.C.1. Grassland remaining grassland", ["4.C.1"]],
+            ["4.C.2. Land converted to grassland", ["4.C.2"]],
+            ["4.D. Wetlands (5)", ["4.D"]],
+            ["4.D.1. Wetlands remaining wetlands", ["4.D.1"]],
+            ["4.D.2. Land converted to wetlands", ["4.D.2"]],
+            ["4.E. Settlements", ["4.E"]],
+            ["4.E.1. Settlements remaining settlements", ["4.E.1"]],
+            ["4.E.2. Land converted to settlements", ["4.E.2"]],
+            ["4.F. Other land (6)", ["4.F"]],
+            ["4.F.1. Other land remaining other land", ["4.F.1"]],
+            ["4.F.2. Land converted to other land", ["4.F.2"]],
+            ["4.G. Harvested wood products (7)", ["4.G"]],
+            ["4.H. Other (please specify)", ["4.H"]],
+            ["Land converted to Settlement", ["4.H.1"]],
+            ["Aquaculture", ["4.H.10"]],
+            ["Seagrass", ["4.H.11"]],
+            # currently ignoring memo item
+        ],
+        "entity_mapping": {
+            "CH4(2)": "CH4",
+            "N2O(2)": "N2O",
+            "Net CO2 emissions/removals (1,2)": "CO2",
+            "Total GHG emissions/removals (3)": f"KYOTOGHG ({gwp_to_use})",
+        },
+        "coords_defaults": {
+            "class": "Total",
+        },
+    },  # tested
+    # TODO: all other LULUCF tables
+    "Table5": {  # Waste overview
+        "status": "tested",
+        "table": {
+            "firstrow": 8,
+            "lastrow": 30,
+            "header": ["entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category"],
+            "cols_to_ignore": [],
+            "stop_cats": ["", np.nan],
+            "unit_info": unit_info["industry"],
+        },
+        "sector_mapping": [
+            ["5. Total waste", ["5"]],
+            ["5.A. Solid waste disposal", ["5.A"]],
+            ["5.A.1. Managed waste disposal sites", ["5.A.1"]],
+            ["5.A.2. Unmanaged waste disposal sites", ["5.A.2"]],
+            ["5.A.3. Uncategorized waste disposal sites", ["5.A.3"]],
+            ["5.B. Biological treatment of solid waste", ["5.B"]],
+            ["5.B.1. Composting", ["5.B.1"]],
+            ["5.B.2. Anaerobic digestion at biogas facilities", ["5.B.2"]],
+            ["5.C. Incineration and open burning of waste", ["5.C"]],
+            ["5.C.1. Waste incineration", ["5.C.1"]],
+            ["5.C.2. Open burning of waste", ["5.C.2"]],
+            ["5.D. Wastewater treatment and discharge", ["5.D"]],
+            ["5.D.1. Domestic wastewater", ["5.D.1"]],
+            ["5.D.2. Industrial wastewater", ["5.D.2"]],
+            ["5.D.3. Other", ["5.D.3"]],
+            ["5.E. Other (please specify)", ["5.E"]],
+            ["Accidential fires at Solid Waste Disposal Sites", ["5.E.9"]],
+            ["Memo item: (3)", ["\\IGNORE"]],
+            ["5.F.1. Long-term storage of C in waste disposal sites", ["M.Memo.LTSW"]],
+            ["5.F.2. Annual change in total long-term C storage", ["M.Memo.ACLT"]],
+            [
+                "5.F.3. Annual change in total long-term C storage in HWP waste (4)",
+                ["M.Memo.ACLTHWP"],
+            ],
+        ],
+        "entity_mapping": {
+            "CO2(1)": "CO2",
+            "Total GHG emissions (1)": f"KYOTOGHG ({gwp_to_use})",
+        },
+        "coords_defaults": {
+            "class": "Total",
+        },
+    },  # tested
+    # TODO 5.A-D
+    "Summary1": {  # Summary 1
+        "status": "tested",
+        "table": {
+            "firstrow": 8,
+            "lastrow": 70,
+            "header": ["entity", "unit"],
+            "col_for_categories": "GREENHOUSE GAS SOURCE AND SINK CATEGORIES",
+            "categories": ["category"],
+            "cols_to_ignore": [],
+            "stop_cats": [],  # "", np.nan],
+            "unit_info": unit_info["summary"],
+        },
+        "sector_mapping": [
+            ["Total national emissions and removals", ["0"]],
+            ["1. Energy", ["1"]],
+            ["1.A. Fuel combustion", ["1.A"]],
+            ["1.A.1. Energy industries", ["1.A.1"]],
+            ["1.A.2. Manufacturing industries and construction", ["1.A.2"]],
+            ["1.A.3. Transport", ["1.A.3"]],
+            ["1.A.4. Other sectors", ["1.A.4"]],
+            ["1.A.5. Other", ["1.A.5"]],
+            ["1.B. Fugitive emissions from fuels", ["1.B"]],
+            ["1.B.1. Solid fuels", ["1.B.1"]],
+            [
+                "1.B.2. Oil and natural gas and other emissions from energy production",
+                ["1.B.2"],
+            ],
+            ["1.C. CO2 Transport and storage", ["1.C"]],
+            ["2. Industrial processes and product use", ["2"]],
+            ["2.A. Mineral industry", ["2.A"]],
+            ["2.B. Chemical industry", ["2.B"]],
+            ["2.C. Metal industry", ["2.C"]],
+            ["2.D. Non-energy products from fuels and solvent use", ["2.D"]],
+            ["2.E. Electronic industry", ["2.E"]],
+            ["2.F. Product uses as substitutes for ODS", ["2.F"]],
+            ["2.G. Other product manufacture and use", ["2.G"]],
+            ["2.H. Other (4)", ["2.H"]],
+            ["3. Agriculture", ["3"]],
+            ["3.A. Enteric fermentation", ["3.A"]],
+            ["3.B. Manure management", ["3.B"]],
+            ["3.C. Rice cultivation", ["3.C"]],
+            ["3.D. Agricultural soils", ["3.D"]],
+            ["3.E. Prescribed burning of savannahs", ["3.E"]],
+            ["3.F. Field burning of agricultural residues", ["3.F"]],
+            ["3.G. Liming", ["3.G"]],
+            ["3.H. Urea application", ["3.H"]],
+            ["3.I. Other carbon-containing fertilizers", ["3.I"]],
+            ["3.J. Other", ["3.J"]],
+            ["4. Land use, land-use change and forestry (5)", ["4"]],
+            ["4.A. Forest land (5)", ["4.A"]],
+            ["4.B. Cropland (5)", ["4.B"]],
+            ["4.C. Grassland (5)", ["4.C"]],
+            ["4.D. Wetlands (5)", ["4.D"]],
+            ["4.E. Settlements (5)", ["4.E"]],
+            ["4.F. Other land (5)", ["4.F"]],
+            ["4.G. Harvested wood products (5)", ["4.G"]],
+            ["4.H. Other (5)", ["4.H"]],
+            ["5. Waste", ["5"]],
+            ["5.A. Solid waste disposal (6)", ["5.A"]],
+            ["5.B. Biological treatment of solid waste", ["5.B"]],
+            ["5.C. Incineration and open burning of waste (6)", ["5.C"]],
+            ["5.D. Wastewater treatment and discharge", ["5.D"]],
+            ["5.E. Other (6)", ["5.E"]],
+            ["6. Other (please specify) (7)", ["6"]],
+            ["NA", ["\\IGNORE"]],
+            ["", ["\\IGNORE"]],
+            [np.nan, ["\\IGNORE"]],
+            ["Memo items: (8)", ["\\IGNORE"]],
+            ["1.D.1. International bunkers", ["M.Memo.Int"]],
+            ["1.D.1.a. Aviation", ["M.Memo.Int.Avi"]],
+            ["1.D.1.b. Navigation", ["M.Memo.Int.Mar"]],
+            ["1.D.2. Multilateral operations", ["M.Memo.Mult"]],
+            ["1.D.3. CO2 emissions from biomass", ["M.Memo.Bio"]],
+            ["1.D.4. CO2 captured", ["M.Memo.CO2Cap"]],
+            ["5.F.1. Long-term storage of C in waste disposal sites", ["M.Memo.LTSW"]],
+            ["Indirect N2O", ["M.Memo.IndN2O"]],
+            ["Indirect CO2", ["M.Memo.IndCO2"]],
+        ],
+        "entity_mapping": {
+            "NOX": "NOx",
+            "Net CO2 emissions/ removals": "CO2",
+            "HFCs (1)": f"HFCS ({gwp_to_use})",
+            "PFCs (1)": f"PFCS ({gwp_to_use})",
+            "Unspecified mix of HFCs and PFCs (1)": f"UnspMixOfHFCsPFCs ({gwp_to_use})",
+            "Total GHG emissions/removals (2)": f"KYOTOGHG ({gwp_to_use})",
+        },
+        "coords_defaults": {
+            "class": "Total",
+        },
+    },  # tested
+}

+ 48 - 14
src/unfccc_ghg_data/unfccc_crf_reader/unfccc_crf_reader_core.py

@@ -158,6 +158,7 @@ def read_crf_table(  # noqa: PLR0913, PLR0912, PLR0915
     data_year: int | list[int] | None = None,
     date: str | None = None,
     folder: str | None = None,
+    type: str = "CRF",
     debug: bool = False,
 ) -> tuple[pd.DataFrame, list[list], list[list]]:
     """
@@ -187,6 +188,8 @@ def read_crf_table(  # noqa: PLR0913, PLR0912, PLR0915
     folder: str (optional)
         Folder that contains the xls files. If not given fodlers are determined by the
         submissions_year and country_code variables
+    type: str default = "CRF"
+        read CRF or CRF data
     debug: bool (optional)
         if true print some debug information like column headers
 
@@ -201,6 +204,10 @@ def read_crf_table(  # noqa: PLR0913, PLR0912, PLR0915
       as country submitted tables are longer than expected.
 
     """
+    # check type
+    if type not in ["CRF", "CRT"]:
+        raise ValueError("Type must be CRF or CRT")  # noqa: TRY003
+
     if isinstance(country_codes, str):
         country_codes = [country_codes]
 
@@ -211,6 +218,7 @@ def read_crf_table(  # noqa: PLR0913, PLR0912, PLR0915
         data_year=data_year,
         date=date,
         folder=folder,
+        type=type,
     )
     # nasty fix for cases where exporting ran overnight and not all files have
     # the same date
@@ -239,6 +247,7 @@ def read_crf_table(  # noqa: PLR0913, PLR0912, PLR0915
                 data_year=data_year,
                 date=prv_date,
                 folder=folder,
+                type=type,
             )
             if len(more_input_files) > 0:
                 print(f"Found {len(more_input_files)} additional input files.")
@@ -260,22 +269,22 @@ def read_crf_table(  # noqa: PLR0913, PLR0912, PLR0915
     # specification (currently only Australia, 2023)
     if len(country_codes) == 1:
         try:
-            crf_spec = getattr(crf, f"CRF{submission_year}_{country_codes[0]}")
+            crf_spec = getattr(crf, f"{type}{submission_year}_{country_codes[0]}")
             print(
                 f"Using country specific specification: "
-                f"CRF{submission_year}_{country_codes[0]}"
+                f"{type}{submission_year}_{country_codes[0]}"
             )
         except:  # noqa: E722
             # no country specific specification, check for general specification
             try:
-                crf_spec = getattr(crf, f"CRF{submission_year}")
+                crf_spec = getattr(crf, f"{type}{submission_year}")
             except:  # noqa: E722
                 raise ValueError(  # noqa: TRY003, TRY200
                     f"No terminology exists for submission year " f"{submission_year}"
                 )
     else:
         try:
-            crf_spec = getattr(crf, f"CRF{submission_year}")
+            crf_spec = getattr(crf, f"{type}{submission_year}")
         except:  # noqa: E722
             raise ValueError(  # noqa: TRY003, TRY200
                 f"No terminology exists for submission year " f"{submission_year}"
@@ -663,12 +672,13 @@ def read_crf_table_from_file(  # noqa: PLR0912, PLR0915
     return df_long, unknown_categories, info_last_row
 
 
-def get_crf_files(  # noqa: PLR0912
+def get_crf_files(  # noqa: PLR0912, PLR0913
     country_codes: Union[str, list[str]],
     submission_year: int,
     data_year: Optional[Union[int, list[int]]] = None,
     date: Optional[str] = None,
     folder: Optional[str] = None,
+    type: str = "CRF",
 ) -> list[Path]:
     """
     Find all files according to given parameters
@@ -692,10 +702,18 @@ def get_crf_files(  # noqa: PLR0912
         Folder that contains the xls files. If not given fodlers are determined by the
         submissions_year and country_code variables
 
+    type: str default = "CRF"
+        read CRF or CRF data
+
     Returns
     -------
         List[Path]: list of Path objects for the files
     """
+    if type == "CRT":
+        type_folder = "BTR"
+    else:
+        type_folder = type
+
     if isinstance(country_codes, str):
         country_codes = [country_codes]
     input_files = []
@@ -705,7 +723,7 @@ def get_crf_files(  # noqa: PLR0912
     # function can also be used on a given folder and then the filter is useful.
     if folder is None:
         data_folder = downloaded_data_path_UNFCCC
-        submission_folder = f"CRF{submission_year}"
+        submission_folder = f"{type_folder}{submission_year}"
 
         with open(data_folder / "folder_mapping.json") as mapping_file:
             folder_mapping = json.load(mapping_file)
@@ -735,7 +753,11 @@ def get_crf_files(  # noqa: PLR0912
         country_folders = [folder]
 
     file_filter_template = {}
-    file_filter_template["submission_year"] = submission_year
+    if type == "CRF":
+        file_filter_template["submission_year"] = submission_year
+    # don't filter for submission year in BTR as it's  the actual year and
+    # not the submissions round (and we don't know yet if it will be the same
+    # for all submission in one submission round)
     file_filter_template["party"] = country_codes
     if data_year is not None:
         file_filter_template["data_year"] = data_year
@@ -810,7 +832,7 @@ def get_info_from_crf_filename(
         print(f"Data year string {name_parts[2]} " "could not be converted to int.")
         file_info["data_year"] = name_parts[2]
     file_info["date"] = name_parts[3]
-    # the last part (time code) is missing for Australia since 2023
+    # the last part (time code) is missing for CRT tables
     if len(name_parts) > 4:  # noqa: PLR2004
         file_info["extra"] = name_parts[4]
     else:
@@ -825,7 +847,7 @@ def filter_filenames(
     submission_year: Optional[str] = None,
     date: Optional[str] = None,
 ) -> list[Path]:
-    """Filter a list of filenames of CRF files
+    """Filter a list of filenames of CRF/CRT files
 
     Parameters
     ----------
@@ -1075,6 +1097,7 @@ def filter_category(
 def get_latest_date_for_country(
     country_code: str,
     submission_year: int,
+    type: str = "CRF",
 ) -> str:
     """
     Find the latest submission date for a country
@@ -1083,9 +1106,10 @@ def get_latest_date_for_country(
     ----------
     country: str
         3-letter country code
-
     submission_year: int
         Year of the submission to find the l;atest date for
+    type: str, default CRF
+        Check for CRF or CRT tables
 
     Returns
     -------
@@ -1094,10 +1118,18 @@ def get_latest_date_for_country(
     with open(downloaded_data_path_UNFCCC / "folder_mapping.json") as mapping_file:
         folder_mapping = json.load(mapping_file)
 
+    if type == "CRT":
+        type_folder = "BTR"
+    else:
+        type_folder = type
     if country_code in folder_mapping:
         file_filter = {}
         file_filter["party"] = country_code
-        file_filter["submission_year"] = submission_year
+        if type == "CRF":
+            file_filter["submission_year"] = submission_year
+        # don't filter for submission year in BTR as it's  the actual year and
+        # not the submissions round (and we don't know yet if it will be the same
+        # for all submission in one submission round)
         country_folders = folder_mapping[country_code]
         if isinstance(country_folders, str):
             # only one folder
@@ -1105,7 +1137,7 @@ def get_latest_date_for_country(
                 get_submission_dates(
                     downloaded_data_path_UNFCCC
                     / country_folders
-                    / f"CRF{submission_year}",
+                    / f"{type_folder}{submission_year}",
                     file_filter,
                 )
             )
@@ -1113,7 +1145,9 @@ def get_latest_date_for_country(
             dates = []
             for folder in country_folders:
                 folder_submission = (
-                    downloaded_data_path_UNFCCC / folder / f"CRF{submission_year}"
+                    downloaded_data_path_UNFCCC
+                    / folder
+                    / f"{type_folder}{submission_year}"
                 )
                 if folder_submission.exists():
                     dates = dates + get_submission_dates(folder_submission, file_filter)
@@ -1169,7 +1203,7 @@ def get_submission_parties(
     file_filter: dict[str, Union[str, int, list]],
 ) -> list[str]:
     """
-    Return all submission dates available in a folder
+    Return all submission parties available in a folder
 
     Parameters
     ----------

+ 35 - 17
src/unfccc_ghg_data/unfccc_crf_reader/unfccc_crf_reader_devel.py

@@ -29,6 +29,7 @@ from .util import all_crf_countries
 def read_year_to_test_specs(  # noqa: PLR0912, PLR0915
     submission_year: int,
     data_year: int | None = None,
+    type: str = "CRF",
     totest: bool | None = False,
     country_code: str | None = None,
 ) -> xr.Dataset:
@@ -44,6 +45,8 @@ def read_year_to_test_specs(  # noqa: PLR0912, PLR0915
         submission year to read
     data_year
         year to read
+    type: str = CRF
+        read CRF or CRT data
     totest
         if true only read tables with "totest" status
     country_code
@@ -53,6 +56,14 @@ def read_year_to_test_specs(  # noqa: PLR0912, PLR0915
     -------
     xr.Dataset with data for given parameters
     """
+    # long name for type
+    if type == "CRF":
+        type_name = "common reporting format"
+    elif type == "CRT":
+        type_name = "common reporting tables"
+    else:
+        raise ValueError("Type must be CRF or CRT")  # noqa: TRY003
+
     if data_year is None:
         data_year = 2000
 
@@ -62,7 +73,9 @@ def read_year_to_test_specs(  # noqa: PLR0912, PLR0915
     unknown_categories = []
     last_row_info = []
     ds_all = None
-    print(f"CRF test reading for CRF{submission_year}. Using data year {data_year}")
+    print(
+        f"{type} test reading for {type}{submission_year}. Using data year {data_year}"
+    )
     if totest:
         print("Reading only tables to test.")
     print("#" * 80)
@@ -80,15 +93,15 @@ def read_year_to_test_specs(  # noqa: PLR0912, PLR0915
         # specification (currently only Australia, 2023)
         if country_code is not None:
             try:
-                crf_spec = getattr(crf, f"CRF{submission_year}_{country_code}")
+                crf_spec = getattr(crf, f"{type}{submission_year}_{country_code}")
                 print(
                     f"Using country specific specification: "
-                    f"CRF{submission_year}_{country_code}"
+                    f"{type}{submission_year}_{country_code}"
                 )
             except Exception:
                 # no country specific specification, check for general specification
                 try:
-                    crf_spec = getattr(crf, f"CRF{submission_year}")
+                    crf_spec = getattr(crf, f"{type}{submission_year}")
                 except Exception as ex:
                     raise ValueError(  # noqa: TRY003
                         f"No terminology exists for submission year "
@@ -96,10 +109,10 @@ def read_year_to_test_specs(  # noqa: PLR0912, PLR0915
                     ) from ex
         else:
             try:
-                crf_spec = getattr(crf, f"CRF{submission_year}")
+                crf_spec = getattr(crf, f"{type}{submission_year}")
             except Exception as ex:
                 raise ValueError(  # noqa: TRY003
-                    f"No terminology exists for submission year " f"{submission_year}"
+                    f"No terminology exists for {type}{submission_year}"
                 ) from ex
 
         if totest:
@@ -116,14 +129,16 @@ def read_year_to_test_specs(  # noqa: PLR0912, PLR0915
             ]
         print(
             f"The following tables are available in the "
-            f"CRF{submission_year} specification: {tables}"
+            f"{type}{submission_year} specification: {tables}"
         )
         print("#" * 80)
 
         try:
-            submission_date = get_latest_date_for_country(country_code, submission_year)
+            submission_date = get_latest_date_for_country(
+                country_code, submission_year, type=type
+            )
         except Exception:
-            print(f"No submissions for country {country_name}, CRF{submission_year}")
+            print(f"No submissions for country {country_name}, {type}{submission_year}")
             submission_date = None
 
         if submission_date is not None:
@@ -136,6 +151,7 @@ def read_year_to_test_specs(  # noqa: PLR0912, PLR0915
                     date=submission_date,
                     data_year=[data_year],
                     debug=True,
+                    type=type,
                 )
 
                 # collect messages on unknown rows etc
@@ -159,7 +175,7 @@ def read_year_to_test_specs(  # noqa: PLR0912, PLR0915
                         submission_year,
                         meta_data_input={
                             "title": f"Data submitted in {submission_year} to the "
-                            f"UNFCCC in the common reporting format (CRF) "
+                            f"UNFCCC in the {type_name} ({type}) "
                             f"by {country_name}. "
                             f"Submission date: {submission_date}"
                         },
@@ -215,13 +231,15 @@ def read_year_to_test_specs(  # noqa: PLR0912, PLR0915
         if country_code is not None:
             log_location = (
                 log_path
-                / f"CRF{submission_year}"
+                / f"{type}{submission_year}"
                 / f"{data_year}_unknown_categories_{country_code}"
                 f"_{today.strftime('%Y-%m-%d')}.csv"
             )
         else:
             log_location = (
-                log_path / f"CRF{submission_year}" / f"{data_year}_unknown_categories_"
+                log_path
+                / f"{type}{submission_year}"
+                / f"{data_year}_unknown_categories_"
                 f"{today.strftime('%Y-%m-%d')}.csv"
             )
         print(f"Unknown rows found. Savin log to {log_location}")
@@ -231,13 +249,13 @@ def read_year_to_test_specs(  # noqa: PLR0912, PLR0915
         if country_code is not None:
             log_location = (
                 log_path
-                / f"CRF{submission_year}"
+                / f"{type}{submission_year}"
                 / f"{data_year}_last_row_info_{country_code}_"
                 f"{today.strftime('%Y-%m-%d')}.csv"
             )
         else:
             log_location = (
-                log_path / f"CRF{submission_year}" / f"{data_year}_last_row_info_"
+                log_path / f"{type}{submission_year}" / f"{data_year}_last_row_info_"
                 f"{today.strftime('%Y-%m-%d')}.csv"
             )
         print(f"Data found in the last row. Saving log to " f"{log_location}")
@@ -245,13 +263,13 @@ def read_year_to_test_specs(  # noqa: PLR0912, PLR0915
 
     # save the data:
     compression = dict(zlib=True, complevel=9)
-    output_folder = log_path / f"test_read_CRF{submission_year}"
+    output_folder = log_path / f"test_read_{type}{submission_year}"
     if country_code is not None:
         output_filename = (
-            f"CRF{submission_year}_{country_code}_" f"{today.strftime('%Y-%m-%d')}"
+            f"{type}{submission_year}_{country_code}_" f"{today.strftime('%Y-%m-%d')}"
         )
     else:
-        output_filename = f"CRF{submission_year}_{today.strftime('%Y-%m-%d')}"
+        output_filename = f"{type}{submission_year}_{today.strftime('%Y-%m-%d')}"
     if totest:
         output_filename = output_filename + "_totest"
 

+ 115 - 39
src/unfccc_ghg_data/unfccc_crf_reader/unfccc_crf_reader_prod.py

@@ -36,8 +36,6 @@ from .util import NoCRFFilesError, all_crf_countries
 #    output files with missing sectors etc
 # **
 
-# TODO: add function to read several / all countries
-
 # general approach:
 # main code in a function that reads on table from one file.
 # return raw pandas DF for use in different functions
@@ -51,6 +49,7 @@ def read_crf_for_country(  # noqa: PLR0912, PLR0915
     submission_year: int,
     submission_date: Optional[str] = None,
     re_read: Optional[bool] = True,
+    type: str = "CRF",
 ) -> xr.Dataset:
     """
     Read for given submission year and country.
@@ -86,11 +85,20 @@ def read_crf_for_country(  # noqa: PLR0912, PLR0915
         If not specified latest data will be read
     re_read: Optional(bool) default: True
         Read the data also if it's already present
+    type: str default "CRF"
+        Read CRF or CRT
 
     Returns
     -------
         return value is a Pandas DataFrame with the read data in PRIMAP2 format
     """
+    # long name for type
+    if type == "CRF":
+        type_name = "common reporting format"
+    elif type == "CRT":
+        type_name = "common reporting tables"
+    else:
+        raise ValueError("Type must be CRF or CRT")  # noqa: TRY003
     # get country name
     country_name = get_country_name(country_code)
 
@@ -98,18 +106,18 @@ def read_crf_for_country(  # noqa: PLR0912, PLR0915
     # if we only have a single country check if we might have a country specific
     # specification (currently only Australia, 2023)
     try:
-        crf_spec = getattr(crf, f"CRF{submission_year}_{country_code}")
+        crf_spec = getattr(crf, f"{type}{submission_year}_{country_code}")
         print(
             f"Using country specific specification: "
-            f"CRF{submission_year}_{country_code}"
+            f"{type}{submission_year}_{country_code}"
         )
     except Exception:
         # no country specific specification, check for general specification
         try:
-            crf_spec = getattr(crf, f"CRF{submission_year}")
+            crf_spec = getattr(crf, f"{type}{submission_year}")
         except Exception as ex:
             raise ValueError(  # noqa: TRY003
-                f"No terminology exists for submission year " f"{submission_year}"
+                f"No terminology exists for submission year/round " f"{submission_year}"
             ) from ex
 
     tables = [
@@ -117,11 +125,13 @@ def read_crf_for_country(  # noqa: PLR0912, PLR0915
     ]
     print(
         f"The following tables are available in the "
-        f"CRF{submission_year} specification: {tables}"
+        f"{type}{submission_year} specification: {tables}"
     )
 
     if submission_date is None:
-        submission_date = get_latest_date_for_country(country_code, submission_year)
+        submission_date = get_latest_date_for_country(
+            country_code, submission_year, type
+        )
 
     # check if data has been read already
     read_data = not submission_has_been_read(
@@ -139,7 +149,7 @@ def read_crf_for_country(  # noqa: PLR0912, PLR0915
         for table in tables:
             # read table for all years
             ds_table, new_unknown_categories, new_last_row_info = read_crf_table(
-                country_code, table, submission_year, date=submission_date
+                country_code, table, submission_year, date=submission_date, type=type
             )  # , data_year=[1990])
 
             # collect messages on unknown rows etc
@@ -161,7 +171,7 @@ def read_crf_for_country(  # noqa: PLR0912, PLR0915
                 submission_year,
                 meta_data_input={
                     "title": f"Data submitted in {submission_year} to the UNFCCC "
-                    f"in the common reporting format (CRF) by {country_name}. "
+                    f"in the {type_name} ({type}) by {country_name}. "
                     f"Submission date: {submission_date}"
                 },
                 entity_mapping=entity_mapping,
@@ -211,12 +221,12 @@ def read_crf_for_country(  # noqa: PLR0912, PLR0915
             today = date.today()
             log_location = (
                 log_path
-                / f"CRF{submission_year}"
+                / f"{type}{submission_year}"
                 / f"{country_code}_unknown_categories_{today.strftime('%Y-%m-%d')}.csv"
             )
             print(
-                f"Unknown rows found for {country_code}. Not saving data. Savin log to "
-                f"{log_location}"
+                f"Unknown rows found for {country_code}. Not saving data. "
+                f"Saving log to {log_location}"
             )
             save_unknown_categories_info(unknown_categories, log_location)
 
@@ -225,7 +235,7 @@ def read_crf_for_country(  # noqa: PLR0912, PLR0915
             today = date.today()
             log_location = (
                 log_path
-                / f"CRF{submission_year}"
+                / f"{type}{submission_year}"
                 / f"{country_code}_last_row_info_{today.strftime('%Y-%m-%d')}.csv"
             )
             print(
@@ -237,7 +247,9 @@ def read_crf_for_country(  # noqa: PLR0912, PLR0915
         if save_data:
             compression = dict(zlib=True, complevel=9)
             output_folder = extracted_data_path_UNFCCC / country_name.replace(" ", "_")
-            output_filename = f"{country_code}_CRF{submission_year}_{submission_date}"
+            output_filename = (
+                f"{country_code}_{type}{submission_year}_" f"{submission_date}"
+            )
 
             if not output_folder.exists():
                 output_folder.mkdir()
@@ -261,6 +273,7 @@ def read_crf_for_country_datalad(
     submission_year: int,
     submission_date: Optional[str] = None,
     re_read: Optional[bool] = True,
+    type: str = "CRF",
 ) -> None:
     """
     Prepare input for read_crf_for_country
@@ -277,14 +290,19 @@ def read_crf_for_country_datalad(
     submission_date: Optional(str)
         Read for a specific submission date (given as string as in the file names)
         If not specified latest data will be read
+    type: str default "CRF"
+        Read CRF or CRT
 
     """
+    # check type
+    if type not in ["CRF", "CRT"]:
+        raise ValueError("Type must be CRF or CRT")  # noqa: TRY003
     # get all the info for the country
     country_info = get_input_and_output_files_for_country(
         country, submission_year=submission_year, verbose=True
     )
 
-    print(f"Attempting to read data for CRF{submission_year} from {country}.")
+    print(f"Attempting to read data for {type}{submission_year} from {country}.")
     print("#" * 80)
     print("")
     print("Using the unfccc_crf_reader")
@@ -293,15 +311,18 @@ def read_crf_for_country_datalad(
     script = code_path / "unfccc_crf_reader" / "read_unfccc_crf_submission.py"
 
     cmd = (
-        f"./venv/bin/python3 {script.as_posix()} --country={country} "
-        f"--submission_year={submission_year} --submission_date={submission_date}"
+        f"python3 {script.as_posix()} "
+        f"--country={country} "
+        f"--submission_year={submission_year} "
+        f"--submission_date={submission_date} "
+        f"--type={type}"
     )
     if re_read:
         cmd = cmd + " --re_read"
     datalad.api.run(
         cmd=cmd,
         dataset=root_path,
-        message=f"Read data for {country}, CRF{submission_year}, {submission_date}.",
+        message=f"Read data for {country}, {type}{submission_year}, {submission_date}.",
         inputs=country_info["input"],
         outputs=country_info["output"],
         dry_run=None,
@@ -313,6 +334,7 @@ def read_new_crf_for_year(
     submission_year: int,
     countries: list[str] | None = None,
     re_read: bool | None = False,
+    type: str = "CRF",
 ) -> dict:
     """
     Read CRF for given countries
@@ -340,6 +362,8 @@ def read_new_crf_for_year(
         CRF countries
     re_read: bool (optional, default=False)
         If true data will be read even if already read before.
+    type: str default "CRF"
+        Read CRF or CRT
 
     TODO: write log with failed countries and what has been read
 
@@ -354,16 +378,21 @@ def read_new_crf_for_year(
     read_countries = {}
     for country in countries:
         try:
-            country_df = read_crf_for_country(country, submission_year, re_read=re_read)
+            country_df = read_crf_for_country(
+                country, submission_year, re_read=re_read, type=type
+            )
             if country_df is None:
                 read_countries[country] = "skipped"
             else:
                 read_countries[country] = "read"
         except NoCRFFilesError:
-            print(f"No data for country {country}, {submission_year}")
+            print(f"No {type} data for country {country}, {submission_year}")
             read_countries[country] = "no data"
         except Exception as ex:
-            print(f"Data for country {country}, {submission_year} could not be read")
+            print(
+                f"{type} data for country {country}, "
+                f"{submission_year} could not be read"
+            )
             print(f"The following error occurred: {ex}")
             read_countries[country] = "failed"
 
@@ -392,6 +421,7 @@ def read_new_crf_for_year_datalad(
     submission_year: int,
     countries: Optional[list[str]] = None,
     re_read: Optional[bool] = False,
+    type: str = "CRF",
 ) -> None:
     """
     Prepare input for read_crf_for_year
@@ -408,16 +438,18 @@ def read_new_crf_for_year_datalad(
         CRF countries
     re_read: bool (optional, default=False)
         If true data will be read even if already read before.
+    type: str default "CRF"
+        Read CRF or CRT
 
     """
     if countries is not None:
         print(
-            f"Reading CRF{submission_year} for countries {countries} "
+            f"Reading {type}{submission_year} for countries {countries} "
             f"using unfccc_crf_reader."
         )
     else:
         print(
-            f"Reading CRF{submission_year} for all countries "
+            f"Reading {type}{submission_year} for all countries "
             f"using unfccc_crf_reader."
         )
         countries = all_crf_countries
@@ -460,12 +492,12 @@ def read_new_crf_for_year_datalad(
     print("Run the script using datalad run via the python api")
     script = code_path / "unfccc_crf_reader" / "read_new_unfccc_crf_for_year.py"
 
-    # cmd = f"./venv/bin/python3 {script.as_posix()} --countries={countries} "\
+    # cmd = f"python3 {script.as_posix()} --countries={countries} "\
     #      f"--submission_year={submission_year}"
-    # TODO this doesn't work with poetry
     cmd = (
-        f"./venv/bin/python3 {script.as_posix()} "
-        f"--submission_year={submission_year}"
+        f"python3 {script.as_posix()} "
+        f"--submission_year={submission_year} "
+        f"--type={type}"
     )
 
     if re_read:
@@ -473,7 +505,7 @@ def read_new_crf_for_year_datalad(
     datalad.api.run(
         cmd=cmd,
         dataset=root_path,
-        message=f"Read data for {countries}, CRF{submission_year}. "
+        message=f"Read data for {countries}, {type}{submission_year}. "
         f"Re-reading: {re_read}",
         inputs=input_files,
         outputs=output_files,
@@ -486,10 +518,28 @@ def get_input_and_output_files_for_country(
     country: str,
     submission_year: int,
     submission_date: Optional[str] = None,
+    type: str = "CRF",
     verbose: Optional[bool] = True,
 ) -> dict[str, Union[list, str]]:
     """
     Get input and output files for a given country
+
+    Parameters
+    ----------
+    country: str
+        3 letter country code
+    submission_year: int
+        year of submissions for CRF or submission round for CRT
+    submission_date
+        date of submission (as in the filename)
+    type: str: default "CRF"
+        CRF or CRT
+    verbose: bool (optional, default True)
+        if True print additional output
+
+    Returns
+    -------
+    dict with keays "input" and "output". Values are a list of files
     """
     country_info = {}
 
@@ -507,7 +557,9 @@ def get_input_and_output_files_for_country(
     if submission_date is None:
         if verbose:
             print("No submission date given, find latest date.")
-        submission_date = get_latest_date_for_country(country_code, submission_year)
+        submission_date = get_latest_date_for_country(
+            country_code, submission_year, type=type
+        )
     elif verbose:
         print(f"Using given submissions date {submission_date}")
 
@@ -515,11 +567,14 @@ def get_input_and_output_files_for_country(
         # there is no data. Raise an exception
         raise NoCRFFilesError(  # noqa: TRY003
             f"No submissions found for {country_code}, "
+            f"type={type}, "
             f"submission_year={submission_year}, "
             f"date={date}"
         )
     elif verbose:
-        print(f"Latest submission date for CRF{submission_year} is {submission_date}")
+        print(
+            f"Latest submission date for {type}{submission_year} is {submission_date}"
+        )
     country_info["date"] = submission_date
 
     # get possible input files
@@ -527,10 +582,11 @@ def get_input_and_output_files_for_country(
         country_codes=country_code,
         submission_year=submission_year,
         date=submission_date,
+        type=type,
     )
     if not input_files:
         raise NoCRFFilesError(  # noqa: TRY003
-            f"No possible input files found for {country}, CRF{submission_year}, "
+            f"No possible input files found for {country}, {type}{submission_year}, "
             f"v{submission_date}. Are they already submitted and included in the "
             f"repository?"
         )
@@ -547,7 +603,7 @@ def get_input_and_output_files_for_country(
     # get output file
     output_folder = extracted_data_path_UNFCCC / country_name.replace(" ", "_")
     output_files = [
-        output_folder / f"{country_code}_CRF{submission_year}"
+        output_folder / f"{country_code}_{type}{submission_year}"
         f"_{submission_date}.{suffix}"
         for suffix in ["yaml", "csv", "nc"]
     ]
@@ -566,18 +622,38 @@ def get_input_and_output_files_for_country(
     return country_info
 
 
-def submission_has_been_read(
+def submission_has_been_read(  # noqa: PLR0913
     country_code: str,
     country_name: str,
     submission_year: int,
     submission_date: str,
+    type: str = "CRF",
     verbose: Optional[bool] = True,
 ) -> bool:
     """
-    Check if a CRF submission has already been read
+    Check if a CRF/CRT submission has already been read
+
+    Parameters
+    ----------
+    country_code: str
+        3 letter country code
+    country_name: str
+        Name of the country
+    submission_year: int
+        year of submissions for CRF or submission round for CRT
+    submission_date
+        date of submission (as in the filename)
+    type: str: default "CRF"
+        CRF or CRT
+    verbose: bool (optional, default True)
+        if True print additional output
+
+    Returns
+    -------
+    True if data has been read, False otherwise
     """
     output_folder = extracted_data_path_UNFCCC / country_name.replace(" ", "_")
-    output_filename = f"{country_code}_CRF{submission_year}_{submission_date}"
+    output_filename = f"{country_code}_{type}{submission_year}_{submission_date}"
     if output_folder.exists():
         existing_files = output_folder.glob(f"{output_filename}.*")
         existing_suffixes = [file.suffix for file in existing_files]
@@ -586,14 +662,14 @@ def submission_has_been_read(
             if verbose:
                 print(
                     f"Data already available for {country_code}, "
-                    f"CRF{submission_year}, version {submission_date}."
+                    f"{type}{submission_year}, version {submission_date}."
                 )
         else:
             has_been_read = False
             if verbose:
                 print(
                     f"Partial data available for {country_code}, "
-                    f"CRF{submission_year}, version {submission_date}. "
+                    f"{type}{submission_year}, version {submission_date}. "
                     "Please check if all files have been written after "
                     "reading."
                 )
@@ -602,7 +678,7 @@ def submission_has_been_read(
         if verbose:
             print(
                 f"No read data available for {country_code}, "
-                f"CRF{submission_year}, version {submission_date}. "
+                f"{type}{submission_year}, version {submission_date}. "
             )
 
     return has_been_read