Skip to content

Commit

Permalink
Split optimization and plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
simnh committed Feb 28, 2019
1 parent a7595b8 commit 1c9dc58
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 25 deletions.
26 changes: 1 addition & 25 deletions src/oemof/tabular/examples/scripting/dispatch.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import pkg_resources as pkg
import pandas as pd
import plotly.offline as offline

from oemof.solph import EnergySystem, Model, Bus
import oemof.tabular.tools.postprocessing as pp
Expand Down Expand Up @@ -85,27 +84,4 @@
# writing results with the standard oemof-tabular output formatt
pp.write_results(m, results_path)


if False:
from oemof.tabular.tools.plots import hourly_plot, stacked_plot
# plot results with plotly
offline.plot(
hourly_plot(
'dispatch',
'DE',
os.path.join(
os.path.expanduser('~'),
"oemof-results")
),
filename=os.path.join(results_path, 'hourly-plot.html'))


# plot results with plotly
offline.plot(
stacked_plot(
'dispatch',
os.path.join(
os.path.expanduser('~'),
"oemof-results")
),
filename=os.path.join(results_path, 'stacked-plot.html'))
print('Optimization done. Results are in {}.'.format(results_path))
36 changes: 36 additions & 0 deletions src/oemof/tabular/examples/scripting/plotting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import os

import plotly.offline as offline

from oemof.tabular.tools.plots import hourly_plot, stacked_plot
# plot results with plotly

name = "dispatch"

# results path for output
results_path = os.path.join(
os.path.expanduser('~'),
"oemof-results",
name,
"output")

offline.plot(
hourly_plot(
name,
'DE',
os.path.join(
os.path.expanduser('~'),
"oemof-results")
),
filename=os.path.join(results_path, 'hourly-plot.html'))


# plot results with plotly
offline.plot(
stacked_plot(
name,
os.path.join(
os.path.expanduser('~'),
"oemof-results")
),
filename=os.path.join(results_path, 'stacked-plot.html'))

0 comments on commit 1c9dc58

Please sign in to comment.