From ba9be74265d758b963382bd000dca1e50ae9088c Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Wed, 4 Aug 2021 15:05:37 +0200 Subject: [PATCH] make build_biomass_transport_costs fully optional --- Snakefile | 27 ++++++++++++++---------- scripts/build_biomass_transport_costs.py | 2 +- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Snakefile b/Snakefile index 45c33da9..caed1f42 100644 --- a/Snakefile +++ b/Snakefile @@ -180,16 +180,21 @@ rule build_biomass_potentials: script: 'scripts/build_biomass_potentials.py' -rule build_biomass_transport_costs: - input: "data/biomass/biomass potentials in europe_web rev.pdf" - output: - supply_chain1="resources/biomass_transport_costs_supply_chain1.csv", - supply_chain2="resources/biomass_transport_costs_supply_chain2.csv", - transport_costs="resources/biomass_transport_costs.csv", - threads: 1 - resources: mem_mb=1000 - benchmark: "benchmarks/build_biomass_transport_costs" - script: 'scripts/build_biomass_transport_costs.py' +if config["sector"]["biomass_transport"]: + rule build_biomass_transport_costs: + input: + transport_cost_data="data/biomass/biomass potentials in europe_web rev.pdf" + output: + supply_chain1="resources/biomass_transport_costs_supply_chain1.csv", + supply_chain2="resources/biomass_transport_costs_supply_chain2.csv", + transport_costs="resources/biomass_transport_costs.csv", + threads: 1 + resources: mem_mb=1000 + benchmark: "benchmarks/build_biomass_transport_costs" + script: 'scripts/build_biomass_transport_costs.py' + build_biomass_transport_costs_output = rules.build_biomass_transport_costs.output +else: + build_biomass_transport_costs_output = {} rule build_ammonia_production: @@ -336,7 +341,6 @@ rule prepare_sector_network: traffic_data_KFZ="data/emobility/KFZ__count", traffic_data_Pkw="data/emobility/Pkw__count", biomass_potentials='resources/biomass_potentials.csv', - biomass_transport="resources/biomass_transport_costs.csv", heat_profile="data/heat_load_profile_BDEW.csv", costs=CDIR + "costs_{planning_horizons}.csv", profile_offwind_ac=pypsaeur("resources/profile_offwind-ac.nc"), @@ -366,6 +370,7 @@ rule prepare_sector_network: solar_thermal_urban="resources/solar_thermal_urban_elec_s{simpl}_{clusters}.nc", solar_thermal_rural="resources/solar_thermal_rural_elec_s{simpl}_{clusters}.nc", **build_retro_cost_output + **build_biomass_transport_costs_output output: RDIR + '/prenetworks/elec_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{planning_horizons}.nc' threads: 1 resources: mem_mb=2000 diff --git a/scripts/build_biomass_transport_costs.py b/scripts/build_biomass_transport_costs.py index 703d81ae..b17c97fd 100644 --- a/scripts/build_biomass_transport_costs.py +++ b/scripts/build_biomass_transport_costs.py @@ -22,7 +22,7 @@ ENERGY_CONTENT = 4.8 # unit MWh/tonne (assuming wood pellets) def build_biomass_transport_costs(): df_list = tbl.read_pdf( - snakemake.input[0], + snakemake.input.transport_cost_data, pages="145-147", multiple_tables=True, )