pypsa-eur/scripts/retrieve_databundle.py

20 lines
495 B
Python
Raw Normal View History

2019-11-06 11:04:01 +00:00
## Copyright 2019 Fabian Hofmann (FIAS)
2019-11-05 11:53:21 +00:00
import logging, os, tarfile
from _helpers import progress_retrieve
logger = logging.getLogger(__name__)
if snakemake.config['tutorial']:
url = "https://zenodo.org/record/3517921/files/pypsa-eur-tutorial-data-bundle.tar.xz"
else:
2019-11-06 11:04:01 +00:00
url = "https://zenodo.org/record/3517935/files/pypsa-eur-data-bundle.tar.xz"
2019-11-05 11:53:21 +00:00
2019-11-06 11:04:01 +00:00
tarball_fn = "./bundle.tar.xz"
2019-11-05 11:53:21 +00:00
2019-11-06 11:04:01 +00:00
progress_retrieve(url, tarball_fn)
2019-11-05 11:53:21 +00:00
2019-11-06 11:04:01 +00:00
tarfile.open(tarball_fn).extractall('./data')
2019-11-05 11:53:21 +00:00
2019-11-06 11:04:01 +00:00
os.remove(tarball_fn)