Browse Source

fix docs, disable most github CI jobs

Johannes Gütschow 9 months ago
parent
commit
b6703b4d56
42 changed files with 215 additions and 242 deletions
  1. 0 6
      docs/source/api/unfccc_ghg_data.helper.country_info.rst
  2. 18 0
      docs/source/api/unfccc_ghg_data.helper.functions.rst
  3. 0 25
      docs/source/api/unfccc_ghg_data.helper.functions_temp.rst
  4. 0 2
      docs/source/api/unfccc_ghg_data.helper.rst
  5. 6 0
      docs/source/api/unfccc_ghg_data.unfccc_crf_reader.crf_specifications.crt1_specification.rst
  6. 1 0
      docs/source/api/unfccc_ghg_data.unfccc_crf_reader.crf_specifications.rst
  7. 0 6
      docs/source/api/unfccc_ghg_data.unfccc_crf_reader.read_new_unfccc_crf_for_year_datalad.rst
  8. 0 6
      docs/source/api/unfccc_ghg_data.unfccc_crf_reader.read_unfccc_crf_submission_datalad.rst
  9. 0 2
      docs/source/api/unfccc_ghg_data.unfccc_crf_reader.rst
  10. 0 6
      docs/source/api/unfccc_ghg_data.unfccc_di_reader.process_unfccc_di_for_country_datalad.rst
  11. 0 6
      docs/source/api/unfccc_ghg_data.unfccc_di_reader.process_unfccc_di_for_country_group_datalad.rst
  12. 0 6
      docs/source/api/unfccc_ghg_data.unfccc_di_reader.read_unfccc_di_for_country_datalad.rst
  13. 0 6
      docs/source/api/unfccc_ghg_data.unfccc_di_reader.read_unfccc_di_for_country_group_datalad.rst
  14. 0 4
      docs/source/api/unfccc_ghg_data.unfccc_di_reader.rst
  15. 6 0
      docs/source/api/unfccc_ghg_data.unfccc_di_reader.unfccc_di_reader_core.rst
  16. 13 16
      src/unfccc_ghg_data/unfccc_crf_reader/unfccc_crf_reader_core.py
  17. 10 9
      src/unfccc_ghg_data/unfccc_di_reader/unfccc_di_reader_core.py
  18. 2 2
      src/unfccc_ghg_data/unfccc_downloader/download_nonannexI.py
  19. 9 9
      src/unfccc_ghg_data/unfccc_reader/Argentina/read_ARG_BUR5_from_csv.py
  20. 4 4
      src/unfccc_ghg_data/unfccc_reader/Burundi/read_BDI_BUR1_from_pdf.py
  21. 5 1
      src/unfccc_ghg_data/unfccc_reader/Chile/read_CHL_BUR4_from_xlsx.py
  22. 5 1
      src/unfccc_ghg_data/unfccc_reader/Chile/read_CHL_BUR5_from_xlsx.py
  23. 7 7
      src/unfccc_ghg_data/unfccc_reader/Guinea/read_GIN_BUR1_from_pdf.py
  24. 7 7
      src/unfccc_ghg_data/unfccc_reader/Israel/read_ISR_BUR2_from_pdf.py
  25. 9 9
      src/unfccc_ghg_data/unfccc_reader/Malaysia/read_MYS_BUR3_from_pdf.py
  26. 9 9
      src/unfccc_ghg_data/unfccc_reader/Malaysia/read_MYS_BUR4_from_pdf.py
  27. 7 5
      src/unfccc_ghg_data/unfccc_reader/Mexico/read_MEX_BUR3_from_pdf.py
  28. 8 8
      src/unfccc_ghg_data/unfccc_reader/Mongolia/read_MNG_BUR2_from_pdf.py
  29. 5 1
      src/unfccc_ghg_data/unfccc_reader/Montenegro/read_MNE_BUR3_from_pdf.py
  30. 4 4
      src/unfccc_ghg_data/unfccc_reader/Morocco/read_MAR_BUR3_from_pdf.py
  31. 8 8
      src/unfccc_ghg_data/unfccc_reader/Nigeria/read_NGA_BUR2_from_pdf.py
  32. 10 10
      src/unfccc_ghg_data/unfccc_reader/Peru/read_PER_BUR3_from_pdf.py
  33. 4 4
      src/unfccc_ghg_data/unfccc_reader/Republic_of_Korea/read_KOR_2021_Inventory_from_xlsx.py
  34. 4 4
      src/unfccc_ghg_data/unfccc_reader/Republic_of_Korea/read_KOR_2022_Inventory_from_xlsx.py
  35. 4 4
      src/unfccc_ghg_data/unfccc_reader/Republic_of_Korea/read_KOR_2023_Inventory_from_xlsx.py
  36. 4 2
      src/unfccc_ghg_data/unfccc_reader/Republic_of_Korea/read_KOR_BUR4_from_xlsx.py
  37. 10 10
      src/unfccc_ghg_data/unfccc_reader/Singapore/read_SGP_BUR5_from_pdf.py
  38. 6 6
      src/unfccc_ghg_data/unfccc_reader/Taiwan/read_TWN_2022_Inventory_from_pdf.py
  39. 12 12
      src/unfccc_ghg_data/unfccc_reader/Taiwan/read_TWN_2023_Inventory_from_pdf.py
  40. 7 7
      src/unfccc_ghg_data/unfccc_reader/Thailand/read_THA_BUR3_from_pdf.py
  41. 7 7
      src/unfccc_ghg_data/unfccc_reader/Thailand/read_THA_BUR4_from_pdf.py
  42. 4 1
      src/unfccc_ghg_data/unfccc_reader/read_UNFCCC_submission.py

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

@@ -1,6 +0,0 @@
-unfccc\_ghg\_data.helper.country\_info
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. automodule:: unfccc_ghg_data.helper.country_info
-
-.. currentmodule:: unfccc_ghg_data.helper.country_info

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

@@ -65,3 +65,21 @@ make\_wide\_table
 =================
 
 .. autofunction:: make_wide_table
+
+
+find\_and\_replace\_values
+==========================
+
+.. autofunction:: find_and_replace_values
+
+
+assert\_values
+==============
+
+.. autofunction:: assert_values
+
+
+assert\_nan\_values
+===================
+
+.. autofunction:: assert_nan_values

+ 0 - 25
docs/source/api/unfccc_ghg_data.helper.functions_temp.rst

@@ -1,25 +0,0 @@
-unfccc\_ghg\_data.helper.functions\_temp
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. automodule:: unfccc_ghg_data.helper.functions_temp
-
-.. currentmodule:: unfccc_ghg_data.helper.functions_temp
-
-
-
-find\_and\_replace\_values
-==========================
-
-.. autofunction:: find_and_replace_values
-
-
-assert\_values
-==============
-
-.. autofunction:: assert_values
-
-
-assert\_nan\_values
-===================
-
-.. autofunction:: assert_nan_values

+ 0 - 2
docs/source/api/unfccc_ghg_data.helper.rst

@@ -9,8 +9,6 @@ unfccc\_ghg\_data.helper
 .. autosummary::
   :toctree: ./
 
-  unfccc_ghg_data.helper.country_info
   unfccc_ghg_data.helper.definitions
   unfccc_ghg_data.helper.folder_mapping
   unfccc_ghg_data.helper.functions
-  unfccc_ghg_data.helper.functions_temp

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

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

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

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

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

@@ -1,6 +0,0 @@
-unfccc\_ghg\_data.unfccc\_crf\_reader.read\_new\_unfccc\_crf\_for\_year\_datalad
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. automodule:: unfccc_ghg_data.unfccc_crf_reader.read_new_unfccc_crf_for_year_datalad
-
-.. currentmodule:: unfccc_ghg_data.unfccc_crf_reader.read_new_unfccc_crf_for_year_datalad

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

@@ -1,6 +0,0 @@
-unfccc\_ghg\_data.unfccc\_crf\_reader.read\_unfccc\_crf\_submission\_datalad
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. automodule:: unfccc_ghg_data.unfccc_crf_reader.read_unfccc_crf_submission_datalad
-
-.. currentmodule:: unfccc_ghg_data.unfccc_crf_reader.read_unfccc_crf_submission_datalad

+ 0 - 2
docs/source/api/unfccc_ghg_data.unfccc_crf_reader.rst

@@ -12,9 +12,7 @@ unfccc\_ghg\_data.unfccc\_crf\_reader
   unfccc_ghg_data.unfccc_crf_reader.crf_raw_for_year
   unfccc_ghg_data.unfccc_crf_reader.crf_specifications
   unfccc_ghg_data.unfccc_crf_reader.read_new_unfccc_crf_for_year
-  unfccc_ghg_data.unfccc_crf_reader.read_new_unfccc_crf_for_year_datalad
   unfccc_ghg_data.unfccc_crf_reader.read_unfccc_crf_submission
-  unfccc_ghg_data.unfccc_crf_reader.read_unfccc_crf_submission_datalad
   unfccc_ghg_data.unfccc_crf_reader.test_read_unfccc_crf_for_year
   unfccc_ghg_data.unfccc_crf_reader.unfccc_crf_reader_core
   unfccc_ghg_data.unfccc_crf_reader.unfccc_crf_reader_devel

+ 0 - 6
docs/source/api/unfccc_ghg_data.unfccc_di_reader.process_unfccc_di_for_country_datalad.rst

@@ -1,6 +0,0 @@
-unfccc\_ghg\_data.unfccc\_di\_reader.process\_unfccc\_di\_for\_country\_datalad
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. automodule:: unfccc_ghg_data.unfccc_di_reader.process_unfccc_di_for_country_datalad
-
-.. currentmodule:: unfccc_ghg_data.unfccc_di_reader.process_unfccc_di_for_country_datalad

+ 0 - 6
docs/source/api/unfccc_ghg_data.unfccc_di_reader.process_unfccc_di_for_country_group_datalad.rst

@@ -1,6 +0,0 @@
-unfccc\_ghg\_data.unfccc\_di\_reader.process\_unfccc\_di\_for\_country\_group\_datalad
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. automodule:: unfccc_ghg_data.unfccc_di_reader.process_unfccc_di_for_country_group_datalad
-
-.. currentmodule:: unfccc_ghg_data.unfccc_di_reader.process_unfccc_di_for_country_group_datalad

+ 0 - 6
docs/source/api/unfccc_ghg_data.unfccc_di_reader.read_unfccc_di_for_country_datalad.rst

@@ -1,6 +0,0 @@
-unfccc\_ghg\_data.unfccc\_di\_reader.read\_unfccc\_di\_for\_country\_datalad
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. automodule:: unfccc_ghg_data.unfccc_di_reader.read_unfccc_di_for_country_datalad
-
-.. currentmodule:: unfccc_ghg_data.unfccc_di_reader.read_unfccc_di_for_country_datalad

+ 0 - 6
docs/source/api/unfccc_ghg_data.unfccc_di_reader.read_unfccc_di_for_country_group_datalad.rst

@@ -1,6 +0,0 @@
-unfccc\_ghg\_data.unfccc\_di\_reader.read\_unfccc\_di\_for\_country\_group\_datalad
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. automodule:: unfccc_ghg_data.unfccc_di_reader.read_unfccc_di_for_country_group_datalad
-
-.. currentmodule:: unfccc_ghg_data.unfccc_di_reader.read_unfccc_di_for_country_group_datalad

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

@@ -10,13 +10,9 @@ unfccc\_ghg\_data.unfccc\_di\_reader
   :toctree: ./
 
   unfccc_ghg_data.unfccc_di_reader.process_unfccc_di_for_country
-  unfccc_ghg_data.unfccc_di_reader.process_unfccc_di_for_country_datalad
   unfccc_ghg_data.unfccc_di_reader.process_unfccc_di_for_country_group
-  unfccc_ghg_data.unfccc_di_reader.process_unfccc_di_for_country_group_datalad
   unfccc_ghg_data.unfccc_di_reader.read_unfccc_di_for_country
-  unfccc_ghg_data.unfccc_di_reader.read_unfccc_di_for_country_datalad
   unfccc_ghg_data.unfccc_di_reader.read_unfccc_di_for_country_group
-  unfccc_ghg_data.unfccc_di_reader.read_unfccc_di_for_country_group_datalad
   unfccc_ghg_data.unfccc_di_reader.unfccc_di_reader_config
   unfccc_ghg_data.unfccc_di_reader.unfccc_di_reader_core
   unfccc_ghg_data.unfccc_di_reader.unfccc_di_reader_datalad

+ 6 - 0
docs/source/api/unfccc_ghg_data.unfccc_di_reader.unfccc_di_reader_core.rst

@@ -31,6 +31,12 @@ convert\_DI\_data\_to\_pm2\_if
 .. autofunction:: convert_DI_data_to_pm2_if
 
 
+convert\_DI\_IF\_data\_to\_pm2
+==============================
+
+.. autofunction:: convert_DI_IF_data_to_pm2
+
+
 read\_UNFCCC\_DI\_for\_country\_group
 =====================================
 

+ 13 - 16
src/unfccc_ghg_data/unfccc_crf_reader/unfccc_crf_reader_core.py

@@ -186,7 +186,7 @@ def read_crf_table(  # noqa: PLR0913, PLR0912, PLR0915
     date: str (optional, default is "latest")
         readonly submission from the given date
     folder: str (optional)
-        Folder that contains the xls files. If not given fodlers are determined by the
+        Folder that contains the xls files. If not given folders are determined by the
         submissions_year and country_code variables
     type: str default = "CRF"
         read CRF or CRF data
@@ -195,13 +195,12 @@ def read_crf_table(  # noqa: PLR0913, PLR0912, PLR0915
 
     Returns
     -------
-    Tuple[pd.DataFrame, List[List], List[List]]:
-
-    * First return parameter is the data as a pandas DataFrame in long format
-    * Second return parameter is a list of unknown categories / row headers
-    * Third return parameter holds information on data found in the last read row.
-      This is used as a hint to check if table specifications might have to be adapted
-      as country submitted tables are longer than expected.
+    Tuple of parameters
+        * First return parameter is the data as a pandas DataFrame in long format.
+        * Second return parameter is a list of unknown categories / row headers.
+        * Third return parameter holds information on data found in the last read row.
+          This is used as a hint to check if table specifications might have to
+          be adapted as country submitted tables are longer than expected.
 
     """
     # check type
@@ -342,15 +341,13 @@ def read_crf_table_from_file(  # noqa: PLR0912, PLR0915
 
     Returns
     -------
-    Tuple[pd.DataFrame, List[List], List[List]]:
-
-    * First return parameter is the data as a pandas DataFrame in long format
-    * Second return parameter is a list of unknown categories / row headers
-    * Third return parameter holds information on data found in the last read row.
-      This is used as a hint to check if table specifications might have to be adapted
-      as country submitted tables are longer than expected.
+    Tuple of parameters
+        * First return parameter is the data as a pandas DataFrame in long format
+        * Second return parameter is a list of unknown categories / row headers
+        * Third return parameter holds information on data found in the last read row.
+          This is used as a hint to check if table specifications might have to
+          be adapted as country submitted tables are longer than expected.
 
-    TODO: add verbosity option for debugging?
     """
     # check if file exists and if not download
     if file.is_symlink():

+ 10 - 9
src/unfccc_ghg_data/unfccc_di_reader/unfccc_di_reader_core.py

@@ -47,12 +47,14 @@ def read_UNFCCC_DI_for_country(  # noqa: PLR0913
 
     Parameters
     ----------
-    country_code: str
+    country_code
         ISO3 code of the country (country names don't work, use the wrapper function)
-    category_groups: dict (optional)
+    category_groups
         define which categories to read including filters on classification, measure,
-        gases
+        gases. If `None` the default configuration will be used
+
         .. code-block:: python
+
             cat_groups = {
                 "4.A  Enteric Fermentation": {  # 4.A  Enteric Fermentation[14577]
                     "measure": [
@@ -62,7 +64,6 @@ def read_UNFCCC_DI_for_country(  # noqa: PLR0913
                     "gases": ["CH4"],
                 },
             }
-        If `None` the default configuration will be used
     read_subsectors
         Whether to also read data for subsectors of the sectors defined in the
         category_groups.
@@ -77,14 +78,14 @@ def read_UNFCCC_DI_for_country(  # noqa: PLR0913
     use_gwp
         If given use this GWP specification for conversion of data in CO2 equivalents
         instead of the default GWP specifications
-    debug (default: False)
+    debug
         output debug information
-    use_zenodo (default: True)
+    use_zenodo
         Read from zenodo datasets instead of UNFCCC DI api.
 
     Returns
     -------
-    read data in primap2 format (xr.Dataset)
+    read data in primap2 format
 
     """
     # read the data
@@ -143,9 +144,9 @@ def read_UNFCCC_DI_for_country_df(  # noqa: PLR0912, PLR0915
 
     Parameters
     ----------
-    country_code: str
+    country_code
         ISO3 code of the country (country names don't work, use the wrapper function)
-    category_groups: dict (optional)
+    category_groups
         define which categories to read including filters on classification, measure,
         gases
 

+ 2 - 2
src/unfccc_ghg_data/unfccc_downloader/download_nonannexI.py

@@ -12,8 +12,8 @@ files in the *downloaded_data/UNFCCC* directory. Only files which are not presen
 will be downloaded (if a symlink exists the file will be treated as existing as it
 is assumed that it is included in the datalad repository).
 
-A file *00_new_downloads_[bur|nc]-/<date/>.csv with a list of all newly downloaded files
-is written.
+A file *00_new_downloads_[bur|nc]-/<date/>.csv* with a list of all newly downloaded
+files is written.
 """
 
 import argparse

+ 9 - 9
src/unfccc_ghg_data/unfccc_reader/Argentina/read_ARG_BUR5_from_csv.py

@@ -24,7 +24,15 @@ the highest detail categories are present
 
 import pandas as pd
 import primap2 as pm2
-from config_arg_bur5 import (
+
+from unfccc_ghg_data.helper import (
+    compression,
+    downloaded_data_path,
+    extracted_data_path,
+    gas_baskets,
+    process_data_for_country,
+)
+from unfccc_ghg_data.unfccc_reader.Argentina.config_arg_bur5 import (
     cats_to_agg,
     coords_cols,
     coords_defaults,
@@ -38,14 +46,6 @@ from config_arg_bur5 import (
     unit,
 )
 
-from unfccc_ghg_data.helper import (
-    compression,
-    downloaded_data_path,
-    extracted_data_path,
-    gas_baskets,
-    process_data_for_country,
-)
-
 if __name__ == "__main__":
     # ###
     # configuration

+ 4 - 4
src/unfccc_ghg_data/unfccc_reader/Burundi/read_BDI_BUR1_from_pdf.py

@@ -4,7 +4,10 @@ Read Burundi's BUR1 from pdf
 import camelot
 import pandas as pd
 import primap2 as pm2
-from config_bdi_bur1 import (
+
+from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
+from unfccc_ghg_data.helper.functions import process_data_for_country
+from unfccc_ghg_data.unfccc_reader.Burundi.config_bdi_bur1 import (
     coords_cols,
     coords_defaults,
     coords_terminologies,
@@ -17,9 +20,6 @@ from config_bdi_bur1 import (
     meta_data,
 )
 
-from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
-from unfccc_ghg_data.helper.functions import process_data_for_country
-
 if __name__ == "__main__":
     # ###
     # configuration

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

@@ -10,10 +10,14 @@ import sys
 
 import pandas as pd
 import primap2 as pm2
-from config_chl_bur4 import aggregate_cats, cat_mapping, filter_remove_IPCC2006
 from primap2.pm2io._data_reading import filter_data, matches_time_format
 
 from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
+from unfccc_ghg_data.unfccc_reader.Chile.config_chl_bur4 import (
+    aggregate_cats,
+    cat_mapping,
+    filter_remove_IPCC2006,
+)
 
 if __name__ == "__main__":
     # ###

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

@@ -10,10 +10,14 @@ import sys
 
 import pandas as pd
 import primap2 as pm2
-from config_chl_bur4 import aggregate_cats, cat_mapping, filter_remove_IPCC2006
 from primap2.pm2io._data_reading import filter_data, matches_time_format
 
 from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
+from unfccc_ghg_data.unfccc_reader.Chile.config_chl_bur4 import (
+    aggregate_cats,
+    cat_mapping,
+    filter_remove_IPCC2006,
+)
 
 if __name__ == "__main__":
     # ###

+ 7 - 7
src/unfccc_ghg_data/unfccc_reader/Guinea/read_GIN_BUR1_from_pdf.py

@@ -4,7 +4,13 @@ Read Guinea's BUR1 from pdf
 import camelot
 import pandas as pd
 import primap2 as pm2
-from config_gin_bur1 import (
+
+from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
+from unfccc_ghg_data.helper.functions import (
+    find_and_replace_values,
+    process_data_for_country,
+)
+from unfccc_ghg_data.unfccc_reader.Guinea.config_gin_bur1 import (
     coords_cols,
     coords_defaults,
     coords_terminologies,
@@ -22,12 +28,6 @@ from config_gin_bur1 import (
     set_value,
 )
 
-from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
-from unfccc_ghg_data.helper.functions import (
-    find_and_replace_values,
-    process_data_for_country,
-)
-
 if __name__ == "__main__":
     # ###
     # configuration

+ 7 - 7
src/unfccc_ghg_data/unfccc_reader/Israel/read_ISR_BUR2_from_pdf.py

@@ -16,8 +16,14 @@ import camelot
 import pandas as pd
 import primap2 as pm2
 
+from unfccc_ghg_data.helper import (
+    downloaded_data_path,
+    extracted_data_path,
+    process_data_for_country,
+)
+
 # configuration import
-from config_isr_bur2 import (
+from unfccc_ghg_data.unfccc_reader.Israel.config_isr_bur2 import (
     basket_copy,
     cat_conversion,
     cats_to_agg,
@@ -37,12 +43,6 @@ from config_isr_bur2 import (
     trend_table_def,
 )
 
-from unfccc_ghg_data.helper import (
-    downloaded_data_path,
-    extracted_data_path,
-    process_data_for_country,
-)
-
 if __name__ == "__main__":
     ### genral configuration
     input_folder = downloaded_data_path / "UNFCCC" / "Israel" / "BUR2"

+ 9 - 9
src/unfccc_ghg_data/unfccc_reader/Malaysia/read_MYS_BUR3_from_pdf.py

@@ -9,7 +9,15 @@ Data are read from pdf using camelot
 
 import camelot
 import primap2 as pm2
-from config_mys_bur3 import (
+from primap2.pm2io._conversion import convert_ipcc_code_primap_to_primap2
+
+from unfccc_ghg_data.helper import (
+    downloaded_data_path,
+    extracted_data_path,
+    fix_rows,
+    process_data_for_country,
+)
+from unfccc_ghg_data.unfccc_reader.Malaysia.config_mys_bur3 import (
     cat_code_regexp,
     cat_codes_manual,
     cat_names_fix,
@@ -27,14 +35,6 @@ from config_mys_bur3 import (
     terminology_proc,
     values_replacement,
 )
-from primap2.pm2io._conversion import convert_ipcc_code_primap_to_primap2
-
-from unfccc_ghg_data.helper import (
-    downloaded_data_path,
-    extracted_data_path,
-    fix_rows,
-    process_data_for_country,
-)
 
 if __name__ == "__main__":
     # ###

+ 9 - 9
src/unfccc_ghg_data/unfccc_reader/Malaysia/read_MYS_BUR4_from_pdf.py

@@ -10,7 +10,15 @@ Code ist mostly identical to BUR3
 
 import camelot
 import primap2 as pm2
-from config_mys_bur4 import (
+from primap2.pm2io._conversion import convert_ipcc_code_primap_to_primap2
+
+from unfccc_ghg_data.helper import (
+    downloaded_data_path,
+    extracted_data_path,
+    fix_rows,
+    process_data_for_country,
+)
+from unfccc_ghg_data.unfccc_reader.Malaysia.config_mys_bur4 import (
     cat_code_regexp,
     cat_codes_manual,
     cat_names_fix,
@@ -28,14 +36,6 @@ from config_mys_bur4 import (
     terminology_proc,
     values_replacement,
 )
-from primap2.pm2io._conversion import convert_ipcc_code_primap_to_primap2
-
-from unfccc_ghg_data.helper import (
-    downloaded_data_path,
-    extracted_data_path,
-    fix_rows,
-    process_data_for_country,
-)
 
 if __name__ == "__main__":
     # ###

+ 7 - 5
src/unfccc_ghg_data/unfccc_reader/Mexico/read_MEX_BUR3_from_pdf.py

@@ -9,8 +9,8 @@ Data are read from pdf using camelot
 import camelot
 import pandas as pd
 import primap2 as pm2
-from config_mex_bur3 import fix_rows, page_defs
 
+import unfccc_ghg_data.unfccc_reader.Mexico.config_mex_bur3
 from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
 
 if __name__ == "__main__":
@@ -110,9 +110,9 @@ if __name__ == "__main__":
     # read the data from pdf into one long format dataframe
     # ###
     df_all = None
-    for page in page_defs.keys():
+    for page in unfccc_ghg_data.unfccc_reader.Mexico.config_mex_bur3.page_defs.keys():
         print(f"Working on page {page}")
-        page_def = page_defs[page]
+        page_def = unfccc_ghg_data.unfccc_reader.Mexico.config_mex_bur3.page_defs[page]
         tables = camelot.read_pdf(
             str(input_folder / inventory_file), pages=page, **page_def["camelot"]
         )
@@ -128,8 +128,10 @@ if __name__ == "__main__":
             df_this_table.iloc[:, 0] = df_this_table.iloc[:, 0].str.replace("-", "-")
             # replace double space in entity
             df_this_table.iloc[0, :] = df_this_table.iloc[0, :].str.replace("  ", " ")
-            df_this_table = fix_rows(
-                df_this_table, page_def["rows_to_fix"][n_rows], 0, n_rows
+            df_this_table = (
+                unfccc_ghg_data.unfccc_reader.Mexico.config_mex_bur3.fix_rows(
+                    df_this_table, page_def["rows_to_fix"][n_rows], 0, n_rows
+                )
             )
 
         # add units

+ 8 - 8
src/unfccc_ghg_data/unfccc_reader/Mongolia/read_MNG_BUR2_from_pdf.py

@@ -4,7 +4,14 @@ Read Mongolia's BUR2 from pdf
 import camelot
 import pandas as pd
 import primap2 as pm2
-from config_mng_bur2 import (
+
+from unfccc_ghg_data.helper import (
+    downloaded_data_path,
+    extracted_data_path,
+    fix_rows,
+    process_data_for_country,
+)
+from unfccc_ghg_data.unfccc_reader.Mongolia.config_mng_bur2 import (
     coords_cols,
     coords_defaults,
     coords_terminologies,
@@ -18,13 +25,6 @@ from config_mng_bur2 import (
     meta_data,
 )
 
-from unfccc_ghg_data.helper import (
-    downloaded_data_path,
-    extracted_data_path,
-    fix_rows,
-    process_data_for_country,
-)
-
 if __name__ == "__main__":
     # ###
     # configuration

+ 5 - 1
src/unfccc_ghg_data/unfccc_reader/Montenegro/read_MNE_BUR3_from_pdf.py

@@ -16,10 +16,14 @@ import re
 import camelot
 import pandas as pd
 import primap2 as pm2
-from config_mne_bur3 import aggregate_cats, cat_mapping, drop_data
 from primap2.pm2io._data_reading import matches_time_format
 
 from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
+from unfccc_ghg_data.unfccc_reader.Montenegro.config_mne_bur3 import (
+    aggregate_cats,
+    cat_mapping,
+    drop_data,
+)
 
 if __name__ == "__main__":
     # ###

+ 4 - 4
src/unfccc_ghg_data/unfccc_reader/Morocco/read_MAR_BUR3_from_pdf.py

@@ -10,7 +10,10 @@ import copy
 import camelot
 import pandas as pd
 import primap2 as pm2
-from config_mar_bur3 import (
+from primap2.pm2io._data_reading import filter_data, matches_time_format
+
+from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
+from unfccc_ghg_data.unfccc_reader.Morocco.config_mar_bur3 import (
     aggregate_cats,
     cat_mapping,
     header_defs,
@@ -18,9 +21,6 @@ from config_mar_bur3 import (
     table_defs,
     zero_cats,
 )
-from primap2.pm2io._data_reading import filter_data, matches_time_format
-
-from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
 
 if __name__ == "__main__":
     # ###

+ 8 - 8
src/unfccc_ghg_data/unfccc_reader/Nigeria/read_NGA_BUR2_from_pdf.py

@@ -14,7 +14,14 @@ import numpy as np
 import pandas as pd
 import primap2 as pm2
 import xarray as xr
-from config_nga_bur2 import (
+
+from unfccc_ghg_data.helper import (
+    downloaded_data_path,
+    extracted_data_path,
+    gas_baskets,
+    process_data_for_country,
+)
+from unfccc_ghg_data.unfccc_reader.Nigeria.config_nga_bur2 import (
     cat_code_regexp,
     cat_codes_manual,
     coords_cols,
@@ -35,13 +42,6 @@ from config_nga_bur2 import (
     year_inventory,
 )
 
-from unfccc_ghg_data.helper import (
-    downloaded_data_path,
-    extracted_data_path,
-    gas_baskets,
-    process_data_for_country,
-)
-
 if __name__ == "__main__":
     # ###
     # configuration

+ 10 - 10
src/unfccc_ghg_data/unfccc_reader/Peru/read_PER_BUR3_from_pdf.py

@@ -11,7 +11,16 @@ import locale
 import camelot
 import pandas as pd
 import primap2 as pm2
-from config_per_bur3 import (
+from primap2.pm2io._conversion import convert_ipcc_code_primap_to_primap2
+
+from unfccc_ghg_data.helper import (
+    downloaded_data_path,
+    extracted_data_path,
+    fix_rows,
+    gas_baskets,
+    process_data_for_country,
+)
+from unfccc_ghg_data.unfccc_reader.Peru.config_per_bur3 import (
     cat_code_regexp,
     cat_codes_manual,
     cat_conversion,
@@ -31,15 +40,6 @@ from config_per_bur3 import (
     table_defs,
     values_replacement,
 )
-from primap2.pm2io._conversion import convert_ipcc_code_primap_to_primap2
-
-from unfccc_ghg_data.helper import (
-    downloaded_data_path,
-    extracted_data_path,
-    fix_rows,
-    gas_baskets,
-    process_data_for_country,
-)
 
 if __name__ == "__main__":
     ### general configuration

+ 4 - 4
src/unfccc_ghg_data/unfccc_reader/Republic_of_Korea/read_KOR_2021_Inventory_from_xlsx.py

@@ -12,7 +12,10 @@ import sys
 
 import pandas as pd
 import primap2 as pm2
-from config_kor_bur4 import (
+from primap2.pm2io._data_reading import filter_data, matches_time_format
+
+from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
+from unfccc_ghg_data.unfccc_reader.Republic_of_Korea.config_kor_bur4 import (
     aggregate_after_mapping,
     aggregate_before_mapping,
     cat_codes,
@@ -22,9 +25,6 @@ from config_kor_bur4 import (
     filter_remove_2006,
     filter_remove_after_agg,
 )
-from primap2.pm2io._data_reading import filter_data, matches_time_format
-
-from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
 
 if __name__ == "__main__":
     # ###

+ 4 - 4
src/unfccc_ghg_data/unfccc_reader/Republic_of_Korea/read_KOR_2022_Inventory_from_xlsx.py

@@ -11,7 +11,10 @@ import sys
 
 import pandas as pd
 import primap2 as pm2
-from config_kor_bur4 import (
+from primap2.pm2io._data_reading import filter_data, matches_time_format
+
+from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
+from unfccc_ghg_data.unfccc_reader.Republic_of_Korea.config_kor_bur4 import (
     aggregate_after_mapping,
     aggregate_before_mapping,
     cat_codes,
@@ -21,9 +24,6 @@ from config_kor_bur4 import (
     filter_remove_2006,
     filter_remove_after_agg,
 )
-from primap2.pm2io._data_reading import filter_data, matches_time_format
-
-from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
 
 if __name__ == "__main__":
     # ###

+ 4 - 4
src/unfccc_ghg_data/unfccc_reader/Republic_of_Korea/read_KOR_2023_Inventory_from_xlsx.py

@@ -7,7 +7,10 @@ import sys
 
 import pandas as pd
 import primap2 as pm2
-from config_KOR_INV2023 import (
+from primap2.pm2io._data_reading import filter_data, matches_time_format
+
+from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
+from unfccc_ghg_data.unfccc_reader.Republic_of_Korea.config_KOR_INV2023 import (
     aggregate_after_mapping,
     aggregate_before_mapping,
     cat_codes,
@@ -18,9 +21,6 @@ from config_KOR_INV2023 import (
     filter_remove_after_agg,
     fix_rows,
 )
-from primap2.pm2io._data_reading import filter_data, matches_time_format
-
-from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
 
 if __name__ == "__main__":
     # ###

+ 4 - 2
src/unfccc_ghg_data/unfccc_reader/Republic_of_Korea/read_KOR_BUR4_from_xlsx.py

@@ -14,8 +14,10 @@ import primap2 as pm2
 from primap2.pm2io._data_reading import filter_data
 
 from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
-
-from .config_kor_bur4 import cat_codes, cat_name_translations
+from unfccc_ghg_data.unfccc_reader.Republic_of_Korea.config_kor_bur4 import (
+    cat_codes,
+    cat_name_translations,
+)
 
 if __name__ == "__main__":
     # ###

+ 10 - 10
src/unfccc_ghg_data/unfccc_reader/Singapore/read_SGP_BUR5_from_pdf.py

@@ -11,7 +11,16 @@ import locale
 import camelot
 import pandas as pd
 import primap2 as pm2
-from config_sgp_bur5 import (
+from primap2.pm2io._conversion import convert_ipcc_code_primap_to_primap2
+
+from unfccc_ghg_data.helper import (
+    downloaded_data_path,
+    extracted_data_path,
+    fix_rows,
+    gas_baskets,
+    process_data_for_country,
+)
+from unfccc_ghg_data.unfccc_reader.Singapore.config_sgp_bur5 import (
     cat_code_regexp,
     cat_codes_manual,
     cat_names_fix,
@@ -30,15 +39,6 @@ from config_sgp_bur5 import (
     table_defs,
     values_replacement,
 )
-from primap2.pm2io._conversion import convert_ipcc_code_primap_to_primap2
-
-from unfccc_ghg_data.helper import (
-    downloaded_data_path,
-    extracted_data_path,
-    fix_rows,
-    gas_baskets,
-    process_data_for_country,
-)
 
 if __name__ == "__main__":
     ### genral configuration

+ 6 - 6
src/unfccc_ghg_data/unfccc_reader/Taiwan/read_TWN_2022_Inventory_from_pdf.py

@@ -12,12 +12,6 @@ import copy
 import camelot
 import pandas as pd
 import primap2 as pm2
-from config_twn_nir2022 import (
-    fix_rows,
-    gwp_to_use,
-    page_defs,
-    table_defs,
-)
 from primap2.pm2io._data_reading import matches_time_format
 
 from unfccc_ghg_data.helper import (
@@ -25,6 +19,12 @@ from unfccc_ghg_data.helper import (
     extracted_data_path,
     make_wide_table,
 )
+from unfccc_ghg_data.unfccc_reader.Taiwan.config_twn_nir2022 import (
+    fix_rows,
+    gwp_to_use,
+    page_defs,
+    table_defs,
+)
 
 if __name__ == "__main__":
     # ###

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

@@ -9,8 +9,18 @@ import copy
 import camelot
 import pandas as pd
 import primap2 as pm2
-from config_twn_nir2022 import fix_rows
-from config_twn_nir2023 import (
+from primap2.pm2io._data_reading import matches_time_format
+
+from unfccc_ghg_data.helper import (
+    compression,
+    downloaded_data_path,
+    extracted_data_path,
+    gas_baskets,
+    make_wide_table,
+    process_data_for_country,
+)
+from unfccc_ghg_data.unfccc_reader.Taiwan.config_twn_nir2022 import fix_rows
+from unfccc_ghg_data.unfccc_reader.Taiwan.config_twn_nir2023 import (
     add_coords_cols,
     basket_copy,
     cat_code_regexp,
@@ -24,16 +34,6 @@ from config_twn_nir2023 import (
     table_defs,
     terminology_proc,
 )
-from primap2.pm2io._data_reading import matches_time_format
-
-from unfccc_ghg_data.helper import (
-    compression,
-    downloaded_data_path,
-    extracted_data_path,
-    gas_baskets,
-    make_wide_table,
-    process_data_for_country,
-)
 
 if __name__ == "__main__":
     # ###

+ 7 - 7
src/unfccc_ghg_data/unfccc_reader/Thailand/read_THA_BUR3_from_pdf.py

@@ -8,7 +8,13 @@ Data are read from pdf using camelot
 import camelot
 import pandas as pd
 import primap2 as pm2
-from config_tha_bur3 import (
+
+from unfccc_ghg_data.helper import (
+    downloaded_data_path,
+    extracted_data_path,
+    process_data_for_country,
+)
+from unfccc_ghg_data.unfccc_reader.Thailand.config_tha_bur3 import (
     cat_conversion,
     coords_cols,
     coords_cols_indirect,
@@ -30,12 +36,6 @@ from config_tha_bur3 import (
     trend_conf,
 )
 
-from unfccc_ghg_data.helper import (
-    downloaded_data_path,
-    extracted_data_path,
-    process_data_for_country,
-)
-
 if __name__ == "__main__":
     # ###
     # configuration

+ 7 - 7
src/unfccc_ghg_data/unfccc_reader/Thailand/read_THA_BUR4_from_pdf.py

@@ -21,7 +21,13 @@ tables
 
 import pandas as pd
 import primap2 as pm2
-from config_tha_bur4 import (
+
+from unfccc_ghg_data.helper import (
+    downloaded_data_path,
+    extracted_data_path,
+    process_data_for_country,
+)
+from unfccc_ghg_data.unfccc_reader.Thailand.config_tha_bur4 import (
     cat_codes_manual_main_sector_ts,
     cat_conversion,
     coords_cols,
@@ -42,12 +48,6 @@ from config_tha_bur4 import (
     terminology_proc,
 )
 
-from unfccc_ghg_data.helper import (
-    downloaded_data_path,
-    extracted_data_path,
-    process_data_for_country,
-)
-
 if __name__ == "__main__":
     # ###
     # configuration

+ 4 - 1
src/unfccc_ghg_data/unfccc_reader/read_UNFCCC_submission.py

@@ -10,9 +10,12 @@ run the appropriate script to extract the submission data
 import argparse
 
 import datalad.api
-from get_submissions_info import get_possible_inputs, get_possible_outputs
 
 from unfccc_ghg_data.helper import get_code_file, root_path
+from unfccc_ghg_data.unfccc_reader.get_submissions_info import (
+    get_possible_inputs,
+    get_possible_outputs,
+)
 
 if __name__ == "__main__":
     # Find the right function and possible input and output files and