pypsa-eur/scripts/retrieve_cutout.py

20 lines
480 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']:
2019-11-06 11:04:01 +00:00
url = "https://zenodo.org/record/3518020/files/pypsa-eur-tutorial-cutouts.tar.xz"
2019-11-05 11:53:21 +00:00
else:
2019-11-06 11:04:01 +00:00
url = "https://zenodo.org/record/3517949/files/pypsa-eur-cutouts.tar.xz"
2019-11-05 11:53:21 +00:00
2019-11-06 11:04:01 +00:00
tarball_fn = "./cutouts.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()
2019-11-05 11:53:21 +00:00
2019-11-06 11:04:01 +00:00
os.remove(tarball_fn)