diff --git a/Snakefile b/Snakefile index 7e22d980..6933447b 100644 --- a/Snakefile +++ b/Snakefile @@ -12,6 +12,14 @@ wildcard_constraints: rule all: input: "results/summaries/costs2-summary.csv" +rule solve_all_elec_networks: + input: + expand("results/networks/elec_s{simpl}_{clusters}_lv{lv}_{opts}.nc", + simpl='', + clusters=config['scenario']['clusters'], + lv='1.5', + opts=config['scenario']['opts']) + rule prepare_links_p_nom: output: 'data/links_p_nom.csv' threads: 1 diff --git a/config.yaml b/config.yaml index b5c28bdd..3c737600 100644 --- a/config.yaml +++ b/config.yaml @@ -5,7 +5,7 @@ scenario: sectors: [E] # ,E+EV,E+BEV,E+BEV+V2G] # [ E+EV, E+BEV, E+BEV+V2G ] lv: [1., 1.125, 1.25, 1.5, 2.0, 3.0] clusters: [45, 64, 90, 128, 181, 256, 362] # (2**np.r_[5.5:9:.5]).astype(int) - opts: [Co2L] #, LC-FL, LC-T, Ep-T, Co2L-T] + opts: [Co2L-3H] #, LC-FL, LC-T, Ep-T, Co2L-T] countries: ['AL', 'AT', 'BA', 'BE', 'BG', 'CH', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HR', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV', 'ME', 'MK', 'NL', 'NO', 'PL', 'PT', 'RO', 'RS', 'SE', 'SI', 'SK'] diff --git a/scripts/prepare_network.py b/scripts/prepare_network.py index b780a186..7a514322 100644 --- a/scripts/prepare_network.py +++ b/scripts/prepare_network.py @@ -15,9 +15,6 @@ import geopandas as gpd import pypsa - -def normed(s): return s/s.sum() - def add_co2limit(n, Nyears=1.): n.add("GlobalConstraint", "CO2Limit", carrier_attribute="co2_emissions", sense="<=", @@ -87,14 +84,13 @@ def average_every_nhours(n, offset): if __name__ == "__main__": # Detect running outside of snakemake and mock snakemake for testing if 'snakemake' not in globals(): - from vresutils import Dict - import yaml - snakemake = Dict() - with open('../config.yaml') as f: - snakemake.config = yaml.load(f) - snakemake.wildcards = Dict(clusters='37', lv='2', opts='Co2L') - snakemake.input = ['../networks/elec_37.nc'] - snakemake.output = ['../networks/elec_37_lv2_Co2L.nc'] + from vresutils.snakemake import MockSnakemake + snakemake = MockSnakemake( + path='..', + wildcards=dict(network='elec', simpl='', clusters='37', lv='2', opts='Co2L-3H'), + input=['networks/{network}_s{simpl}_{clusters}.nc'], + output=['networks/{network}_s{simpl}_{clusters}_lv{lv}_{opts}.nc'] + ) logger.setLevel(snakemake.config['logging_level'])