From 5b057575df0bd4f0eb8bec58f343b98a22ce8b09 Mon Sep 17 00:00:00 2001 From: Fabian Date: Wed, 2 Aug 2023 14:39:20 +0200 Subject: [PATCH] prepare_sector_network: make use of biomass transport file optional --- scripts/prepare_sector_network.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/prepare_sector_network.py b/scripts/prepare_sector_network.py index 2fc7d2f9..0c1faacc 100644 --- a/scripts/prepare_sector_network.py +++ b/scripts/prepare_sector_network.py @@ -2155,13 +2155,12 @@ def add_biomass(n, costs): p_nom_extendable=True, ) - transport_costs = pd.read_csv( - snakemake.input.biomass_transport_costs, - index_col=0, - ).squeeze() - if options["biomass_transport"]: # add biomass transport + transport_costs = pd.read_csv( + snakemake.input.biomass_transport_costs, index_col=0 + ) + transport_costs = transport_costs.squeeze() biomass_transport = create_network_topology( n, "biomass transport ", bidirectional=False ) @@ -2187,6 +2186,10 @@ def add_biomass(n, costs): elif options["biomass_spatial"]: # add artificial biomass generators at nodes which include transport costs + transport_costs = pd.read_csv( + snakemake.input.biomass_transport_costs, index_col=0 + ) + transport_costs = transport_costs.squeeze() bus_transport_costs = spatial.biomass.nodes.to_series().apply( lambda x: transport_costs[x[:2]] )