-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Biomass transport #73
Merged
Merged
Changes from 16 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
2b9ac51
update mocksnakemake for testing
lisazeyen b4f1c57
move input data path for emobility/transport data to snakemake input
lisazeyen cdaa458
Snakefile: add transport input data to rule prepare_sector_network
lisazeyen 50b4e82
config: add missing color for industry electricity
lisazeyen 2dd97c3
Snakefile: add path to biomass transport cost in rule prepare_sector_…
lisazeyen 651a7ff
add biomass transport, split potential for solid biomass to nodes, ad…
lisazeyen 3944e19
config.yaml: add color for biomass transport
lisazeyen ae9c0d9
prepare_sector_network: split industry demand for biomass to single n…
lisazeyen 13cae7d
drop nan values to avoid runtime error when removing todays electric…
lisazeyen b4fbb47
fix bug when adding biomass industry demand, add option to remove bio…
lisazeyen 4f2135a
add option for solid biomass transport
lisazeyen 846f57f
add script for biomass transport costs. Converts JRC-EU-Times transpo…
lisazeyen fa8f788
Update scripts/prepare_sector_network.py
fneum 4ebbd29
apply suggestions from code review
fneum e97c4dd
merge master
fneum fd1121a
add rule for build_biomass_transport_costs
fneum d1298fa
use spatial namespace to manage biomass transport resolution
fneum 3f43656
call define_spatial
fneum dd0ab87
Merge pull request #152 from PyPSA/biomass-transport-rev
lisazeyen ba9be74
make build_biomass_transport_costs fully optional
fneum 0da8f8f
Merge branch 'master' into biomass-transport
fneum d428c1b
fix syntax and auto-retrieve biomass transport cost
fneum 6711d72
biomass_transport: fix cost calculation and get from remote
fneum 3eb404f
biomass_transport: correct and simplify spatial management
fneum 7ca4f04
biomass_transport: reduce output files
fneum edf3a5f
biomass_transport: clarify meaning in config
fneum 928d1f2
biomass_transport: improve spatial biomass potential handling
fneum 12f385e
biomass_transport: simplify read-in
fneum 2e2a66e
biomass_transport: add release notes and documentation
fneum b391aa6
Update build_biomass_transport_costs.py
lisazeyen 385779f
Merge branch 'master' into biomass-transport
fneum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got an error here, I would suggest to change it to:
transport_costs.to_csv(snakemake.output[0])