diff --git a/pymrio/aux/GLAM/GLAMprocessing.py b/pymrio/aux/GLAM/GLAMprocessing.py new file mode 100644 index 00000000..ca8e6087 --- /dev/null +++ b/pymrio/aux/GLAM/GLAMprocessing.py @@ -0,0 +1,54 @@ +""" Function for getting and processing GLAM data. + +""" + +from pathlib import Path +from pymrio.tools.iodownloader import _download_urls +from pymrio.tools.iometadata import MRIOMetaData + + +GLAM_CONFIG = { + "V2024.10": "https://www.lifecycleinitiative.org/wp-content/uploads/2024/10/V1.0.2024.10.zip" + } + +def get_GLAM(storage_folder, overwrite_existing=False, version="V2024.10"): + """ Download GLAM and store in the given directory + + Parameters + ---------- + storage_folder : str or Path + Folder to store the downloaded GLAM data + + overwrite_existing : bool, optional + If True, overwrite existing data, by default False + + version : str, optional + Version of the GLAM data to download, by default "V2024.10" + Version must be a key in the GLAM_CONFIG or can alternatively + be a url to the zip file to download. + """ + + if type(storage_folder) is str: + storage_folder = Path(storage_folder) + storage_folder.mkdir(exist_ok=True, parents=True) + + downlog = MRIOMetaData._make_download_log( + location=storage_folder, + description="GLAM download", + name="GLAM", + system="impact assessment", + version=version, + ) + + requested_urls = [GLAM_CONFIG.get(version, version)] + + downlog = _download_urls( + url_list=requested_urls, + storage_folder=storage_folder, + overwrite_existing=overwrite_existing, + downlog_handler=downlog, + ) + + downlog.save() + return downlog + diff --git a/pymrio/aux/GLAM/__init__.py b/pymrio/aux/GLAM/__init__.py new file mode 100644 index 00000000..f4c38f74 --- /dev/null +++ b/pymrio/aux/GLAM/__init__.py @@ -0,0 +1 @@ +# Data and processing for linking with GLAM