Skip to content
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

Plot scalar results #93

Merged
merged 41 commits into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d5277ba
Add rule for plotting of scalar results
jnnr Nov 24, 2021
08c6f35
Fix wrong whitespace
jnnr Nov 24, 2021
116de62
Include scalar plots in static report
jnnr Nov 24, 2021
35020e9
Add title
jnnr Nov 24, 2021
da15779
Set correct unit
jnnr Dec 13, 2021
813187e
Rearrange plots in reports
jnnr Dec 14, 2021
6761a1c
Remove --standalone flag as it is implied by --self-contained
jnnr Dec 14, 2021
dd01ded
Update scripts/plot_scalar_results.py
jnnr Jan 17, 2022
ec05d1e
Use directory as input to connect the snakemake dag
jnnr Jan 17, 2022
637eb3d
Merge branch 'features/plot-scalar-results' of github.com:rl-institut…
jnnr Jan 17, 2022
f0eb5fd
Use data processing functions
jnnr Jan 17, 2022
bf38fca
Define units as a constant
jnnr Jan 17, 2022
03aaa2d
Continue if data is empty
jnnr Jan 17, 2022
72ee668
Add labels
jnnr Jan 18, 2022
401926e
Add variable to plot
jnnr Jan 18, 2022
e095400
Put legend beneath plot
jnnr Jan 18, 2022
86abb6f
Stack bars
jnnr Jan 18, 2022
2ca2514
Fix unit conversion
jnnr Jan 18, 2022
7cfc967
Remove clutter
jnnr Jan 18, 2022
ae531ef
Add more variables to plot
jnnr Jan 18, 2022
7bc9f9a
Fix regions
jnnr Jan 18, 2022
347edbf
Merge remote-tracking branch 'origin/dev' into features/plot-scalar-r…
jnnr Feb 18, 2022
2a97f90
Restructure scalar plots to allow custom filtering and adaptions
jnnr Feb 18, 2022
53ae3c4
Fix filtering
jnnr Feb 18, 2022
7fe78bb
Fix units
jnnr Feb 18, 2022
4783073
Add plot of invested capacity
jnnr Feb 18, 2022
19afad9
Rename functions and remove unused parameter
jnnr Feb 18, 2022
b96ffb5
Add plot for storage investment
jnnr Feb 18, 2022
9a67581
Merge remote-tracking branch 'origin/dev' into features/plot-scalar-r…
jnnr Feb 24, 2022
c19747a
Merge remote-tracking branch 'origin/dev' into features/plot-scalar-r…
jnnr Feb 25, 2022
45f822a
Fix labels and colors
jnnr Feb 25, 2022
a4d34a1
Set flake8 exception
jnnr Feb 25, 2022
ecbd6df
Fix join_scenarios
jnnr Feb 25, 2022
640f7a7
Set multiindex axes label on xaxes
jnnr Feb 25, 2022
455fa85
Use the same plotting functions for single and multi-scenario plots
jnnr Feb 25, 2022
20fc03d
Delete obsolete multi-scenario plotting script
jnnr Feb 25, 2022
e6d9ecd
Black
jnnr Feb 25, 2022
290aef1
Filter by carrier for storage_capacity and storage_invest plot
jnnr Feb 25, 2022
0ebdfb2
Create plots for electricity and heat
jnnr Feb 25, 2022
83160cf
Do not save if plot failed
jnnr Feb 25, 2022
3fda2da
Do not plot empty or all zero data
jnnr Feb 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ rule plot_dispatch:
input:
"results/{scenario}/postprocessed/"
output:
directory("results/{scenario}/plotted/")
directory("results/{scenario}/plotted/dispatch")
shell:
"python scripts/plot_dispatch.py {input} {output}"

Expand All @@ -200,6 +200,22 @@ rule plot_conv_pp_scalars:
shell:
"python {input.script} {input.data} {wildcards.var_name} {output}"

rule plot_scalar_results:
input:
"results/{scenario}/postprocessed/scalars.csv"
output:
directory("results/{scenario}/plotted/scalars/")
shell:
"python scripts/plot_scalar_results.py {input} {output}"

rule plot_joined_scalars:
input:
"results/joined_scenarios/{scenario_list}/joined/scalars.csv"
output:
directory("results/joined_scenarios/{scenario_list}/joined_plotted/")
shell:
"python scripts/plot_scalar_results.py {input} {output}"

rule report:
input:
template="report/report.md",
Expand Down Expand Up @@ -260,11 +276,3 @@ rule join_scenario_results:
"results/joined_scenarios/{scenario_group}/joined/scalars.csv"
shell:
"python scripts/join_scenarios.py {input} {output}"

rule plot_joined_scalars:
input:
"results/joined_scenarios/{scenario_group}/joined/scalars.csv"
output:
directory("results/joined_scenarios/{scenario_group}/joined_plotted/")
shell:
"python scripts/plot_joined_scalars.py {input} {output}"
6 changes: 0 additions & 6 deletions docs/plotting/plot_joined_scalars.rst

This file was deleted.

3 changes: 2 additions & 1 deletion oemof_b3/config/colors.csv
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Curtailment,#7f7f7f

El. demand,#000000
El. Export,#8c564b
El. Import,8c564b
El. Import,#8c564b
BEV charging,#000000

H2 Backpressure CHP,magenta
CH4 Backpressure CHP,brown
Expand Down
2 changes: 2 additions & 0 deletions oemof_b3/config/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ ch4-boiler: CH4 Boiler
ch4-bpchp: CH4 Backpressure CHP
ch4-extchp: CH4 Extraction CHP
ch4-gt: CH4 GT
electricity-bev_charging: BEV charging
electricity-curtailment: Curtailment
electricity-demand: El. demand
electricity-electrolyzer: Electrolyzer
Expand All @@ -22,6 +23,7 @@ hydro-ror: Hydro ROR
solar-pv: PV
wind-onshore: Wind on
h2-bpchp: H2 Backpressure CHP
h2-cavern: H2 Cavern
ch4-export: CH4 Export
ch4-import: CH4 Import
h2-export: H2 Export
Expand Down
22 changes: 18 additions & 4 deletions report/report.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
## Main results

## Scalar plots
![Capacities](scalars/capacity.png)

![Energy per year](scalars/flow_out_electricity.png)


## Electricity dispatch
\center
![Electricity dispatch winter](dispatch/BB-electricity_01.png)

![Electricity dispatch summer](dispatch/BB-electricity_07.png)

![Electricity dispatch winter](dispatch/B-electricity_01.png)

![Electricity dispatch summer](dispatch/B-electricity_07.png)


## Heat dispatch
\center
![Plot 1](BB-electricity_01.png)
![Heat dispatch winter](dispatch/BB-heat_decentral_01.png)

![Plot 2](BB-electricity_07.png)
![Heat dispatch summer](dispatch/BB-heat_decentral_07.png)

![Plot 3](BE-electricity_01.png)
![Heat dispatch winter](dispatch/B-heat_decentral_01.png)

![Plot 4](BE-electricity_07.png)
![Heat dispatch summer](dispatch/B-heat_decentral_07.png)
4 changes: 2 additions & 2 deletions report/report_interactive.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
## Electricity dispatch

\center
![Plot 1](BB-electricity_dispatch_interactive.html){width=900px height=500px}
![Plot 1](dispatch/BB-electricity_dispatch_interactive.html){width=900px height=500px}

![Plot 2](BE-electricity_dispatch_interactive.html){width=900px height=500px}
![Plot 2](dispatch/B-electricity_dispatch_interactive.html){width=900px height=500px}
15 changes: 5 additions & 10 deletions scripts/join_scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import sys

import pandas as pd
from oemoflex.tools.helpers import load_yaml


def load_scalars(path):
Expand All @@ -30,18 +29,14 @@ def load_scalars(path):


if __name__ == "__main__":
list_scenarios = sys.argv[1]
paths_scenarios = sys.argv[1:-1]

destination = sys.argv[2]

scenarios = load_yaml(list_scenarios)
destination = sys.argv[-1]

joined_scalars = list()
for scenario in scenarios:
scalars = load_scalars(
os.path.join("results", scenario, "postprocessed", "scalars.csv")
)
scalars["scenario"] = scenario
for path_sc in paths_scenarios:
scalars = load_scalars(os.path.join(path_sc, "scalars.csv"))

joined_scalars.append(scalars)

joined_scalars = pd.concat(joined_scalars)
Expand Down
186 changes: 0 additions & 186 deletions scripts/plot_joined_scalars.py

This file was deleted.

Loading