From 6cde3e902be0b3880e11b7e769313ff7dfb01fc2 Mon Sep 17 00:00:00 2001 From: JanFrederickUnnewehr <50404069+JanFrederickUnnewehr@users.noreply.github.com> Date: Tue, 19 Nov 2019 09:56:44 -0500 Subject: [PATCH] own databundle (#96) * config.default.yaml * retrieve_databundle: docs, config and defaults * fix capitalisation of true/false --- Snakefile | 16 +++++++++------- config.default.yaml | 3 ++- config.tutorial.yaml | 1 + doc/configtables/toplevel.csv | 1 + test/config.test1.yaml | 1 + 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Snakefile b/Snakefile index f9251ff7..6179e8f3 100644 --- a/Snakefile +++ b/Snakefile @@ -24,7 +24,7 @@ rule solve_all_elec_networks: expand("results/networks/elec_s{simpl}_{clusters}_l{ll}_{opts}.nc", **config['scenario']) -if config['enable']['prepare_links_p_nom']: +if config['enable'].get('prepare_links_p_nom', False): rule prepare_links_p_nom: output: 'data/links_p_nom.csv' threads: 1 @@ -39,12 +39,14 @@ datafiles = ['ch_cantons.csv', 'je-e-21.03.02.xls', 'NUTS_2013_60M_SH/data/NUTS_RG_60M_2013.shp', 'nama_10r_3popgdp.tsv.gz', 'nama_10r_3gdp.tsv.gz', 'time_series_60min_singleindex_filtered.csv', 'corine/g250_clc06_V18_5.tif'] -if not config['tutorial']: + +if not config.get('tutorial', False): datafiles.extend(["natura/Natura2000_end2015.shp", "GEBCO_2014_2D.nc"]) -rule retrieve_databundle: - output: expand('data/bundle/{file}', file=datafiles) - script: 'scripts/retrieve_databundle.py' +if config['enable'].get('retrieve_databundle', True): + rule retrieve_databundle: + output: expand('data/bundle/{file}', file=datafiles) + script: 'scripts/retrieve_databundle.py' rule build_powerplants: input: @@ -107,7 +109,7 @@ rule build_bus_regions: # group: 'nonfeedin_preparation' script: "scripts/build_bus_regions.py" -if config['enable']['build_cutout']: +if config['enable'].get('build_cutout', False): rule build_cutout: output: directory("cutouts/{cutout}") resources: mem=config['atlite'].get('nprocesses', 4) * 1000 @@ -121,7 +123,7 @@ else: script: 'scripts/retrieve_cutout.py' -if config['enable']['build_natura_raster']: +if config['enable'].get('build_natura_raster', False): rule build_natura_raster: input: natura="data/bundle/natura/Natura2000_end2015.shp", diff --git a/config.default.yaml b/config.default.yaml index f210ca02..5fa8fd77 100644 --- a/config.default.yaml +++ b/config.default.yaml @@ -20,6 +20,7 @@ snapshots: enable: prepare_links_p_nom: false + retrieve_databundle: true build_cutout: false build_natura_raster: false @@ -333,4 +334,4 @@ plotting: H2: "Hydrogen\nStorage" lines: "Transmission\nlines" ror: "Run of\nriver" - \ No newline at end of file + diff --git a/config.tutorial.yaml b/config.tutorial.yaml index e753a756..0e383cd9 100644 --- a/config.tutorial.yaml +++ b/config.tutorial.yaml @@ -20,6 +20,7 @@ snapshots: enable: prepare_links_p_nom: false + retrieve_databundle: true build_cutout: false build_natura_raster: false diff --git a/doc/configtables/toplevel.csv b/doc/configtables/toplevel.csv index 14be22d2..63db0ef4 100644 --- a/doc/configtables/toplevel.csv +++ b/doc/configtables/toplevel.csv @@ -7,5 +7,6 @@ countries,--,"Subset of {'AL', 'AT', 'BA', 'BE', 'BG', 'CH', 'CZ', 'DE', 'DK', ' focus_weights,--,"Keys should be two-digit country codes (e.g. DE) and values should range between 0 and 1","Ratio of total clusters for particular countries. the remaining weight is distributed according to mean load. An example: ``focus_weights: DE: 0.6 FR: 0.2``." enable,,, -- prepare_links_p_nom,bool,"{true, false}","Switch to retrieve current HVDC projects from `Wikipedia `_" +-- retrieve_databundle,bool,"{true, false}","Switch to retrieve databundle from zenodo via the rule :mod:`retrieve_databundle` or whether to keep a custom databundle located in the corresponding folder. -- build_cutout,bool,"{true, false}","Switch to build cutouts via the rule :mod:`build_cutout` or whether to retrieve the data from zenodo with :mod:`retrieve_cutout`." -- build_natura_raster,bool,"{true, false}","Switch to create raster ``natura.tiff`` via the rule :mod:`build_natura_raster` or whether to retrieve ``natura.tiff`` from zenodo with :mod:`retrieve_natura_raster`." \ No newline at end of file diff --git a/test/config.test1.yaml b/test/config.test1.yaml index 98343453..a0429805 100644 --- a/test/config.test1.yaml +++ b/test/config.test1.yaml @@ -20,6 +20,7 @@ snapshots: enable: prepare_links_p_nom: false + retrieve_databundle: true build_cutout: false build_natura_raster: false