Jelajahi Sumber

fix imports in UNFCCC submission reading scripts

Johannes Gütschow 9 bulan lalu
induk
melakukan
fa7e4c741a
20 mengubah file dengan 123 tambahan dan 140 penghapusan
  1. 9 10
      src/unfccc_ghg_data/unfccc_reader/Argentina/read_ARG_BUR5_from_csv.py
  2. 4 5
      src/unfccc_ghg_data/unfccc_reader/Burundi/read_BDI_BUR1_from_pdf.py
  3. 1 2
      src/unfccc_ghg_data/unfccc_reader/Chile/read_CHL_BUR4_from_xlsx.py
  4. 1 2
      src/unfccc_ghg_data/unfccc_reader/Chile/read_CHL_BUR5_from_xlsx.py
  5. 7 6
      src/unfccc_ghg_data/unfccc_reader/Guinea/read_GIN_BUR1_from_pdf.py
  6. 7 7
      src/unfccc_ghg_data/unfccc_reader/Israel/read_ISR_BUR2_from_pdf.py
  7. 9 10
      src/unfccc_ghg_data/unfccc_reader/Malaysia/read_MYS_BUR3_from_pdf.py
  8. 9 10
      src/unfccc_ghg_data/unfccc_reader/Malaysia/read_MYS_BUR4_from_pdf.py
  9. 1 2
      src/unfccc_ghg_data/unfccc_reader/Mexico/read_MEX_BUR3_from_pdf.py
  10. 8 9
      src/unfccc_ghg_data/unfccc_reader/Mongolia/read_MNG_BUR2_from_pdf.py
  11. 1 2
      src/unfccc_ghg_data/unfccc_reader/Montenegro/read_MNE_BUR3_from_pdf.py
  12. 4 5
      src/unfccc_ghg_data/unfccc_reader/Morocco/read_MAR_BUR3_from_pdf.py
  13. 8 9
      src/unfccc_ghg_data/unfccc_reader/Nigeria/read_NGA_BUR2_from_pdf.py
  14. 10 11
      src/unfccc_ghg_data/unfccc_reader/Peru/read_PER_BUR3_from_pdf.py
  15. 4 5
      src/unfccc_ghg_data/unfccc_reader/Republic_of_Korea/read_KOR_2021_Inventory_from_xlsx.py
  16. 4 5
      src/unfccc_ghg_data/unfccc_reader/Republic_of_Korea/read_KOR_2022_Inventory_from_xlsx.py
  17. 10 11
      src/unfccc_ghg_data/unfccc_reader/Singapore/read_SGP_BUR5_from_pdf.py
  18. 12 13
      src/unfccc_ghg_data/unfccc_reader/Taiwan/read_TWN_2023_Inventory_from_pdf.py
  19. 7 8
      src/unfccc_ghg_data/unfccc_reader/Thailand/read_THA_BUR3_from_pdf.py
  20. 7 8
      src/unfccc_ghg_data/unfccc_reader/Thailand/read_THA_BUR4_from_pdf.py

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

@@ -24,16 +24,7 @@ the highest detail categories are present
 
 import pandas as pd
 import primap2 as pm2
-
-from unfccc_ghg_data.helper import (
-    compression,
-    downloaded_data_path,
-    extracted_data_path,
-    gas_baskets,
-    process_data_for_country,
-)
-
-from .config_arg_bur5 import (
+from config_arg_bur5 import (
     cats_to_agg,
     coords_cols,
     coords_defaults,
@@ -47,6 +38,14 @@ 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 - 5
src/unfccc_ghg_data/unfccc_reader/Burundi/read_BDI_BUR1_from_pdf.py

@@ -4,11 +4,7 @@ Read Burundi's BUR1 from pdf
 import camelot
 import pandas as pd
 import primap2 as pm2
-
-from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
-from unfccc_ghg_data.helper.functions import process_data_for_country
-
-from .config_bdi_bur1 import (
+from config_bdi_bur1 import (
     coords_cols,
     coords_defaults,
     coords_terminologies,
@@ -21,6 +17,9 @@ 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

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

@@ -10,12 +10,11 @@ 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 .config_chl_bur4 import aggregate_cats, cat_mapping, filter_remove_IPCC2006
-
 if __name__ == "__main__":
     # ###
     # configuration

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

@@ -10,12 +10,11 @@ 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 .config_chl_bur4 import aggregate_cats, cat_mapping, filter_remove_IPCC2006
-
 if __name__ == "__main__":
     # ###
     # configuration

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

@@ -4,12 +4,7 @@ Read Guinea's BUR1 from pdf
 import camelot
 import pandas as pd
 import primap2 as pm2
-
-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.helper.functions_temp import find_and_replace_values
-
-from .config_gin_bur1 import (
+from config_gin_bur1 import (
     coords_cols,
     coords_defaults,
     coords_terminologies,
@@ -27,6 +22,12 @@ 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,14 +16,8 @@ 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 config_isr_bur2 import (
     basket_copy,
     cat_conversion,
     cats_to_agg,
@@ -43,6 +37,12 @@ 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 - 10
src/unfccc_ghg_data/unfccc_reader/Malaysia/read_MYS_BUR3_from_pdf.py

@@ -9,16 +9,7 @@ Data are read from pdf using camelot
 
 import camelot
 import primap2 as pm2
-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 .config_mys_bur3 import (
+from config_mys_bur3 import (
     cat_code_regexp,
     cat_codes_manual,
     cat_names_fix,
@@ -36,6 +27,14 @@ 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 - 10
src/unfccc_ghg_data/unfccc_reader/Malaysia/read_MYS_BUR4_from_pdf.py

@@ -10,16 +10,7 @@ Code ist mostly identical to BUR3
 
 import camelot
 import primap2 as pm2
-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 .config_mys_bur4 import (
+from config_mys_bur4 import (
     cat_code_regexp,
     cat_codes_manual,
     cat_names_fix,
@@ -37,6 +28,14 @@ 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__":
     # ###

+ 1 - 2
src/unfccc_ghg_data/unfccc_reader/Mexico/read_MEX_BUR3_from_pdf.py

@@ -9,11 +9,10 @@ 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
 
 from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
 
-from .config_mex_bur3 import fix_rows, page_defs
-
 if __name__ == "__main__":
     # ###
     # configuration

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

@@ -4,15 +4,7 @@ Read Mongolia's BUR2 from pdf
 import camelot
 import pandas as pd
 import primap2 as pm2
-
-from unfccc_ghg_data.helper import (
-    downloaded_data_path,
-    extracted_data_path,
-    fix_rows,
-    process_data_for_country,
-)
-
-from .config_mng_bur2 import (
+from config_mng_bur2 import (
     coords_cols,
     coords_defaults,
     coords_terminologies,
@@ -26,6 +18,13 @@ 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

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

@@ -16,12 +16,11 @@ 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 .config_mne_bur3 import aggregate_cats, cat_mapping, drop_data
-
 if __name__ == "__main__":
     # ###
     # configuration

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

@@ -10,11 +10,7 @@ import copy
 import camelot
 import pandas as pd
 import primap2 as pm2
-from primap2.pm2io._data_reading import filter_data, matches_time_format
-
-from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
-
-from .config_mar_bur3 import (
+from config_mar_bur3 import (
     aggregate_cats,
     cat_mapping,
     header_defs,
@@ -22,6 +18,9 @@ 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 - 9
src/unfccc_ghg_data/unfccc_reader/Nigeria/read_NGA_BUR2_from_pdf.py

@@ -14,15 +14,7 @@ import numpy as np
 import pandas as pd
 import primap2 as pm2
 import xarray as xr
-
-from unfccc_ghg_data.helper import (
-    downloaded_data_path,
-    extracted_data_path,
-    gas_baskets,
-    process_data_for_country,
-)
-
-from .config_nga_bur2 import (
+from config_nga_bur2 import (
     cat_code_regexp,
     cat_codes_manual,
     coords_cols,
@@ -43,6 +35,13 @@ 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 - 11
src/unfccc_ghg_data/unfccc_reader/Peru/read_PER_BUR3_from_pdf.py

@@ -11,17 +11,7 @@ import locale
 import camelot
 import pandas as pd
 import primap2 as pm2
-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 .config_per_bur3 import (
+from config_per_bur3 import (
     cat_code_regexp,
     cat_codes_manual,
     cat_conversion,
@@ -41,6 +31,15 @@ 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 - 5
src/unfccc_ghg_data/unfccc_reader/Republic_of_Korea/read_KOR_2021_Inventory_from_xlsx.py

@@ -12,11 +12,7 @@ import sys
 
 import pandas as pd
 import primap2 as pm2
-from primap2.pm2io._data_reading import filter_data, matches_time_format
-
-from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
-
-from .config_kor_bur4 import (
+from config_kor_bur4 import (
     aggregate_after_mapping,
     aggregate_before_mapping,
     cat_codes,
@@ -26,6 +22,9 @@ 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 - 5
src/unfccc_ghg_data/unfccc_reader/Republic_of_Korea/read_KOR_2022_Inventory_from_xlsx.py

@@ -11,11 +11,7 @@ import sys
 
 import pandas as pd
 import primap2 as pm2
-from primap2.pm2io._data_reading import filter_data, matches_time_format
-
-from unfccc_ghg_data.helper import downloaded_data_path, extracted_data_path
-
-from .config_kor_bur4 import (
+from config_kor_bur4 import (
     aggregate_after_mapping,
     aggregate_before_mapping,
     cat_codes,
@@ -25,6 +21,9 @@ 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__":
     # ###

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

@@ -11,17 +11,7 @@ import locale
 import camelot
 import pandas as pd
 import primap2 as pm2
-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 .config_sgp_bur5 import (
+from config_sgp_bur5 import (
     cat_code_regexp,
     cat_codes_manual,
     cat_names_fix,
@@ -40,6 +30,15 @@ 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

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

@@ -9,19 +9,8 @@ import copy
 import camelot
 import pandas as pd
 import primap2 as pm2
-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 .config_twn_nir2022 import fix_rows
-from .config_twn_nir2023 import (
+from config_twn_nir2022 import fix_rows
+from config_twn_nir2023 import (
     add_coords_cols,
     basket_copy,
     cat_code_regexp,
@@ -35,6 +24,16 @@ 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 - 8
src/unfccc_ghg_data/unfccc_reader/Thailand/read_THA_BUR3_from_pdf.py

@@ -8,14 +8,7 @@ Data are read from pdf using camelot
 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,
-)
-
-from .config_tha_bur3 import (
+from config_tha_bur3 import (
     cat_conversion,
     coords_cols,
     coords_cols_indirect,
@@ -37,6 +30,12 @@ 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 - 8
src/unfccc_ghg_data/unfccc_reader/Thailand/read_THA_BUR4_from_pdf.py

@@ -21,14 +21,7 @@ tables
 
 import pandas as pd
 import primap2 as pm2
-
-from unfccc_ghg_data.helper import (
-    downloaded_data_path,
-    extracted_data_path,
-    process_data_for_country,
-)
-
-from .config_tha_bur4 import (
+from config_tha_bur4 import (
     cat_codes_manual_main_sector_ts,
     cat_conversion,
     coords_cols,
@@ -49,6 +42,12 @@ 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