retrieve*: clean retrieve rules
This commit is contained in:
parent
3597f931cf
commit
0c537f159f
@ -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
|
||||
@ -16,11 +10,10 @@ if snakemake.config['tutorial']:
|
||||
else:
|
||||
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)
|
||||
|
@ -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"
|
||||
|
||||
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)
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user