Bläddra i källkod

Some work on docs

Johannes Gütschow 10 månader sedan
förälder
incheckning
55e6dae5c3

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

@@ -59,3 +59,9 @@ fix\_rows
 =========
 
 .. autofunction:: fix_rows
+
+
+make\_wide\_table
+=================
+
+.. autofunction:: make_wide_table

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

@@ -0,0 +1,13 @@
+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

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

@@ -13,3 +13,4 @@ unfccc\_ghg\_data.helper
   unfccc_ghg_data.helper.definitions
   unfccc_ghg_data.helper.folder_mapping
   unfccc_ghg_data.helper.functions
+  unfccc_ghg_data.helper.functions_temp

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 404 - 360
poetry.lock


+ 2 - 2
pyproject.toml

@@ -7,10 +7,10 @@ readme = "README.md"
 packages = [{include = "unfccc_ghg_data", from = "src"}]
 
 [tool.poetry.dependencies]
-python = ">=3.8, <3.11"
+python = ">=3.9, <3.11"
 matplotlib = { version = "^3.7.1", optional = true }
 doit = "^0.36.0"
-primap2 = "^0.9.8"
+primap2 = ">=0.9.8"
 pycountry = "^22.3.5"
 datalad = "^0.19.3"
 treelib = "^1.7.0"

+ 8 - 1
src/unfccc_ghg_data/unfccc_downloader/__init__.py

@@ -1,5 +1,12 @@
-from .unfccc_submission_info import get_unfccc_submission_info
+"""
+Download submissions from the UNFCCC website
+
+Collection of scripts and helper functions to download different types of sumbissions
+from the UNFCCC website.
+"""
+from .unfccc_submission_info import get_BTR_name_and_URL, get_unfccc_submission_info
 
 __all__ = [
     "get_unfccc_submission_info",
+    "get_BTR_name_and_URL",
 ]

+ 1 - 1
src/unfccc_ghg_data/unfccc_downloader/download_btr.py

@@ -14,9 +14,9 @@ import pandas as pd
 import requests
 from selenium.webdriver import Firefox
 from selenium.webdriver.firefox.options import Options
-from unfccc_submission_info import get_BTR_name_and_URL
 
 from unfccc_ghg_data.helper import downloaded_data_path_UNFCCC, root_path
+from unfccc_ghg_data.unfccc_downloader import get_BTR_name_and_URL
 
 ###############
 #

+ 4 - 1
src/unfccc_ghg_data/unfccc_downloader/fetch_submissions_btr.py

@@ -10,9 +10,12 @@ import pandas as pd
 from bs4 import BeautifulSoup
 from selenium.webdriver import Firefox
 from selenium.webdriver.firefox.options import Options
-from unfccc_submission_info import get_BTR_name_and_URL, get_unfccc_submission_info
 
 from unfccc_ghg_data.helper import downloaded_data_path_UNFCCC
+from unfccc_ghg_data.unfccc_downloader import (
+    get_BTR_name_and_URL,
+    get_unfccc_submission_info,
+)
 
 max_tries = 10
 

+ 8 - 4
src/unfccc_ghg_data/unfccc_downloader/fetch_submissions_bur.py

@@ -1,4 +1,6 @@
 """
+Download BURs for non-AnnexI countries
+
 Download UNFCCC Biennial Update Report submissions
 from Non-Annex I Parties and create list of submissions as CSV file
 Based on `process_bur` from national-inventory-submissions
@@ -67,7 +69,7 @@ if __name__ == "__main__":
 
     # Go through sub-pages.
     for target in targets:
-        time.sleep(randrange(5, 15))
+        time.sleep(randrange(5, 15))  # noqa: S311
         url = target["url"]
 
         submission_info = get_unfccc_submission_info(url, driver, 10)
@@ -81,6 +83,8 @@ if __name__ == "__main__":
         print("No downloads for ", no_downloads)
 
     driver.close()
-    df = pd.DataFrame(downloads)
-    df = df[["Kind", "Country", "Title", "URL"]]
-    df.to_csv(downloaded_data_path_UNFCCC / "submissions-bur.csv", index=False)
+    df_downloads = pd.DataFrame(downloads)
+    df_downloads = df_downloads[["Kind", "Country", "Title", "URL"]]
+    df_downloads.to_csv(
+        downloaded_data_path_UNFCCC / "submissions-bur.csv", index=False
+    )

Vissa filer visades inte eftersom för många filer har ändrats