2019-11-28 15:33:33 +00:00
|
|
|
from os.path import normpath, exists
|
|
|
|
from shutil import copyfile
|
|
|
|
|
|
|
|
if not exists("config.yaml"):
|
|
|
|
copyfile("config.default.yaml", "config.yaml")
|
2019-11-22 14:13:46 +00:00
|
|
|
|
2017-12-18 19:34:15 +00:00
|
|
|
configfile: "config.yaml"
|
|
|
|
|
2018-10-25 14:43:24 +00:00
|
|
|
COSTS="data/costs.csv"
|
|
|
|
|
2017-12-18 19:34:15 +00:00
|
|
|
wildcard_constraints:
|
2019-02-22 16:08:43 +00:00
|
|
|
ll="(v|c)([0-9\.]+|opt|all)|all", # line limit, can be volume or cost
|
2018-10-26 08:28:54 +00:00
|
|
|
simpl="[a-zA-Z0-9]*|all",
|
|
|
|
clusters="[0-9]+m?|all",
|
2017-12-18 19:34:15 +00:00
|
|
|
sectors="[+a-zA-Z0-9]+",
|
2019-06-18 09:50:54 +00:00
|
|
|
opts="[-+a-zA-Z0-9\.]*"
|
2017-12-18 19:34:15 +00:00
|
|
|
|
2018-10-22 21:27:18 +00:00
|
|
|
rule cluster_all_elec_networks:
|
2019-02-03 13:00:45 +00:00
|
|
|
input:
|
|
|
|
expand("networks/elec_s{simpl}_{clusters}.nc",
|
|
|
|
**config['scenario'])
|
|
|
|
|
2020-01-09 13:09:28 +00:00
|
|
|
rule extra_components_all_elec_networks:
|
|
|
|
input:
|
|
|
|
expand("networks/elec_s{simpl}_{clusters}_ec.nc",
|
|
|
|
**config['scenario'])
|
|
|
|
|
2019-02-03 13:00:45 +00:00
|
|
|
rule prepare_all_elec_networks:
|
2018-10-22 21:27:18 +00:00
|
|
|
input:
|
2019-11-19 18:36:28 +00:00
|
|
|
expand("networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
|
2018-10-22 21:27:18 +00:00
|
|
|
**config['scenario'])
|
2017-12-18 19:34:15 +00:00
|
|
|
|
2018-01-30 22:48:29 +00:00
|
|
|
rule solve_all_elec_networks:
|
|
|
|
input:
|
2019-11-19 18:36:28 +00:00
|
|
|
expand("results/networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
|
2018-02-10 16:19:46 +00:00
|
|
|
**config['scenario'])
|
2018-01-30 22:48:29 +00:00
|
|
|
|
2019-11-19 14:56:44 +00:00
|
|
|
if config['enable'].get('prepare_links_p_nom', False):
|
2018-08-13 12:09:20 +00:00
|
|
|
rule prepare_links_p_nom:
|
|
|
|
output: 'data/links_p_nom.csv'
|
2019-11-28 07:22:52 +00:00
|
|
|
log: 'logs/prepare_links_p_nom.log'
|
2018-08-13 12:09:20 +00:00
|
|
|
threads: 1
|
2018-09-20 12:26:38 +00:00
|
|
|
resources: mem=500
|
2018-10-26 16:39:09 +00:00
|
|
|
# group: 'nonfeedin_preparation'
|
2018-08-13 12:09:20 +00:00
|
|
|
script: 'scripts/prepare_links_p_nom.py'
|
|
|
|
|
2019-11-05 11:53:21 +00:00
|
|
|
|
|
|
|
datafiles = ['ch_cantons.csv', 'je-e-21.03.02.xls',
|
|
|
|
'eez/World_EEZ_v8_2014.shp', 'EIA_hydro_generation_2000_2014.csv',
|
|
|
|
'hydro_capacities.csv', 'naturalearth/ne_10m_admin_0_countries.shp',
|
|
|
|
'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']
|
2019-11-19 14:56:44 +00:00
|
|
|
|
|
|
|
if not config.get('tutorial', False):
|
2019-11-06 16:50:57 +00:00
|
|
|
datafiles.extend(["natura/Natura2000_end2015.shp", "GEBCO_2014_2D.nc"])
|
2019-11-05 11:53:21 +00:00
|
|
|
|
2019-11-19 14:56:44 +00:00
|
|
|
if config['enable'].get('retrieve_databundle', True):
|
|
|
|
rule retrieve_databundle:
|
|
|
|
output: expand('data/bundle/{file}', file=datafiles)
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/retrieve_databundle.log"
|
2019-11-19 14:56:44 +00:00
|
|
|
script: 'scripts/retrieve_databundle.py'
|
2019-11-05 11:53:21 +00:00
|
|
|
|
2019-10-31 15:45:13 +00:00
|
|
|
rule build_powerplants:
|
2019-11-06 14:59:34 +00:00
|
|
|
input:
|
|
|
|
base_network="networks/base.nc",
|
|
|
|
custom_powerplants="data/custom_powerplants.csv"
|
2019-10-31 15:45:13 +00:00
|
|
|
output: "resources/powerplants.csv"
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/build_powerplants.log"
|
2019-10-31 15:45:13 +00:00
|
|
|
threads: 1
|
|
|
|
resources: mem=500
|
|
|
|
# group: 'nonfeedin_preparation'
|
|
|
|
script: "scripts/build_powerplants.py"
|
2017-12-18 19:34:15 +00:00
|
|
|
|
|
|
|
rule base_network:
|
|
|
|
input:
|
|
|
|
eg_buses='data/entsoegridkit/buses.csv',
|
|
|
|
eg_lines='data/entsoegridkit/lines.csv',
|
|
|
|
eg_links='data/entsoegridkit/links.csv',
|
|
|
|
eg_converters='data/entsoegridkit/converters.csv',
|
|
|
|
eg_transformers='data/entsoegridkit/transformers.csv',
|
|
|
|
parameter_corrections='data/parameter_corrections.yaml',
|
2018-08-03 09:49:23 +00:00
|
|
|
links_p_nom='data/links_p_nom.csv',
|
2018-09-24 18:19:47 +00:00
|
|
|
links_tyndp='data/links_tyndp.csv',
|
2018-08-03 09:49:23 +00:00
|
|
|
country_shapes='resources/country_shapes.geojson',
|
|
|
|
offshore_shapes='resources/offshore_shapes.geojson',
|
|
|
|
europe_shape='resources/europe_shape.geojson'
|
2018-01-29 21:28:33 +00:00
|
|
|
output: "networks/base.nc"
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/base_network.log"
|
2018-01-29 21:28:33 +00:00
|
|
|
benchmark: "benchmarks/base_network"
|
2017-12-18 19:34:15 +00:00
|
|
|
threads: 1
|
2018-09-20 12:26:38 +00:00
|
|
|
resources: mem=500
|
2018-10-26 16:39:09 +00:00
|
|
|
# group: 'nonfeedin_preparation'
|
2017-12-18 19:34:15 +00:00
|
|
|
script: "scripts/base_network.py"
|
|
|
|
|
2018-08-03 09:49:23 +00:00
|
|
|
rule build_shapes:
|
|
|
|
input:
|
|
|
|
naturalearth='data/bundle/naturalearth/ne_10m_admin_0_countries.shp',
|
|
|
|
eez='data/bundle/eez/World_EEZ_v8_2014.shp',
|
|
|
|
nuts3='data/bundle/NUTS_2013_60M_SH/data/NUTS_RG_60M_2013.shp',
|
|
|
|
nuts3pop='data/bundle/nama_10r_3popgdp.tsv.gz',
|
|
|
|
nuts3gdp='data/bundle/nama_10r_3gdp.tsv.gz',
|
|
|
|
ch_cantons='data/bundle/ch_cantons.csv',
|
|
|
|
ch_popgdp='data/bundle/je-e-21.03.02.xls'
|
|
|
|
output:
|
|
|
|
country_shapes='resources/country_shapes.geojson',
|
|
|
|
offshore_shapes='resources/offshore_shapes.geojson',
|
|
|
|
europe_shape='resources/europe_shape.geojson',
|
|
|
|
nuts3_shapes='resources/nuts3_shapes.geojson'
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/build_shapes.log"
|
2018-08-03 09:49:23 +00:00
|
|
|
threads: 1
|
2018-09-20 12:26:38 +00:00
|
|
|
resources: mem=500
|
2018-10-26 16:39:09 +00:00
|
|
|
# group: 'nonfeedin_preparation'
|
2018-08-03 09:49:23 +00:00
|
|
|
script: "scripts/build_shapes.py"
|
|
|
|
|
2018-01-29 21:28:33 +00:00
|
|
|
rule build_bus_regions:
|
2017-12-18 19:34:15 +00:00
|
|
|
input:
|
2018-08-03 09:49:23 +00:00
|
|
|
country_shapes='resources/country_shapes.geojson',
|
|
|
|
offshore_shapes='resources/offshore_shapes.geojson',
|
2018-01-29 21:28:33 +00:00
|
|
|
base_network="networks/base.nc"
|
|
|
|
output:
|
|
|
|
regions_onshore="resources/regions_onshore.geojson",
|
|
|
|
regions_offshore="resources/regions_offshore.geojson"
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/build_bus_regions.log"
|
2018-09-20 12:26:38 +00:00
|
|
|
resources: mem=1000
|
2018-10-26 16:39:09 +00:00
|
|
|
# group: 'nonfeedin_preparation'
|
2018-01-29 21:28:33 +00:00
|
|
|
script: "scripts/build_bus_regions.py"
|
|
|
|
|
2019-11-19 14:56:44 +00:00
|
|
|
if config['enable'].get('build_cutout', False):
|
2019-11-05 11:53:21 +00:00
|
|
|
rule build_cutout:
|
|
|
|
output: directory("cutouts/{cutout}")
|
2019-12-09 20:29:15 +00:00
|
|
|
log: "logs/build_cutout/{cutout}.log"
|
2019-11-05 11:53:21 +00:00
|
|
|
resources: mem=config['atlite'].get('nprocesses', 4) * 1000
|
|
|
|
threads: config['atlite'].get('nprocesses', 4)
|
|
|
|
benchmark: "benchmarks/build_cutout_{cutout}"
|
|
|
|
# group: 'feedin_preparation'
|
|
|
|
script: "scripts/build_cutout.py"
|
2020-03-16 14:51:47 +00:00
|
|
|
|
|
|
|
if config['enable'].get('retrieve_cutout', True):
|
2019-11-05 11:53:21 +00:00
|
|
|
rule retrieve_cutout:
|
2019-11-11 15:51:25 +00:00
|
|
|
output: directory(expand("cutouts/{cutouts}", **config['atlite'])),
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/retrieve_cutout.log"
|
2019-11-05 11:53:21 +00:00
|
|
|
script: 'scripts/retrieve_cutout.py'
|
|
|
|
|
2018-08-03 09:54:28 +00:00
|
|
|
|
2019-11-19 14:56:44 +00:00
|
|
|
if config['enable'].get('build_natura_raster', False):
|
2019-11-05 11:53:21 +00:00
|
|
|
rule build_natura_raster:
|
2019-11-11 15:29:27 +00:00
|
|
|
input:
|
|
|
|
natura="data/bundle/natura/Natura2000_end2015.shp",
|
|
|
|
cutouts=expand("cutouts/{cutouts}", **config['atlite'])
|
2019-11-05 11:53:21 +00:00
|
|
|
output: "resources/natura.tiff"
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/build_natura_raster.log"
|
2019-11-05 11:53:21 +00:00
|
|
|
script: "scripts/build_natura_raster.py"
|
2020-03-16 14:51:47 +00:00
|
|
|
|
|
|
|
if config['enable'].get('retrieve_natura_raster', True):
|
2019-11-05 11:53:21 +00:00
|
|
|
rule retrieve_natura_raster:
|
|
|
|
output: "resources/natura.tiff"
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/retrieve_natura_raster.log"
|
2019-11-05 11:53:21 +00:00
|
|
|
script: 'scripts/retrieve_natura_raster.py'
|
2017-12-18 19:34:15 +00:00
|
|
|
|
2018-01-29 21:28:33 +00:00
|
|
|
rule build_renewable_profiles:
|
2017-12-18 19:34:15 +00:00
|
|
|
input:
|
2018-01-29 21:28:33 +00:00
|
|
|
base_network="networks/base.nc",
|
2018-12-10 17:40:54 +00:00
|
|
|
corine="data/bundle/corine/g250_clc06_V18_5.tif",
|
|
|
|
natura="resources/natura.tiff",
|
2019-10-03 10:32:49 +00:00
|
|
|
gebco=lambda wildcards: ("data/bundle/GEBCO_2014_2D.nc"
|
|
|
|
if "max_depth" in config["renewable"][wildcards.technology].keys()
|
|
|
|
else []),
|
2018-12-10 17:40:54 +00:00
|
|
|
country_shapes='resources/country_shapes.geojson',
|
2018-12-11 16:30:25 +00:00
|
|
|
offshore_shapes='resources/offshore_shapes.geojson',
|
2018-01-29 21:28:33 +00:00
|
|
|
regions=lambda wildcards: ("resources/regions_onshore.geojson"
|
|
|
|
if wildcards.technology in ('onwind', 'solar')
|
2018-08-03 09:54:28 +00:00
|
|
|
else "resources/regions_offshore.geojson"),
|
2018-08-06 19:38:36 +00:00
|
|
|
cutout=lambda wildcards: "cutouts/" + config["renewable"][wildcards.technology]['cutout']
|
2018-12-10 17:40:54 +00:00
|
|
|
output: profile="resources/profile_{technology}.nc",
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/build_renewable_profile_{technology}.log"
|
2018-12-10 17:40:54 +00:00
|
|
|
resources: mem=config['atlite'].get('nprocesses', 2) * 5000
|
|
|
|
threads: config['atlite'].get('nprocesses', 2)
|
2018-02-19 09:16:29 +00:00
|
|
|
benchmark: "benchmarks/build_renewable_profiles_{technology}"
|
2018-10-26 16:39:09 +00:00
|
|
|
# group: 'feedin_preparation'
|
2018-01-29 21:28:33 +00:00
|
|
|
script: "scripts/build_renewable_profiles.py"
|
2017-12-18 19:34:15 +00:00
|
|
|
|
2019-10-03 10:32:49 +00:00
|
|
|
if 'hydro' in config['renewable'].keys():
|
|
|
|
rule build_hydro_profile:
|
|
|
|
input:
|
|
|
|
country_shapes='resources/country_shapes.geojson',
|
|
|
|
eia_hydro_generation='data/bundle/EIA_hydro_generation_2000_2014.csv',
|
|
|
|
cutout="cutouts/" + config["renewable"]['hydro']['cutout']
|
|
|
|
output: 'resources/profile_hydro.nc'
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/build_hydro_profile.log"
|
2019-10-03 10:32:49 +00:00
|
|
|
resources: mem=5000
|
|
|
|
# group: 'feedin_preparation'
|
|
|
|
script: 'scripts/build_hydro_profile.py'
|
2017-12-18 19:34:15 +00:00
|
|
|
|
|
|
|
rule add_electricity:
|
|
|
|
input:
|
2018-01-29 21:28:33 +00:00
|
|
|
base_network='networks/base.nc',
|
2018-10-25 14:43:24 +00:00
|
|
|
tech_costs=COSTS,
|
2018-01-29 21:28:33 +00:00
|
|
|
regions="resources/regions_onshore.geojson",
|
2018-02-10 16:16:20 +00:00
|
|
|
powerplants='resources/powerplants.csv',
|
2018-08-03 09:53:14 +00:00
|
|
|
hydro_capacities='data/bundle/hydro_capacities.csv',
|
2018-11-12 20:43:33 +00:00
|
|
|
geth_hydro_capacities='data/geth2015_hydro_capacities.csv',
|
2018-08-03 09:53:14 +00:00
|
|
|
opsd_load='data/bundle/time_series_60min_singleindex_filtered.csv',
|
|
|
|
nuts3_shapes='resources/nuts3_shapes.geojson',
|
2018-01-29 21:28:33 +00:00
|
|
|
**{'profile_' + t: "resources/profile_" + t + ".nc"
|
|
|
|
for t in config['renewable']}
|
|
|
|
output: "networks/elec.nc"
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/add_electricity.log"
|
2018-01-29 21:28:33 +00:00
|
|
|
benchmark: "benchmarks/add_electricity"
|
2017-12-18 19:34:15 +00:00
|
|
|
threads: 1
|
2018-09-20 12:26:38 +00:00
|
|
|
resources: mem=3000
|
2018-10-26 16:39:09 +00:00
|
|
|
# group: 'build_pypsa_networks'
|
2017-12-18 19:34:15 +00:00
|
|
|
script: "scripts/add_electricity.py"
|
|
|
|
|
2018-01-30 22:11:16 +00:00
|
|
|
rule simplify_network:
|
2018-01-29 21:28:33 +00:00
|
|
|
input:
|
|
|
|
network='networks/{network}.nc',
|
2018-10-27 01:41:38 +00:00
|
|
|
tech_costs=COSTS,
|
2018-01-29 21:28:33 +00:00
|
|
|
regions_onshore="resources/regions_onshore.geojson",
|
|
|
|
regions_offshore="resources/regions_offshore.geojson"
|
|
|
|
output:
|
2018-01-30 22:11:16 +00:00
|
|
|
network='networks/{network}_s{simpl}.nc',
|
|
|
|
regions_onshore="resources/regions_onshore_{network}_s{simpl}.geojson",
|
2018-07-10 14:31:57 +00:00
|
|
|
regions_offshore="resources/regions_offshore_{network}_s{simpl}.geojson",
|
|
|
|
clustermaps='resources/clustermaps_{network}_s{simpl}.h5'
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/simplify_network/{network}_s{simpl}.log"
|
2018-01-30 22:11:16 +00:00
|
|
|
benchmark: "benchmarks/simplify_network/{network}_s{simpl}"
|
|
|
|
threads: 1
|
2018-09-20 12:26:38 +00:00
|
|
|
resources: mem=4000
|
2018-10-26 16:39:09 +00:00
|
|
|
# group: 'build_pypsa_networks'
|
2018-01-30 22:11:16 +00:00
|
|
|
script: "scripts/simplify_network.py"
|
|
|
|
|
|
|
|
rule cluster_network:
|
|
|
|
input:
|
|
|
|
network='networks/{network}_s{simpl}.nc',
|
|
|
|
regions_onshore="resources/regions_onshore_{network}_s{simpl}.geojson",
|
2018-07-10 14:31:57 +00:00
|
|
|
regions_offshore="resources/regions_offshore_{network}_s{simpl}.geojson",
|
2019-09-23 14:44:48 +00:00
|
|
|
clustermaps=ancient('resources/clustermaps_{network}_s{simpl}.h5'),
|
|
|
|
tech_costs=COSTS
|
2018-01-30 22:11:16 +00:00
|
|
|
output:
|
|
|
|
network='networks/{network}_s{simpl}_{clusters}.nc',
|
|
|
|
regions_onshore="resources/regions_onshore_{network}_s{simpl}_{clusters}.geojson",
|
2018-03-13 10:50:06 +00:00
|
|
|
regions_offshore="resources/regions_offshore_{network}_s{simpl}_{clusters}.geojson",
|
|
|
|
clustermaps='resources/clustermaps_{network}_s{simpl}_{clusters}.h5'
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/cluster_network/{network}_s{simpl}_{clusters}.log"
|
2018-01-30 22:11:16 +00:00
|
|
|
benchmark: "benchmarks/cluster_network/{network}_s{simpl}_{clusters}"
|
2018-01-29 21:28:33 +00:00
|
|
|
threads: 1
|
2018-09-20 12:26:38 +00:00
|
|
|
resources: mem=3000
|
2018-10-26 16:39:09 +00:00
|
|
|
# group: 'build_pypsa_networks'
|
2018-01-29 21:28:33 +00:00
|
|
|
script: "scripts/cluster_network.py"
|
|
|
|
|
2019-11-19 18:36:28 +00:00
|
|
|
|
|
|
|
rule add_extra_components:
|
|
|
|
input:
|
|
|
|
network='networks/{network}_s{simpl}_{clusters}.nc',
|
|
|
|
tech_costs=COSTS,
|
|
|
|
output: 'networks/{network}_s{simpl}_{clusters}_ec.nc'
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/add_extra_components/{network}_s{simpl}_{clusters}.log"
|
2019-11-19 18:36:28 +00:00
|
|
|
benchmark: "benchmarks/add_extra_components/{network}_s{simpl}_{clusters}_ec"
|
|
|
|
threads: 1
|
|
|
|
resources: mem=3000
|
|
|
|
# group: 'build_pypsa_networks'
|
|
|
|
script: "scripts/add_extra_components.py"
|
|
|
|
|
|
|
|
|
2018-01-29 21:28:33 +00:00
|
|
|
rule prepare_network:
|
2019-11-19 18:36:28 +00:00
|
|
|
input: 'networks/{network}_s{simpl}_{clusters}_ec.nc', tech_costs=COSTS
|
|
|
|
output: 'networks/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc'
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/prepare_network/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}.log"
|
2018-01-29 21:28:33 +00:00
|
|
|
threads: 1
|
2018-09-20 12:26:38 +00:00
|
|
|
resources: mem=1000
|
2019-11-19 18:36:28 +00:00
|
|
|
# benchmark: "benchmarks/prepare_network/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}"
|
2018-01-29 21:28:33 +00:00
|
|
|
script: "scripts/prepare_network.py"
|
|
|
|
|
2018-02-19 09:03:25 +00:00
|
|
|
def memory(w):
|
2018-10-22 21:28:56 +00:00
|
|
|
factor = 3.
|
|
|
|
for o in w.opts.split('-'):
|
|
|
|
m = re.match(r'^(\d+)h$', o, re.IGNORECASE)
|
|
|
|
if m is not None:
|
|
|
|
factor /= int(m.group(1))
|
|
|
|
break
|
2018-02-19 09:03:25 +00:00
|
|
|
if w.clusters.endswith('m'):
|
2018-10-22 21:28:56 +00:00
|
|
|
return int(factor * (18000 + 180 * int(w.clusters[:-1])))
|
2018-02-19 09:03:25 +00:00
|
|
|
else:
|
2019-02-06 10:46:39 +00:00
|
|
|
return int(factor * (10000 + 195 * int(w.clusters)))
|
2018-03-09 14:43:55 +00:00
|
|
|
# return 4890+310 * int(w.clusters)
|
2018-02-10 16:19:46 +00:00
|
|
|
|
2017-12-18 19:34:15 +00:00
|
|
|
rule solve_network:
|
2019-11-19 18:36:28 +00:00
|
|
|
input: "networks/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"
|
|
|
|
output: "results/networks/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"
|
2017-12-18 19:34:15 +00:00
|
|
|
shadow: "shallow"
|
|
|
|
log:
|
2019-11-28 07:22:52 +00:00
|
|
|
solver=normpath("logs/solve_network/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}_solver.log"),
|
|
|
|
python="logs/solve_network/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}_python.log",
|
|
|
|
memory="logs/solve_network/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}_memory.log"
|
2019-11-19 18:36:28 +00:00
|
|
|
benchmark: "benchmarks/solve_network/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}"
|
2017-12-18 19:34:15 +00:00
|
|
|
threads: 4
|
2018-09-20 12:26:38 +00:00
|
|
|
resources: mem=memory
|
2018-09-24 16:26:31 +00:00
|
|
|
# group: "solve" # with group, threads is ignored https://bitbucket.org/snakemake/snakemake/issues/971/group-job-description-does-not-contain
|
2017-12-18 19:34:15 +00:00
|
|
|
script: "scripts/solve_network.py"
|
|
|
|
|
2018-02-19 09:17:49 +00:00
|
|
|
rule solve_operations_network:
|
|
|
|
input:
|
2020-01-23 17:47:18 +00:00
|
|
|
unprepared="networks/{network}_s{simpl}_{clusters}_ec.nc",
|
2019-11-19 18:36:28 +00:00
|
|
|
optimized="results/networks/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"
|
|
|
|
output: "results/networks/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}_op.nc"
|
2018-02-19 09:17:49 +00:00
|
|
|
shadow: "shallow"
|
|
|
|
log:
|
2019-11-22 14:13:46 +00:00
|
|
|
solver=normpath("logs/solve_operations_network/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}_op_solver.log"),
|
2019-11-19 18:36:28 +00:00
|
|
|
python="logs/solve_operations_network/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}_op_python.log",
|
|
|
|
memory="logs/solve_operations_network/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}_op_memory.log"
|
|
|
|
benchmark: "benchmarks/solve_operations_network/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}"
|
2018-02-19 09:17:49 +00:00
|
|
|
threads: 4
|
2018-09-20 12:26:38 +00:00
|
|
|
resources: mem=(lambda w: 5000 + 372 * int(w.clusters))
|
2018-10-26 16:39:09 +00:00
|
|
|
# group: "solve_operations"
|
2018-02-19 09:17:49 +00:00
|
|
|
script: "scripts/solve_operations_network.py"
|
|
|
|
|
2017-12-18 19:34:15 +00:00
|
|
|
rule plot_network:
|
|
|
|
input:
|
2019-11-19 18:36:28 +00:00
|
|
|
network="results/networks/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
|
2018-10-25 14:43:24 +00:00
|
|
|
tech_costs=COSTS
|
2017-12-18 19:34:15 +00:00
|
|
|
output:
|
2019-11-19 18:36:28 +00:00
|
|
|
only_map="results/plots/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}_{attr}.{ext}",
|
|
|
|
ext="results/plots/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}_{attr}_ext.{ext}"
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/plot_network/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}_{attr}_{ext}.log"
|
2017-12-18 19:34:15 +00:00
|
|
|
script: "scripts/plot_network.py"
|
|
|
|
|
2019-02-03 12:50:05 +00:00
|
|
|
def input_make_summary(w):
|
2018-10-26 08:28:54 +00:00
|
|
|
# It's mildly hacky to include the separate costs input as first entry
|
2019-02-10 15:08:39 +00:00
|
|
|
if w.ll.endswith("all"):
|
|
|
|
ll = config["scenario"]["ll"]
|
|
|
|
if len(w.ll) == 4:
|
|
|
|
ll = [l for l in ll if l[0] == w.ll[0]]
|
|
|
|
else:
|
|
|
|
ll = w.ll
|
2018-10-26 08:28:54 +00:00
|
|
|
return ([COSTS] +
|
2019-11-19 18:36:28 +00:00
|
|
|
expand("results/networks/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
|
2018-10-26 08:28:54 +00:00
|
|
|
network=w.network,
|
2019-02-10 15:08:39 +00:00
|
|
|
ll=ll,
|
2018-10-26 08:28:54 +00:00
|
|
|
**{k: config["scenario"][k] if getattr(w, k) == "all" else getattr(w, k)
|
2019-02-10 15:08:39 +00:00
|
|
|
for k in ["simpl", "clusters", "opts"]}))
|
2017-12-18 19:34:15 +00:00
|
|
|
|
2018-10-26 08:28:54 +00:00
|
|
|
rule make_summary:
|
2019-02-03 12:50:05 +00:00
|
|
|
input: input_make_summary
|
2019-11-19 18:36:28 +00:00
|
|
|
output: directory("results/summaries/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}_{country}")
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/make_summary/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}_{country}.log",
|
2018-10-26 08:28:54 +00:00
|
|
|
script: "scripts/make_summary.py"
|
2017-12-18 19:34:15 +00:00
|
|
|
|
2018-10-26 08:28:54 +00:00
|
|
|
rule plot_summary:
|
2019-11-19 18:36:28 +00:00
|
|
|
input: "results/summaries/{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}_{country}"
|
|
|
|
output: "results/plots/summary_{summary}_{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}_{country}.{ext}"
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/plot_summary/{summary}_{network}_s{simpl}_{clusters}_ec_l{ll}_{opts}_{country}_{ext}.log"
|
2018-10-26 08:28:54 +00:00
|
|
|
script: "scripts/plot_summary.py"
|
2017-12-18 19:34:15 +00:00
|
|
|
|
2019-02-03 13:22:12 +00:00
|
|
|
def input_plot_p_nom_max(wildcards):
|
|
|
|
return [('networks/{network}_s{simpl}{maybe_cluster}.nc'
|
|
|
|
.format(maybe_cluster=('' if c == 'full' else ('_' + c)), **wildcards))
|
2019-12-09 20:29:15 +00:00
|
|
|
for c in wildcards.clusts.split(",")]
|
2019-02-03 13:22:12 +00:00
|
|
|
rule plot_p_nom_max:
|
|
|
|
input: input_plot_p_nom_max
|
2019-12-09 20:29:15 +00:00
|
|
|
output: "results/plots/{network}_s{simpl}_cum_p_nom_max_{clusts}_{techs}_{country}.{ext}"
|
|
|
|
log: "logs/plot_p_nom_max/{network}_s{simpl}_{clusts}_{techs}_{country}_{ext}.log"
|
2019-02-03 13:22:12 +00:00
|
|
|
script: "scripts/plot_p_nom_max.py"
|
|
|
|
|
2019-02-15 10:21:41 +00:00
|
|
|
rule build_country_flh:
|
|
|
|
input:
|
|
|
|
base_network="networks/base.nc",
|
|
|
|
corine="data/bundle/corine/g250_clc06_V18_5.tif",
|
|
|
|
natura="resources/natura.tiff",
|
2019-10-03 10:32:49 +00:00
|
|
|
gebco=lambda wildcards: ("data/bundle/GEBCO_2014_2D.nc"
|
|
|
|
if "max_depth" in config["renewable"][wildcards.technology].keys()
|
|
|
|
else []),
|
2019-02-15 10:21:41 +00:00
|
|
|
country_shapes='resources/country_shapes.geojson',
|
|
|
|
offshore_shapes='resources/offshore_shapes.geojson',
|
|
|
|
pietzker="data/pietzker2014.xlsx",
|
|
|
|
regions=lambda w: ("resources/country_shapes.geojson"
|
|
|
|
if w.technology in ('onwind', 'solar')
|
|
|
|
else "resources/offshore_shapes.geojson"),
|
|
|
|
cutout=lambda w: "cutouts/" + config["renewable"][w.technology]['cutout']
|
|
|
|
output:
|
|
|
|
area="resources/country_flh_area_{technology}.csv",
|
|
|
|
aggregated="resources/country_flh_aggregated_{technology}.csv",
|
|
|
|
uncorrected="resources/country_flh_uncorrected_{technology}.csv",
|
|
|
|
plot="resources/country_flh_{technology}.pdf",
|
|
|
|
exclusion=directory("resources/country_exclusion_{technology}")
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/build_country_flh_{technology}.log"
|
2019-02-15 10:21:41 +00:00
|
|
|
resources: mem=10000
|
|
|
|
benchmark: "benchmarks/build_country_flh_{technology}"
|
|
|
|
# group: 'feedin_preparation'
|
|
|
|
script: "scripts/build_country_flh.py"
|
|
|
|
|
2017-12-18 19:34:15 +00:00
|
|
|
# Local Variables:
|
|
|
|
# mode: python
|
|
|
|
# End:
|