diff --git a/Snakefile b/Snakefile index f003bd5e..2d5564a8 100644 --- a/Snakefile +++ b/Snakefile @@ -2,8 +2,8 @@ configfile: "config.yaml" wildcard_constraints: + year="[0-9]*", lv="[a-z0-9\.]+", - network="[a-zA-Z0-9]*", simpl="[a-zA-Z0-9]*", clusters="[0-9]+m?", sectors="[+a-zA-Z0-9]+", @@ -25,17 +25,17 @@ rule all: rule solve_all_networks: input: - expand(config['results_dir'] + config['run'] + "/postnetworks/elec_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc", + expand(config['results_dir'] + config['run'] + "/postnetworks/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc", **config['scenario']) rule test_script: input: - expand("resources/heat_demand_urban_elec_s_{clusters}.nc", + expand("resources/heat_demand_urban_elec{year}_s_{clusters}.nc", **config['scenario']) rule prepare_sector_networks: input: - expand(config['results_dir'] + config['run'] + "/prenetworks/elec_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc", + expand(config['results_dir'] + config['run'] + "/prenetworks/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc", **config['scenario']) @@ -44,96 +44,96 @@ rule build_population_layouts: nuts3_shapes=pypsaeur('resources/nuts3_shapes.geojson'), urban_percent="data/urban_percent.csv" output: - pop_layout_total="resources/pop_layout_total.nc", - pop_layout_urban="resources/pop_layout_urban.nc", - pop_layout_rural="resources/pop_layout_rural.nc" + pop_layout_total="resources/pop_layout{year}_total.nc", + pop_layout_urban="resources/pop_layout{year}_urban.nc", + pop_layout_rural="resources/pop_layout{year}_rural.nc" resources: mem_mb=20000 script: "scripts/build_population_layouts.py" rule build_clustered_population_layouts: input: - pop_layout_total="resources/pop_layout_total.nc", - pop_layout_urban="resources/pop_layout_urban.nc", - pop_layout_rural="resources/pop_layout_rural.nc", - regions_onshore=pypsaeur('resources/regions_onshore_{network}_s{simpl}_{clusters}.geojson') + pop_layout_total="resources/pop_layout{year}_total.nc", + pop_layout_urban="resources/pop_layout{year}_urban.nc", + pop_layout_rural="resources/pop_layout{year}_rural.nc", + regions_onshore=pypsaeur('resources/regions_onshore_elec{year}_s{simpl}_{clusters}.geojson') output: - clustered_pop_layout="resources/pop_layout_{network}_s{simpl}_{clusters}.csv" + clustered_pop_layout="resources/pop_layout_elec{year}_s{simpl}_{clusters}.csv" resources: mem_mb=10000 script: "scripts/build_clustered_population_layouts.py" rule build_simplified_population_layouts: input: - pop_layout_total="resources/pop_layout_total.nc", - pop_layout_urban="resources/pop_layout_urban.nc", - pop_layout_rural="resources/pop_layout_rural.nc", - regions_onshore=pypsaeur('resources/regions_onshore_{network}_s{simpl}.geojson') + pop_layout_total="resources/pop_layout{year}_total.nc", + pop_layout_urban="resources/pop_layout{year}_urban.nc", + pop_layout_rural="resources/pop_layout{year}_rural.nc", + regions_onshore=pypsaeur('resources/regions_onshore_elec{year}_s{simpl}.geojson') output: - clustered_pop_layout="resources/pop_layout_{network}_s{simpl}.csv" + clustered_pop_layout="resources/pop_layout_elec{year}_s{simpl}.csv" resources: mem_mb=10000 script: "scripts/build_clustered_population_layouts.py" rule build_heat_demands: input: - pop_layout_total="resources/pop_layout_total.nc", - pop_layout_urban="resources/pop_layout_urban.nc", - pop_layout_rural="resources/pop_layout_rural.nc", - regions_onshore=pypsaeur("resources/regions_onshore_{network}_s{simpl}_{clusters}.geojson") + pop_layout_total="resources/pop_layout{year}_total.nc", + pop_layout_urban="resources/pop_layout{year}_urban.nc", + pop_layout_rural="resources/pop_layout{year}_rural.nc", + regions_onshore=pypsaeur("resources/regions_onshore_elec{year}_s{simpl}_{clusters}.geojson") output: - heat_demand_urban="resources/heat_demand_urban_{network}_s{simpl}_{clusters}.nc", - heat_demand_rural="resources/heat_demand_rural_{network}_s{simpl}_{clusters}.nc", - heat_demand_total="resources/heat_demand_total_{network}_s{simpl}_{clusters}.nc" + heat_demand_urban="resources/heat_demand_urban_elec{year}_s{simpl}_{clusters}.nc", + heat_demand_rural="resources/heat_demand_rural_elec{year}_s{simpl}_{clusters}.nc", + heat_demand_total="resources/heat_demand_total_elec{year}_s{simpl}_{clusters}.nc" resources: mem_mb=20000 script: "scripts/build_heat_demand.py" rule build_temperature_profiles: input: - pop_layout_total="resources/pop_layout_total.nc", - pop_layout_urban="resources/pop_layout_urban.nc", - pop_layout_rural="resources/pop_layout_rural.nc", - regions_onshore=pypsaeur("resources/regions_onshore_{network}_s{simpl}_{clusters}.geojson") + pop_layout_total="resources/pop_layout{year}_total.nc", + pop_layout_urban="resources/pop_layout{year}_urban.nc", + pop_layout_rural="resources/pop_layout{year}_rural.nc", + regions_onshore=pypsaeur("resources/regions_onshore_elec{year}_s{simpl}_{clusters}.geojson") output: - temp_soil_total="resources/temp_soil_total_{network}_s{simpl}_{clusters}.nc", - temp_soil_rural="resources/temp_soil_rural_{network}_s{simpl}_{clusters}.nc", - temp_soil_urban="resources/temp_soil_urban_{network}_s{simpl}_{clusters}.nc", - temp_air_total="resources/temp_air_total_{network}_s{simpl}_{clusters}.nc", - temp_air_rural="resources/temp_air_rural_{network}_s{simpl}_{clusters}.nc", - temp_air_urban="resources/temp_air_urban_{network}_s{simpl}_{clusters}.nc" + temp_soil_total="resources/temp_soil_total_elec{year}_s{simpl}_{clusters}.nc", + temp_soil_rural="resources/temp_soil_rural_elec{year}_s{simpl}_{clusters}.nc", + temp_soil_urban="resources/temp_soil_urban_elec{year}_s{simpl}_{clusters}.nc", + temp_air_total="resources/temp_air_total_elec{year}_s{simpl}_{clusters}.nc", + temp_air_rural="resources/temp_air_rural_elec{year}_s{simpl}_{clusters}.nc", + temp_air_urban="resources/temp_air_urban_elec{year}_s{simpl}_{clusters}.nc" resources: mem_mb=20000 script: "scripts/build_temperature_profiles.py" rule build_cop_profiles: input: - temp_soil_total="resources/temp_soil_total_{network}_s{simpl}_{clusters}.nc", - temp_soil_rural="resources/temp_soil_rural_{network}_s{simpl}_{clusters}.nc", - temp_soil_urban="resources/temp_soil_urban_{network}_s{simpl}_{clusters}.nc", - temp_air_total="resources/temp_air_total_{network}_s{simpl}_{clusters}.nc", - temp_air_rural="resources/temp_air_rural_{network}_s{simpl}_{clusters}.nc", - temp_air_urban="resources/temp_air_urban_{network}_s{simpl}_{clusters}.nc" + temp_soil_total="resources/temp_soil_total_elec{year}_s{simpl}_{clusters}.nc", + temp_soil_rural="resources/temp_soil_rural_elec{year}_s{simpl}_{clusters}.nc", + temp_soil_urban="resources/temp_soil_urban_elec{year}_s{simpl}_{clusters}.nc", + temp_air_total="resources/temp_air_total_elec{year}_s{simpl}_{clusters}.nc", + temp_air_rural="resources/temp_air_rural_elec{year}_s{simpl}_{clusters}.nc", + temp_air_urban="resources/temp_air_urban_elec{year}_s{simpl}_{clusters}.nc" output: - cop_soil_total="resources/cop_soil_total_{network}_s{simpl}_{clusters}.nc", - cop_soil_rural="resources/cop_soil_rural_{network}_s{simpl}_{clusters}.nc", - cop_soil_urban="resources/cop_soil_urban_{network}_s{simpl}_{clusters}.nc", - cop_air_total="resources/cop_air_total_{network}_s{simpl}_{clusters}.nc", - cop_air_rural="resources/cop_air_rural_{network}_s{simpl}_{clusters}.nc", - cop_air_urban="resources/cop_air_urban_{network}_s{simpl}_{clusters}.nc" + cop_soil_total="resources/cop_soil_total_elec{year}_s{simpl}_{clusters}.nc", + cop_soil_rural="resources/cop_soil_rural_elec{year}_s{simpl}_{clusters}.nc", + cop_soil_urban="resources/cop_soil_urban_elec{year}_s{simpl}_{clusters}.nc", + cop_air_total="resources/cop_air_total_elec{year}_s{simpl}_{clusters}.nc", + cop_air_rural="resources/cop_air_rural_elec{year}_s{simpl}_{clusters}.nc", + cop_air_urban="resources/cop_air_urban_elec{year}_s{simpl}_{clusters}.nc" resources: mem_mb=20000 script: "scripts/build_cop_profiles.py" rule build_solar_thermal_profiles: input: - pop_layout_total="resources/pop_layout_total.nc", - pop_layout_urban="resources/pop_layout_urban.nc", - pop_layout_rural="resources/pop_layout_rural.nc", - regions_onshore=pypsaeur("resources/regions_onshore_{network}_s{simpl}_{clusters}.geojson") + pop_layout_total="resources/pop_layout{year}_total.nc", + pop_layout_urban="resources/pop_layout{year}_urban.nc", + pop_layout_rural="resources/pop_layout{year}_rural.nc", + regions_onshore=pypsaeur("resources/regions_onshore_elec{year}_s{simpl}_{clusters}.geojson") output: - solar_thermal_total="resources/solar_thermal_total_{network}_s{simpl}_{clusters}.nc", - solar_thermal_urban="resources/solar_thermal_urban_{network}_s{simpl}_{clusters}.nc", - solar_thermal_rural="resources/solar_thermal_rural_{network}_s{simpl}_{clusters}.nc" + solar_thermal_total="resources/solar_thermal_total_elec{year}_s{simpl}_{clusters}.nc", + solar_thermal_urban="resources/solar_thermal_urban_elec{year}_s{simpl}_{clusters}.nc", + solar_thermal_rural="resources/solar_thermal_rural_elec{year}_s{simpl}_{clusters}.nc" resources: mem_mb=20000 script: "scripts/build_solar_thermal_profiles.py" @@ -204,12 +204,12 @@ rule build_industrial_production_per_country_tomorrow: rule build_industrial_distribution_key: input: - clustered_pop_layout="resources/pop_layout_{network}_s{simpl}_{clusters}.csv", + clustered_pop_layout="resources/pop_layout_elec{year}_s{simpl}_{clusters}.csv", europe_shape=pypsaeur('resources/europe_shape.geojson'), hotmaps_industrial_database="data/Industrial_Database.csv", - network=pypsaeur('networks/{network}_s{simpl}_{clusters}.nc') + network=pypsaeur('networks/elec{year}_s{simpl}_{clusters}.nc') output: - industrial_distribution_key="resources/industrial_distribution_key_{network}_s{simpl}_{clusters}.csv" + industrial_distribution_key="resources/industrial_distribution_key_elec{year}_s{simpl}_{clusters}.csv" threads: 1 resources: mem_mb=1000 script: 'scripts/build_industrial_distribution_key.py' @@ -218,10 +218,10 @@ rule build_industrial_distribution_key: rule build_industrial_production_per_node: input: - industrial_distribution_key="resources/industrial_distribution_key_{network}_s{simpl}_{clusters}.csv", + industrial_distribution_key="resources/industrial_distribution_key_elec{year}_s{simpl}_{clusters}.csv", industrial_production_per_country_tomorrow="resources/industrial_production_per_country_tomorrow.csv" output: - industrial_production_per_node="resources/industrial_production_{network}_s{simpl}_{clusters}.csv" + industrial_production_per_node="resources/industrial_production_elec{year}_s{simpl}_{clusters}.csv" threads: 1 resources: mem_mb=1000 script: 'scripts/build_industrial_production_per_node.py' @@ -230,10 +230,10 @@ rule build_industrial_production_per_node: rule build_industrial_energy_demand_per_node: input: industry_sector_ratios="resources/industry_sector_ratios.csv", - industrial_production_per_node="resources/industrial_production_{network}_s{simpl}_{clusters}.csv", - industrial_energy_demand_per_node_today="resources/industrial_energy_demand_today_{network}_s{simpl}_{clusters}.csv" + industrial_production_per_node="resources/industrial_production_elec{year}_s{simpl}_{clusters}.csv", + industrial_energy_demand_per_node_today="resources/industrial_energy_demand_today_elec{year}_s{simpl}_{clusters}.csv" output: - industrial_energy_demand_per_node="resources/industrial_energy_demand_{network}_s{simpl}_{clusters}.csv" + industrial_energy_demand_per_node="resources/industrial_energy_demand_elec{year}_s{simpl}_{clusters}.csv" threads: 1 resources: mem_mb=1000 script: 'scripts/build_industrial_energy_demand_per_node.py' @@ -252,10 +252,10 @@ rule build_industrial_energy_demand_per_country_today: rule build_industrial_energy_demand_per_node_today: input: - industrial_distribution_key="resources/industrial_distribution_key_{network}_s{simpl}_{clusters}.csv", + industrial_distribution_key="resources/industrial_distribution_key_elec{year}_s{simpl}_{clusters}.csv", industrial_energy_demand_per_country_today="resources/industrial_energy_demand_per_country_today.csv" output: - industrial_energy_demand_per_node_today="resources/industrial_energy_demand_today_{network}_s{simpl}_{clusters}.csv" + industrial_energy_demand_per_node_today="resources/industrial_energy_demand_today_elec{year}_s{simpl}_{clusters}.csv" threads: 1 resources: mem_mb=1000 script: 'scripts/build_industrial_energy_demand_per_node_today.py' @@ -275,10 +275,10 @@ rule build_industrial_energy_demand_per_country: rule build_industrial_demand: input: - clustered_pop_layout="resources/pop_layout_{network}_s{simpl}_{clusters}.csv", + clustered_pop_layout="resources/pop_layout_elec{year}_s{simpl}_{clusters}.csv", industrial_demand_per_country="resources/industrial_energy_demand_per_country.csv" output: - industrial_demand="resources/industrial_demand_{network}_s{simpl}_{clusters}.csv" + industrial_demand="resources/industrial_demand_elec{year}_s{simpl}_{clusters}.csv" threads: 1 resources: mem_mb=1000 script: 'scripts/build_industrial_demand.py' @@ -286,7 +286,7 @@ rule build_industrial_demand: rule prepare_sector_network: input: - network=pypsaeur('networks/{network}_s{simpl}_{clusters}_ec_lv{lv}_{opts}.nc'), + network=pypsaeur('networks/elec{year}_s{simpl}_{clusters}_ec_lv{lv}_{opts}.nc'), energy_totals_name='resources/energy_totals.csv', co2_totals_name='resources/co2_totals.csv', transport_name='resources/transport_data.csv', @@ -296,45 +296,45 @@ rule prepare_sector_network: costs=config['costs_dir'] + "costs_{planning_horizons}.csv", h2_cavern = "data/hydrogen_salt_cavern_potentials.csv", co2_budget="data/co2_budget.csv", - profile_offwind_ac=pypsaeur("resources/profile_offwind-ac.nc"), - profile_offwind_dc=pypsaeur("resources/profile_offwind-dc.nc"), - busmap_s=pypsaeur("resources/busmap_{network}_s{simpl}.csv"), - busmap=pypsaeur("resources/busmap_{network}_s{simpl}_{clusters}.csv"), - clustered_pop_layout="resources/pop_layout_{network}_s{simpl}_{clusters}.csv", - simplified_pop_layout="resources/pop_layout_{network}_s{simpl}.csv", - industrial_demand="resources/industrial_energy_demand_{network}_s{simpl}_{clusters}.csv", - heat_demand_urban="resources/heat_demand_urban_{network}_s{simpl}_{clusters}.nc", - heat_demand_rural="resources/heat_demand_rural_{network}_s{simpl}_{clusters}.nc", - heat_demand_total="resources/heat_demand_total_{network}_s{simpl}_{clusters}.nc", - temp_soil_total="resources/temp_soil_total_{network}_s{simpl}_{clusters}.nc", - temp_soil_rural="resources/temp_soil_rural_{network}_s{simpl}_{clusters}.nc", - temp_soil_urban="resources/temp_soil_urban_{network}_s{simpl}_{clusters}.nc", - temp_air_total="resources/temp_air_total_{network}_s{simpl}_{clusters}.nc", - temp_air_rural="resources/temp_air_rural_{network}_s{simpl}_{clusters}.nc", - temp_air_urban="resources/temp_air_urban_{network}_s{simpl}_{clusters}.nc", - cop_soil_total="resources/cop_soil_total_{network}_s{simpl}_{clusters}.nc", - cop_soil_rural="resources/cop_soil_rural_{network}_s{simpl}_{clusters}.nc", - cop_soil_urban="resources/cop_soil_urban_{network}_s{simpl}_{clusters}.nc", - cop_air_total="resources/cop_air_total_{network}_s{simpl}_{clusters}.nc", - cop_air_rural="resources/cop_air_rural_{network}_s{simpl}_{clusters}.nc", - cop_air_urban="resources/cop_air_urban_{network}_s{simpl}_{clusters}.nc", - solar_thermal_total="resources/solar_thermal_total_{network}_s{simpl}_{clusters}.nc", - solar_thermal_urban="resources/solar_thermal_urban_{network}_s{simpl}_{clusters}.nc", - solar_thermal_rural="resources/solar_thermal_rural_{network}_s{simpl}_{clusters}.nc" - output: config['results_dir'] + config['run'] + '/prenetworks/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc' + profile_offwind_ac=pypsaeur("resources/profile{year}_offwind-ac.nc"), + profile_offwind_dc=pypsaeur("resources/profile{year}_offwind-dc.nc"), + busmap_s=pypsaeur("resources/busmap_elec{year}_s{simpl}.csv"), + busmap=pypsaeur("resources/busmap_elec{year}_s{simpl}_{clusters}.csv"), + clustered_pop_layout="resources/pop_layout_elec{year}_s{simpl}_{clusters}.csv", + simplified_pop_layout="resources/pop_layout_elec{year}_s{simpl}.csv", + industrial_demand="resources/industrial_energy_demand_elec{year}_s{simpl}_{clusters}.csv", + heat_demand_urban="resources/heat_demand_urban_elec{year}_s{simpl}_{clusters}.nc", + heat_demand_rural="resources/heat_demand_rural_elec{year}_s{simpl}_{clusters}.nc", + heat_demand_total="resources/heat_demand_total_elec{year}_s{simpl}_{clusters}.nc", + temp_soil_total="resources/temp_soil_total_elec{year}_s{simpl}_{clusters}.nc", + temp_soil_rural="resources/temp_soil_rural_elec{year}_s{simpl}_{clusters}.nc", + temp_soil_urban="resources/temp_soil_urban_elec{year}_s{simpl}_{clusters}.nc", + temp_air_total="resources/temp_air_total_elec{year}_s{simpl}_{clusters}.nc", + temp_air_rural="resources/temp_air_rural_elec{year}_s{simpl}_{clusters}.nc", + temp_air_urban="resources/temp_air_urban_elec{year}_s{simpl}_{clusters}.nc", + cop_soil_total="resources/cop_soil_total_elec{year}_s{simpl}_{clusters}.nc", + cop_soil_rural="resources/cop_soil_rural_elec{year}_s{simpl}_{clusters}.nc", + cop_soil_urban="resources/cop_soil_urban_elec{year}_s{simpl}_{clusters}.nc", + cop_air_total="resources/cop_air_total_elec{year}_s{simpl}_{clusters}.nc", + cop_air_rural="resources/cop_air_rural_elec{year}_s{simpl}_{clusters}.nc", + cop_air_urban="resources/cop_air_urban_elec{year}_s{simpl}_{clusters}.nc", + solar_thermal_total="resources/solar_thermal_total_elec{year}_s{simpl}_{clusters}.nc", + solar_thermal_urban="resources/solar_thermal_urban_elec{year}_s{simpl}_{clusters}.nc", + solar_thermal_rural="resources/solar_thermal_rural_elec{year}_s{simpl}_{clusters}.nc" + output: config['results_dir'] + config['run'] + '/prenetworks/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc' threads: 1 resources: mem_mb=2000 - benchmark: config['results_dir'] + config['run'] + "/benchmarks/prepare_network/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}" + benchmark: config['results_dir'] + config['run'] + "/benchmarks/prepare_network/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}" script: "scripts/prepare_sector_network.py" rule plot_network: input: - network=config['results_dir'] + config['run'] + "/postnetworks/elec_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc" + network=config['results_dir'] + config['run'] + "/postnetworks/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc" output: - map=config['results_dir'] + config['run'] + "/maps/elec_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}-costs-all_{co2_budget_name}_{planning_horizons}.pdf", - today=config['results_dir'] + config['run'] + "/maps/elec_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}-today.pdf" + map=config['results_dir'] + config['run'] + "/maps/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}-costs-all_{co2_budget_name}_{planning_horizons}.pdf", + today=config['results_dir'] + config['run'] + "/maps/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}-today.pdf" threads: 2 resources: mem_mb=10000 script: "scripts/plot_network.py" @@ -351,10 +351,10 @@ rule copy_config: rule make_summary: input: - networks=expand(config['results_dir'] + config['run'] + "/postnetworks/elec_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc", + networks=expand(config['results_dir'] + config['run'] + "/postnetworks/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc", **config['scenario']), costs=config['costs_dir'] + "costs_{}.csv".format(config['scenario']['planning_horizons'][0]), - plots=expand(config['results_dir'] + config['run'] + "/maps/elec_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}-costs-all_{co2_budget_name}_{planning_horizons}.pdf", + plots=expand(config['results_dir'] + config['run'] + "/maps/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}-costs-all_{co2_budget_name}_{planning_horizons}.pdf", **config['scenario']) #heat_demand_name='data/heating/daily_heat_demand.h5' output: @@ -397,16 +397,16 @@ if config["foresight"] == "overnight": rule solve_network: input: - network=config['results_dir'] + config['run'] + "/prenetworks/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc", + network=config['results_dir'] + config['run'] + "/prenetworks/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc", costs=config['costs_dir'] + "costs_{planning_horizons}.csv", config=config['summary_dir'] + '/' + config['run'] + '/configs/config.yaml' - output: config['results_dir'] + config['run'] + "/postnetworks/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc" + output: config['results_dir'] + config['run'] + "/postnetworks/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc" shadow: "shallow" log: - solver=config['results_dir'] + config['run'] + "/logs/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_solver.log", - python=config['results_dir'] + config['run'] + "/logs/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_python.log", - memory=config['results_dir'] + config['run'] + "/logs/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_memory.log" - benchmark: config['results_dir'] + config['run'] + "/benchmarks/solve_network/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}" + solver=config['results_dir'] + config['run'] + "/logs/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_solver.log", + python=config['results_dir'] + config['run'] + "/logs/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_python.log", + memory=config['results_dir'] + config['run'] + "/logs/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_memory.log" + benchmark: config['results_dir'] + config['run'] + "/benchmarks/solve_network/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}" threads: 4 resources: mem_mb=config['solving']['mem'] # group: "solve" # with group, threads is ignored https://bitbucket.org/snakemake/snakemake/issues/971/group-job-description-does-not-contain @@ -417,15 +417,15 @@ if config["foresight"] == "myopic": rule add_existing_baseyear: input: - network=config['results_dir'] + config['run'] + '/prenetworks/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc', + network=config['results_dir'] + config['run'] + '/prenetworks/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc', powerplants=pypsaeur('resources/powerplants.csv'), - busmap_s=pypsaeur("resources/busmap_{network}_s{simpl}.csv"), - busmap=pypsaeur("resources/busmap_{network}_s{simpl}_{clusters}.csv"), - clustered_pop_layout="resources/pop_layout_{network}_s{simpl}_{clusters}.csv", + busmap_s=pypsaeur("resources/busmap_elec{year}_s{simpl}.csv"), + busmap=pypsaeur("resources/busmap_elec{year}_s{simpl}_{clusters}.csv"), + clustered_pop_layout="resources/pop_layout_elec{year}_s{simpl}_{clusters}.csv", costs=config['costs_dir'] + "costs_{}.csv".format(config['scenario']['planning_horizons'][0]), - cop_soil_total="resources/cop_soil_total_{network}_s{simpl}_{clusters}.nc", - cop_air_total="resources/cop_air_total_{network}_s{simpl}_{clusters}.nc" - output: config['results_dir'] + config['run'] + '/prenetworks-brownfield/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc' + cop_soil_total="resources/cop_soil_total_elec{year}_s{simpl}_{clusters}.nc", + cop_air_total="resources/cop_air_total_elec{year}_s{simpl}_{clusters}.nc" + output: config['results_dir'] + config['run'] + '/prenetworks-brownfield/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc' wildcard_constraints: planning_horizons=config['scenario']['planning_horizons'][0] #only applies to baseyear threads: 1 @@ -434,18 +434,18 @@ if config["foresight"] == "myopic": def process_input(wildcards): i = config["scenario"]["planning_horizons"].index(int(wildcards.planning_horizons)) - return config['results_dir'] + config['run'] + "/postnetworks/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_" + str(config["scenario"]["planning_horizons"][i-1]) + ".nc" + return config['results_dir'] + config['run'] + "/postnetworks/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_" + str(config["scenario"]["planning_horizons"][i-1]) + ".nc" rule add_brownfield: input: - network=config['results_dir'] + config['run'] + '/prenetworks/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc', + network=config['results_dir'] + config['run'] + '/prenetworks/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc', network_p=process_input, #solved network at previous time step costs=config['costs_dir'] + "costs_{planning_horizons}.csv", - cop_soil_total="resources/cop_soil_total_{network}_s{simpl}_{clusters}.nc", - cop_air_total="resources/cop_air_total_{network}_s{simpl}_{clusters}.nc" + cop_soil_total="resources/cop_soil_total_elec{year}_s{simpl}_{clusters}.nc", + cop_air_total="resources/cop_air_total_elec{year}_s{simpl}_{clusters}.nc" - output: config['results_dir'] + config['run'] + "/prenetworks-brownfield/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc" + output: config['results_dir'] + config['run'] + "/prenetworks-brownfield/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc" threads: 4 resources: mem_mb=2000 script: "scripts/add_brownfield.py" @@ -454,16 +454,16 @@ if config["foresight"] == "myopic": rule solve_network_myopic: input: - network=config['results_dir'] + config['run'] + "/prenetworks-brownfield/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc", + network=config['results_dir'] + config['run'] + "/prenetworks-brownfield/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc", costs=config['costs_dir'] + "costs_{planning_horizons}.csv", config=config['summary_dir'] + '/' + config['run'] + '/configs/config.yaml' - output: config['results_dir'] + config['run'] + "/postnetworks/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc" + output: config['results_dir'] + config['run'] + "/postnetworks/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc" shadow: "shallow" log: - solver=config['results_dir'] + config['run'] + "/logs/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_solver.log", - python=config['results_dir'] + config['run'] + "/logs/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_python.log", - memory=config['results_dir'] + config['run'] + "/logs/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_memory.log" - benchmark: config['results_dir'] + config['run'] + "/benchmarks/solve_network/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}" + solver=config['results_dir'] + config['run'] + "/logs/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_solver.log", + python=config['results_dir'] + config['run'] + "/logs/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_python.log", + memory=config['results_dir'] + config['run'] + "/logs/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_memory.log" + benchmark: config['results_dir'] + config['run'] + "/benchmarks/solve_network/elec{year}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}" threads: 4 resources: mem_mb=config['solving']['mem'] script: "scripts/solve_network.py" diff --git a/scripts/build_clustered_population_layouts.py b/scripts/build_clustered_population_layouts.py index 94cbd133..85543afc 100644 --- a/scripts/build_clustered_population_layouts.py +++ b/scripts/build_clustered_population_layouts.py @@ -5,8 +5,11 @@ import pandas as pd import atlite import helper +year = snakemake.wildcards.year +cutout_name = snakemake.config['atlite']['cutout_name'] +if year: cutout_name = cutout_name.format(year=year) -cutout = atlite.Cutout(snakemake.config['atlite']['cutout_name'], +cutout = atlite.Cutout(cutout_name, cutout_dir=snakemake.config['atlite']['cutout_dir']) diff --git a/scripts/build_heat_demand.py b/scripts/build_heat_demand.py index 865f12bd..0e6cdbd7 100644 --- a/scripts/build_heat_demand.py +++ b/scripts/build_heat_demand.py @@ -15,10 +15,16 @@ if 'snakemake' not in globals(): snakemake.input = Dict() snakemake.output = Dict() -time = pd.date_range(freq='m', **snakemake.config['snapshots']) +year = snakemake.wildcards.year + +snapshots = dict(start=year, end=str(int(year)+1), closed="left") if year else snakemake.config['snapshots'] +time = pd.date_range(freq='m', **snapshots) params = dict(years=slice(*time.year[[0, -1]]), months=slice(*time.month[[0, -1]])) -cutout = atlite.Cutout(snakemake.config['atlite']['cutout_name'], +cutout_name = snakemake.config['atlite']['cutout_name'] +if year: cutout_name = cutout_name.format(year=year) + +cutout = atlite.Cutout(cutout_name, cutout_dir=snakemake.config['atlite']['cutout_dir'], **params) diff --git a/scripts/build_population_layouts.py b/scripts/build_population_layouts.py index 5093e1b4..15804576 100644 --- a/scripts/build_population_layouts.py +++ b/scripts/build_population_layouts.py @@ -21,7 +21,11 @@ if 'snakemake' not in globals(): snakemake.input["urban_percent"] = "data/urban_percent.csv" -cutout = atlite.Cutout(snakemake.config['atlite']['cutout_name'], +year = snakemake.wildcards.year +cutout_name = snakemake.config['atlite']['cutout_name'] +if year: cutout_name = cutout_name.format(year=year) + +cutout = atlite.Cutout(cutout_name, cutout_dir=snakemake.config['atlite']['cutout_dir']) grid_cells = cutout.grid_cells() diff --git a/scripts/build_solar_thermal_profiles.py b/scripts/build_solar_thermal_profiles.py index c26266aa..7d4199d5 100644 --- a/scripts/build_solar_thermal_profiles.py +++ b/scripts/build_solar_thermal_profiles.py @@ -15,12 +15,17 @@ if 'snakemake' not in globals(): snakemake.input = Dict() snakemake.output = Dict() -time = pd.date_range(freq='m', **snakemake.config['snapshots']) +year = snakemake.wildcards.year + +snapshots = dict(start=year, end=str(int(year)+1), closed="left") if year else snakemake.config['snapshots'] +time = pd.date_range(freq='m', **snapshots) params = dict(years=slice(*time.year[[0, -1]]), months=slice(*time.month[[0, -1]])) +cutout_name = snakemake.config['atlite']['cutout_name'] +if year: cutout_name = cutout_name.format(year=year) -cutout = atlite.Cutout(snakemake.config['atlite']['cutout_name'], +cutout = atlite.Cutout(cutout_name, cutout_dir=snakemake.config['atlite']['cutout_dir'], **params) diff --git a/scripts/build_temperature_profiles.py b/scripts/build_temperature_profiles.py index a55bd606..2cad501c 100644 --- a/scripts/build_temperature_profiles.py +++ b/scripts/build_temperature_profiles.py @@ -15,11 +15,16 @@ if 'snakemake' not in globals(): snakemake.input = Dict() snakemake.output = Dict() -time = pd.date_range(freq='m', **snakemake.config['snapshots']) +year = snakemake.wildcards.year + +snapshots = dict(start=year, end=str(int(year)+1), closed="left") if year else snakemake.config['snapshots'] +time = pd.date_range(freq='m', **snapshots) params = dict(years=slice(*time.year[[0, -1]]), months=slice(*time.month[[0, -1]])) +cutout_name = snakemake.config['atlite']['cutout_name'] +if year: cutout_name = cutout_name.format(year=year) -cutout = atlite.Cutout(snakemake.config['atlite']['cutout_name'], +cutout = atlite.Cutout(cutout_name, cutout_dir=snakemake.config['atlite']['cutout_dir'], **params)