Skip to content

Commit

Permalink
added headers to downlowd functions
Browse files Browse the repository at this point in the history
  • Loading branch information
konstantinstadler committed Nov 6, 2024
1 parent 1543458 commit dfce07a
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
54 changes: 54 additions & 0 deletions pymrio/aux/GLAM/GLAMprocessing.py
Original file line number Diff line number Diff line change
@@ -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

1 change: 1 addition & 0 deletions pymrio/aux/GLAM/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Data and processing for linking with GLAM

0 comments on commit dfce07a

Please sign in to comment.