stemp_abw.results package

Submodules

stemp_abw.results.io module

stemp_abw.results.io.oemof_json_to_results(results_json)[source]

Convert stored oemof results json back to result dicts

Parameters:results_json (JSON formatted str) – Format see stemp_abw.results.tools.oemof_results_to_json()
Returns:
  • dict – Results from optimization as returned by oemof.outputlib.processing.results() (sequences only without timestamps, no scalars)
  • dict – Parameters of optimization as returned by oemof.outputlib.processing.parameter_as_dict() (scalars only, no sequences)
stemp_abw.results.io.oemof_results_to_json(results, param_results)[source]

Convert oemof raw results to json

Parameters:
  • results (dict) – Results from optimization as returned by oemof.outputlib.processing.results()
  • param_results (dict) – Parameters of optimization as returned by oemof.outputlib.processing.parameter_as_dict()
Returns:

Serialized results, format: {‘param_results’:

{‘node_from_1’:
{‘node_to_1’: {‘scalars’: {‘param_1’: val_1,

’param_2’: val_2}

}

}

},

’results’:
{‘node_from_1’:
{‘node_to_1’: {‘sequences’: [n values]

}

}

}

}

Return type:

JSON formatted str

Notes

  • Node keys in results and para_results must be provided as strings using oemof.outputlib.processing.convert_keys_to_strings()
  • In the sequences, timestamps are not preserved (values only)

stemp_abw.results.result_charts module

stemp_abw.results.results module

class stemp_abw.results.results.ResultChart(setup_labels, type=None, data=None)[source]

Bases: object

Scenarios are loaded, analyzed and visualized within this class

visualize(**kwargs)[source]
class stemp_abw.results.results.Results(simulation)[source]

Bases: object

Results associated to Simulation

TODO: Complete docstring

aggregate_flow_results(nodes_from, nodes_to, results_raw, resample_mode=None, agg_mode='sum')[source]

Aggregate raw data for each node in nodes_from to nodes_to.

Either nodes_from or nodes_to must contain a single node label, the other one can contain one or more labels.

Parameters:
  • nodes_from (list of str) – Source node labels, e.g. [‘bus_el’]
  • nodes_to (list of str) – Target node labels, e.g. [‘gen_el_wind’, ‘gen_el_pv_ground’]
  • results_raw (dict of pandas.DataFrame) – Raw result data from optimization as created by oemof
  • resample_mode (str or None) – Resampling option according to pandas.DataFrame.resample If None, no resampling takes place and agg_mode is not used. Examples: ‘A’ (year), ‘M’ (month) Default: None
  • agg_mode (str) – Aggregation mode for resampling given in resample_mode, possible values: ‘sum’, ‘mean’ Default: ‘sum’
Returns:

  • * If resample_mode is None – pandas.DataFrame with raw timeseries

  • * If resample_mode is not None –

    list of tuple

    Sum of annual flow by source or target node, format: [(‘name_1’, [value_11, …, value_1n]),

    …,

    (‘name_n’, [value_n1, …, value_nn])]

  • # TODO (Always return DF, move conversion to chart-usable format to other fct)

get_layer_results()[source]

Analyze results and return data for layer display

get_node_results_df(node_label)[source]

Return DataFrame with optimization results (timeseries) for single node.

Parameters:node_label (str) – Label of node the data should be looked up for
Returns:Node results (timeseries)
Return type:pandas.DataFrame
static get_raw_results_df(results_raw)[source]

Return DataFrame with optimization results (timeseries) for all nodes for given raw results

Parameters:results_raw (dict of pandas.DataFrame) – Raw result data from optimization as created by oemof
Returns:Node results (timeseries)
Return type:pandas.DataFrame
get_result_charts_data()[source]

Analyze results and return data for panel display

set_result_raw_data(results_raw, param_results_raw)[source]
update_mun_energy_results_post_simulation()[source]

Update energy results in mun data of user scenario

stemp_abw.results.serializers module

class stemp_abw.results.serializers.ResultLayerDataSerializer(options)[source]

Bases: object

Serializer for GeoJSON result layers

get_features(queryset)[source]
serialize(queryset)[source]

Serialize queryset

Module contents