Skip to content

Commit

Permalink
Merge branch 'yerbol-akhmetov-fix_biomass_transport'
Browse files Browse the repository at this point in the history
  • Loading branch information
fneum committed May 20, 2024
2 parents d32feb3 + 849bdae commit 8b303d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ Upcoming Release

* Mark downloaded files as ``ancient`` rather than ``protected``.

* Fix file name enconding in optional rule :mod:`build_biomass_transport_costs` depending on the operating system.

PyPSA-Eur 0.10.0 (19th February 2024)
=====================================

Expand Down
11 changes: 10 additions & 1 deletion scripts/build_biomass_transport_costs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,27 @@
@author: bw0928
"""

import platform

import pandas as pd
import tabula as tbl

ENERGY_CONTENT = 4.8 # unit MWh/t (wood pellets)
system = platform.system()
encoding = "cp1252" if system == "Windows" else None


def get_countries():
pandas_options = dict(skiprows=range(6), header=None, index_col=0)
pandas_options = dict(
skiprows=range(6), header=None, index_col=0, encoding=encoding
)

return tbl.read_pdf(
str(snakemake.input.transport_cost_data),
pages="145",
multiple_tables=False,
pandas_options=pandas_options,
encoding=encoding,
)[0].index


Expand All @@ -41,13 +48,15 @@ def get_cost_per_tkm(page, countries):
sep=" |,",
engine="python",
index_col=False,
encoding=encoding,
)

sc = tbl.read_pdf(
str(snakemake.input.transport_cost_data),
pages=page,
multiple_tables=False,
pandas_options=pandas_options,
encoding=encoding,
)[0]
sc.index = countries
sc.columns = sc.columns.str.replace("€", "EUR")
Expand Down

0 comments on commit 8b303d9

Please sign in to comment.