From 7cb564c1063abe6c2e2ee49888b3b57a1c8c0d29 Mon Sep 17 00:00:00 2001 From: uwe Date: Fri, 12 Aug 2016 17:25:43 +0200 Subject: [PATCH] change keys "tobus" and "frombus" to "to_bus" and "from_bus" --- examples/example_tests.py | 32 +++++++++---------- .../simple_least_costs/simple_least_costs.py | 2 +- .../storage_optimization/storage_invest.py | 6 ++-- oemof/outputlib/__init__.py | 12 +++---- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/examples/example_tests.py b/examples/example_tests.py index 63ca96c95..dde252f8a 100644 --- a/examples/example_tests.py +++ b/examples/example_tests.py @@ -123,22 +123,22 @@ def check_nosetests(): test_results = { 'objective': 2947725.249402091, - ('b_el', 'tobus', 'pp_chp', 'val'): 11161.357450000065, - ('b_el', 'tobus', 'pp_coal', 'val'): 33723.047672110595, - ('b_el', 'tobus', 'pp_gas', 'val'): 30412.377779000046, - ('b_el', 'tobus', 'pp_lig', 'val'): 22066.451080999268, - ('b_el', 'tobus', 'pp_oil', 'val'): 2.2872599999999998, - ('b_el', 'tobus', 'pv', 'val'): 7796.8431880300122, - ('b_el', 'tobus', 'wind', 'val'): 28009.549502999955, - ('b_el', 'frombus', 'demand_el', 'val'): 132243.7904593189, - ('b_el', 'frombus', 'excess', 'val'): 928.12139200000013, - ('b_th', 'tobus', 'pp_chp', 'val'): 14881.810039999958, - ('b_th', 'frombus', 'demand_th', 'val'): 14881.80983624002, - ('coal', 'frombus', 'pp_coal', 'val'): 86469.394787298472, - ('gas', 'frombus', 'pp_chp', 'val'): 37204.525720000034, - ('gas', 'frombus', 'pp_gas', 'val'): 60824.751778000136, - ('lignite', 'frombus', 'pp_lig', 'val'): 53820.634704001102, - ('oil', 'frombus', 'pp_oil', 'val'): 8.1687949999999994} + ('b_el', 'to_bus', 'pp_chp', 'val'): 11161.357450000065, + ('b_el', 'to_bus', 'pp_coal', 'val'): 33723.047672110595, + ('b_el', 'to_bus', 'pp_gas', 'val'): 30412.377779000046, + ('b_el', 'to_bus', 'pp_lig', 'val'): 22066.451080999268, + ('b_el', 'to_bus', 'pp_oil', 'val'): 2.2872599999999998, + ('b_el', 'to_bus', 'pv', 'val'): 7796.8431880300122, + ('b_el', 'to_bus', 'wind', 'val'): 28009.549502999955, + ('b_el', 'from_bus', 'demand_el', 'val'): 132243.7904593189, + ('b_el', 'from_bus', 'excess', 'val'): 928.12139200000013, + ('b_th', 'to_bus', 'pp_chp', 'val'): 14881.810039999958, + ('b_th', 'from_bus', 'demand_th', 'val'): 14881.80983624002, + ('coal', 'from_bus', 'pp_coal', 'val'): 86469.394787298472, + ('gas', 'from_bus', 'pp_chp', 'val'): 37204.525720000034, + ('gas', 'from_bus', 'pp_gas', 'val'): 60824.751778000136, + ('lignite', 'from_bus', 'pp_lig', 'val'): 53820.634704001102, + ('oil', 'from_bus', 'pp_oil', 'val'): 8.1687949999999994} check(test_results, least_costs_run, testdict['least_costs'], results) # *********** end of simple least cost example ******************************* diff --git a/examples/solph/simple_least_costs/simple_least_costs.py b/examples/solph/simple_least_costs/simple_least_costs.py index 26034f82d..b542e90f3 100644 --- a/examples/solph/simple_least_costs/simple_least_costs.py +++ b/examples/solph/simple_least_costs/simple_least_costs.py @@ -132,7 +132,7 @@ def plot_results(energysystem): # create multiindex dataframe with result values esplot = output.DataFramePlot(energy_system=energysystem) # select input results of electrical bus (i.e. power delivered by plants) - esplot.slice_unstacked(bus_label="b_el", type="tobus", + esplot.slice_unstacked(bus_label="b_el", type="to_bus", date_from='2012-01-01 00:00:00', date_to='2012-01-07 00:00:00') # set colorlist for esplot diff --git a/examples/solph/storage_optimization/storage_invest.py b/examples/solph/storage_optimization/storage_invest.py index b3e967f97..02e57b08f 100644 --- a/examples/solph/storage_optimization/storage_invest.py +++ b/examples/solph/storage_optimization/storage_invest.py @@ -141,7 +141,7 @@ def get_result_dict(energysystem): storage = energysystem.groups['storage'] myresults = outputlib.DataFramePlot(energy_system=energysystem) - pp_gas = myresults.slice_by(obj_label='pp_gas', type='tobus', + pp_gas = myresults.slice_by(obj_label='pp_gas', type='to_bus', date_from='2012-01-01 00:00:00', date_to='2012-12-31 23:00:00') @@ -182,7 +182,7 @@ def create_plots(energysystem): # Plotting the input flows of the electricity bus for January myplot = outputlib.DataFramePlot(energy_system=energysystem) - myplot.slice_unstacked(bus_label="electricity", type="tobus", + myplot.slice_unstacked(bus_label="electricity", type="to_bus", date_from="2012-01-01 00:00:00", date_to="2012-01-31 00:00:00") colorlist = myplot.color_from_dict(cdict) @@ -193,7 +193,7 @@ def create_plots(energysystem): myplot.set_datetime_ticks(date_format='%d-%m-%Y', tick_distance=24*7) # Plotting the output flows of the electricity bus for January - myplot.slice_unstacked(bus_label="electricity", type="frombus") + myplot.slice_unstacked(bus_label="electricity", type="from_bus") myplot.plot(title="Year 2016", colormap='Spectral', linewidth=2) myplot.ax.legend(loc='upper right') myplot.ax.set_ylabel('Power in MW') diff --git a/oemof/outputlib/__init__.py b/oemof/outputlib/__init__.py index d16e78ae1..cf682ea5b 100644 --- a/oemof/outputlib/__init__.py +++ b/oemof/outputlib/__init__.py @@ -54,7 +54,7 @@ def __init__(self, **kwargs): if k is kk: row['type'] = 'other' else: - row['type'] = 'frombus' + row['type'] = 'from_bus' if k is kk: row['obj_label'] = 'duals' elif isinstance(kk, str): @@ -81,7 +81,7 @@ def __init__(self, **kwargs): # bus inputs (only self ref. components) row = dict() row['bus_label'] = list(k.outputs.keys())[0].label - row['type'] = 'tobus' + row['type'] = 'to_bus' row['obj_label'] = k.label row['datetime'] = es.time_idx row['val'] = v.get(list(k.outputs.keys())[0]) @@ -91,7 +91,7 @@ def __init__(self, **kwargs): # bus inputs (results[component][bus]) row = dict() row['bus_label'] = kk.label - row['type'] = 'tobus' + row['type'] = 'to_bus' row['obj_label'] = k.label row['datetime'] = es.time_idx row['val'] = vv @@ -119,7 +119,7 @@ def slice_by(self, **kwargs): Parameters ---------- bus_label : string - type : string (tobus/frombus/other) + type : string (to_bus/from_bus/other) obj_label: string date_from : string Start date selection e.g. "2016-01-01 00:00:00". If not set, the @@ -396,7 +396,7 @@ def io_plot(self, bus_label, cdict, line_kwa=None, lineorder=None, self.ax = fig.add_subplot(1, 1, 1) # Create a bar plot for all input flows - self.slice_unstacked(bus_label=bus_label, type='tobus', **kwargs) + self.slice_unstacked(bus_label=bus_label, type='to_bus', **kwargs) if barorder is not None: self.rearrange_subset(barorder) self.subset.plot(kind='bar', linewidth=0, stacked=True, width=1, @@ -404,7 +404,7 @@ def io_plot(self, bus_label, cdict, line_kwa=None, lineorder=None, **bar_kwa) # Create a line plot for all output flows - self.slice_unstacked(bus_label=bus_label, type='frombus', **kwargs) + self.slice_unstacked(bus_label=bus_label, type='from_bus', **kwargs) if lineorder is not None: self.rearrange_subset(lineorder) # The following changes are made to have the bottom line on top layer