diff --git a/scripts/retrieve_cutout.py b/scripts/retrieve_cutout.py index b1461ded..fb33a9d5 100644 --- a/scripts/retrieve_cutout.py +++ b/scripts/retrieve_cutout.py @@ -1,10 +1,4 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Mon Nov 4 18:37:11 2019 - -@author: fabian -""" +## Copyright 2019 Fabian Hofmann (FIAS) import logging, os, tarfile from _helpers import progress_retrieve @@ -12,15 +6,14 @@ from _helpers import progress_retrieve logger = logging.getLogger(__name__) if snakemake.config['tutorial']: - url = "https://zenodo.org/record/3518020/files/pypsa-eur-tutorial-cutouts.tar.xz" + url = "https://zenodo.org/record/3518020/files/pypsa-eur-tutorial-cutouts.tar.xz" else: - url = "https://zenodo.org/record/3517949/files/pypsa-eur-cutouts.tar.xz" + url = "https://zenodo.org/record/3517949/files/pypsa-eur-cutouts.tar.xz" -file = "./cutouts.tar.xz" +tarball_fn = "./cutouts.tar.xz" -progress_retrieve(url, file) +progress_retrieve(url, tarball_fn) -# extract -tarfile.open('./cutouts.tar.xz').extractall() -os.remove("./cutouts.tar.xz") +tarfile.open(tarball_fn).extractall() +os.remove(tarball_fn) diff --git a/scripts/retrieve_databundle.py b/scripts/retrieve_databundle.py index 9296388c..f402e237 100644 --- a/scripts/retrieve_databundle.py +++ b/scripts/retrieve_databundle.py @@ -1,28 +1,19 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Mon Nov 4 18:37:11 2019 - -@author: fabian -""" +## Copyright 2019 Fabian Hofmann (FIAS) 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: - url = "https://zenodo.org/record/3517935/files/pypsa-eur-data-bundle.tar.xz" + url = "https://zenodo.org/record/3517935/files/pypsa-eur-data-bundle.tar.xz" -file = "./bundle.tar.xz" +tarball_fn = "./bundle.tar.xz" -progress_retrieve(url, file) +progress_retrieve(url, tarball_fn) -# extract -tarfile.open('./bundle.tar.xz').extractall('./data') - -os.remove("./bundle.tar.xz") +tarfile.open(tarball_fn).extractall('./data') +os.remove(tarball_fn) diff --git a/scripts/retrieve_natura_raster.py b/scripts/retrieve_natura_raster.py index 98c1ae37..fd0f9332 100644 --- a/scripts/retrieve_natura_raster.py +++ b/scripts/retrieve_natura_raster.py @@ -1,10 +1,4 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Mon Nov 4 18:37:11 2019 - -@author: fabian -""" +## Copyright 2019 Fabian Hofmann (FIAS) import logging, os from _helpers import progress_retrieve @@ -15,7 +9,6 @@ d = './resources' if not os.path.exists(d): os.makedirs(d) -url = "https://zenodo.org/record/3518215/files/natura.tiff" -file = "resources/natura.tiff" -progress_retrieve(url, file) - +progress_retrieve("https://zenodo.org/record/3518215/files/natura.tiff", + "resources/natura.tiff") + \ No newline at end of file