add rule for build_biomass_transport_costs
This commit is contained in:
parent
e97c4dd3c0
commit
fd1121af4a
18
Snakefile
18
Snakefile
@ -180,6 +180,18 @@ rule build_biomass_potentials:
|
|||||||
script: 'scripts/build_biomass_potentials.py'
|
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'
|
||||||
|
|
||||||
|
|
||||||
rule build_ammonia_production:
|
rule build_ammonia_production:
|
||||||
input:
|
input:
|
||||||
usgs="data/myb1-2017-nitro.xls"
|
usgs="data/myb1-2017-nitro.xls"
|
||||||
@ -321,10 +333,10 @@ rule prepare_sector_network:
|
|||||||
energy_totals_name='resources/energy_totals.csv',
|
energy_totals_name='resources/energy_totals.csv',
|
||||||
co2_totals_name='resources/co2_totals.csv',
|
co2_totals_name='resources/co2_totals.csv',
|
||||||
transport_name='resources/transport_data.csv',
|
transport_name='resources/transport_data.csv',
|
||||||
traffic_data_KFZ = "data/emobility/KFZ__count",
|
traffic_data_KFZ="data/emobility/KFZ__count",
|
||||||
traffic_data_Pkw = "data/emobility/Pkw__count",
|
traffic_data_Pkw="data/emobility/Pkw__count",
|
||||||
biomass_potentials='resources/biomass_potentials.csv',
|
biomass_potentials='resources/biomass_potentials.csv',
|
||||||
biomass_transport='data/biomass/biomass_transport_costs.csv',
|
biomass_transport="resources/biomass_transport_costs.csv",
|
||||||
heat_profile="data/heat_load_profile_BDEW.csv",
|
heat_profile="data/heat_load_profile_BDEW.csv",
|
||||||
costs=CDIR + "costs_{planning_horizons}.csv",
|
costs=CDIR + "costs_{planning_horizons}.csv",
|
||||||
profile_offwind_ac=pypsaeur("resources/profile_offwind-ac.nc"),
|
profile_offwind_ac=pypsaeur("resources/profile_offwind-ac.nc"),
|
||||||
|
70
scripts/build_biomass_transport_costs.py
Normal file
70
scripts/build_biomass_transport_costs.py
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
"""
|
||||||
|
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
|
||||||
|
|
||||||
|
ENERGY_CONTENT = 4.8 # unit MWh/tonne (assuming wood pellets)
|
||||||
|
|
||||||
|
|
||||||
|
def build_biomass_transport_costs():
|
||||||
|
|
||||||
|
df_list = tbl.read_pdf(
|
||||||
|
snakemake.input[0],
|
||||||
|
pages="145-147",
|
||||||
|
multiple_tables=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
countries = df_list[0][0].iloc[6:].rename(index=lambda x: x + 1)
|
||||||
|
|
||||||
|
# supply chain 1
|
||||||
|
df = df_list[1].copy().rename(index=countries.to_dict())
|
||||||
|
df.rename(
|
||||||
|
columns=df.iloc[:6].apply(lambda col: col.str.cat(sep=" "), axis=0).to_dict(),
|
||||||
|
inplace=True,
|
||||||
|
)
|
||||||
|
df = df.iloc[6:]
|
||||||
|
df.loc[6] = df.loc[6].str.replace("€", "EUR")
|
||||||
|
|
||||||
|
# supply chain 2
|
||||||
|
df2 = df_list[2].copy().rename(index=countries.to_dict())
|
||||||
|
df2.rename(
|
||||||
|
columns=df2.iloc[:6].apply(lambda col: col.str.cat(sep=" "), axis=0).to_dict(),
|
||||||
|
inplace=True,
|
||||||
|
)
|
||||||
|
df2 = df2.iloc[6:]
|
||||||
|
df2.loc[6] = df2.loc[6].str.replace("€", "EUR")
|
||||||
|
|
||||||
|
df.to_csv(snakemake.output.supply_chain1)
|
||||||
|
df2.to_csv(snakemake.output.supply_chain1)
|
||||||
|
|
||||||
|
transport_costs = pd.concat([df["per km/ton"], df2["per km/ton"]], axis=1).drop(6)
|
||||||
|
transport_costs = transport_costs.astype(float, errors="ignore").mean(axis=1)
|
||||||
|
|
||||||
|
# convert unit to EUR/MWh
|
||||||
|
transport_costs /= ENERGY_CONTENT
|
||||||
|
transport_costs = pd.DataFrame(transport_costs, columns=["cost [EUR/(km MWh)]"])
|
||||||
|
|
||||||
|
# rename
|
||||||
|
transport_costs.rename({"UK": "GB", "XK": "KO", "EL": "GR"}, inplace=True)
|
||||||
|
|
||||||
|
# add missing Norway
|
||||||
|
transport_costs.loc["NO"] = transport_costs.loc["SE"]
|
||||||
|
transport_costs.to_csv(snakemake.output.transport_costs)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
prepare_biomass_transport_costs()
|
@ -1,62 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""
|
|
||||||
Created on Thu Mar 12 19:11:20 2020
|
|
||||||
|
|
||||||
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
|
|
||||||
from tabula import read_pdf
|
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
# read pdf file
|
|
||||||
df_list = read_pdf("biomass potentials in europe_web rev.pdf",
|
|
||||||
pages="145-147",
|
|
||||||
multiple_tables=True)
|
|
||||||
energy_content = 4.8 # unit MWh/tonne (assuming wood pellets)
|
|
||||||
# %%
|
|
||||||
columns = ["Komponente", "Größe", "Einheit", 2020, 2025, 2030, 2035, 2040,
|
|
||||||
2045, 2050]
|
|
||||||
countries = df_list[0][0].iloc[6:].rename(index=lambda x: x+1)
|
|
||||||
|
|
||||||
# supply chain 1
|
|
||||||
df = df_list[1].copy().rename(index=countries.to_dict())
|
|
||||||
df.rename(columns= df.iloc[:6].apply(lambda col: col.str.cat(sep=" "),
|
|
||||||
axis=0).to_dict(), inplace=True)
|
|
||||||
df = df.iloc[6:]
|
|
||||||
df.loc[6]=df.loc[6].str.replace("€", "EUR")
|
|
||||||
|
|
||||||
# supply chain 2
|
|
||||||
df2 = df_list[2].copy().rename(index=countries.to_dict())
|
|
||||||
df2.rename(columns= df2.iloc[:6].apply(lambda col: col.str.cat(sep=" "),
|
|
||||||
axis=0).to_dict(), inplace=True)
|
|
||||||
df2 = df2.iloc[6:]
|
|
||||||
df2.loc[6]=df2.loc[6].str.replace("€", "EUR")
|
|
||||||
|
|
||||||
#%%
|
|
||||||
df.to_csv("biomass_transport_costs_supply_chain1.csv")
|
|
||||||
df2.to_csv("biomass_transport_costs_supply_chain2.csv")
|
|
||||||
|
|
||||||
transport_costs = pd.concat([df['per km/ton'], df2['per km/ton']],axis=1).drop(6)
|
|
||||||
transport_costs = transport_costs.astype(float, errors="ignore").mean(axis=1)
|
|
||||||
|
|
||||||
# convert unit to EUR/MWh
|
|
||||||
transport_costs /= energy_content
|
|
||||||
transport_costs = pd.DataFrame(transport_costs, columns=["cost [EUR/(km MWh)]"])
|
|
||||||
# rename
|
|
||||||
transport_costs.rename({"UK": "GB", "XK": "KO", "EL": "GR"}, inplace=True)
|
|
||||||
# add missing Norway
|
|
||||||
transport_costs.loc["NO"] = transport_costs.loc["SE"]
|
|
||||||
transport_costs.to_csv("biomass_transport_final.csv")
|
|
Loading…
Reference in New Issue
Block a user