2023-03-06 08:27:45 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2023-03-06 17:49:23 +00:00
|
|
|
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
2021-07-02 09:07:35 +00:00
|
|
|
"""
|
|
|
|
Reads biomass transport costs for different countries of the JRC report.
|
|
|
|
|
|
|
|
"The JRC-EU-TIMES model.
|
|
|
|
Bioenergy potentials
|
|
|
|
for EU and neighbouring countries."
|
|
|
|
(2015)
|
|
|
|
|
|
|
|
converts them from units 'EUR per km/ton' -> 'EUR/ (km MWh)'
|
|
|
|
|
|
|
|
assuming as an approximation energy content of wood pellets
|
|
|
|
|
|
|
|
@author: bw0928
|
|
|
|
"""
|
|
|
|
|
|
|
|
import pandas as pd
|
|
|
|
import tabula as tbl
|
|
|
|
|
2021-08-09 14:30:38 +00:00
|
|
|
ENERGY_CONTENT = 4.8 # unit MWh/t (wood pellets)
|
2021-07-02 09:07:35 +00:00
|
|
|
|
2021-08-09 14:30:38 +00:00
|
|
|
|
|
|
|
def get_countries():
|
|
|
|
pandas_options = dict(skiprows=range(6), header=None, index_col=0)
|
|
|
|
|
|
|
|
return tbl.read_pdf(
|
|
|
|
str(snakemake.input.transport_cost_data),
|
|
|
|
pages="145",
|
|
|
|
multiple_tables=False,
|
|
|
|
pandas_options=pandas_options,
|
|
|
|
)[0].index
|
2021-07-02 09:07:35 +00:00
|
|
|
|
|
|
|
|
2021-08-09 14:30:38 +00:00
|
|
|
def get_cost_per_tkm(page, countries):
|
|
|
|
pandas_options = dict(
|
|
|
|
skiprows=range(6),
|
|
|
|
header=0,
|
|
|
|
sep=" |,",
|
|
|
|
engine="python",
|
|
|
|
index_col=False,
|
2021-07-02 09:07:35 +00:00
|
|
|
)
|
2021-08-09 14:30:38 +00:00
|
|
|
|
|
|
|
sc = tbl.read_pdf(
|
|
|
|
str(snakemake.input.transport_cost_data),
|
|
|
|
pages=page,
|
|
|
|
multiple_tables=False,
|
|
|
|
pandas_options=pandas_options,
|
|
|
|
)[0]
|
|
|
|
sc.index = countries
|
|
|
|
sc.columns = sc.columns.str.replace("€", "EUR")
|
2023-03-06 08:27:45 +00:00
|
|
|
|
2021-08-09 14:30:38 +00:00
|
|
|
return sc
|
2021-07-02 09:07:35 +00:00
|
|
|
|
|
|
|
|
2021-08-09 14:30:38 +00:00
|
|
|
def build_biomass_transport_costs():
|
|
|
|
countries = get_countries()
|
2021-07-02 09:07:35 +00:00
|
|
|
|
2021-08-09 14:30:38 +00:00
|
|
|
sc1 = get_cost_per_tkm(146, countries)
|
|
|
|
sc2 = get_cost_per_tkm(147, countries)
|
2021-07-02 09:07:35 +00:00
|
|
|
|
2021-08-09 14:30:38 +00:00
|
|
|
# take mean of both supply chains
|
|
|
|
to_concat = [sc1["EUR/km/ton"], sc2["EUR/km/ton"]]
|
|
|
|
transport_costs = pd.concat(to_concat, axis=1).mean(axis=1)
|
|
|
|
|
|
|
|
# convert tonnes to MWh
|
2021-07-02 09:07:35 +00:00
|
|
|
transport_costs /= ENERGY_CONTENT
|
2021-08-09 14:30:38 +00:00
|
|
|
transport_costs.name = "EUR/km/MWh"
|
|
|
|
|
|
|
|
# rename country names
|
|
|
|
to_rename = {"UK": "GB", "XK": "KO", "EL": "GR"}
|
|
|
|
transport_costs.rename(to_rename, inplace=True)
|
2021-07-02 09:07:35 +00:00
|
|
|
|
2021-08-09 14:30:38 +00:00
|
|
|
# add missing Norway with data from Sweden
|
|
|
|
transport_costs["NO"] = transport_costs["SE"]
|
2021-07-02 09:07:35 +00:00
|
|
|
|
2021-09-24 12:59:53 +00:00
|
|
|
transport_costs.to_csv(snakemake.output[0])
|
2021-07-02 09:07:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2021-07-12 10:31:18 +00:00
|
|
|
build_biomass_transport_costs()
|