otoole.visualise package#

Submodules#

otoole.visualise.res module#

Visualise the reference energy system

otoole.visualise.res.add_fuel(package_rows: List[List]) List[Tuple[str, Dict]][source]#

Add fuel nodes

Parameters

package_rows (list of dict) –

Returns

A list of node names along with a dict of node attributes

Return type

list of tuple

otoole.visualise.res.build_graph(nodes: List[Tuple[str, Dict]], edges: List[Tuple[str, str, Dict]]) DiGraph[source]#

Builds the graph using networkx

Parameters
  • nodes (list) – A list of node tuples

  • edges (list) – A list of edge tuples

Returns

A directed graph representing the reference energy system

Return type

networkx.DiGraph

otoole.visualise.res.create_graph(input_data: Dict[str, DataFrame])[source]#

Creates a graph of technologies and fuels

Parameters

input_data (Dict[str, pd.DataFrame]) – Internal datastore for otoole input data

Returns

networkx.DiGraph

Return type

graph

otoole.visualise.res.create_res(input_data: Dict[str, DataFrame], path_to_resfile: str)[source]#

Create a reference energy system diagram

Parameters
  • input_data (Dict[str, pd.DataFrame]) – Internal datastore for otoole input data

  • path_to_resfile (str) – The path to the image file to be created

otoole.visualise.res.draw_graph(graph, path_to_resfile)[source]#

Layout the graph and write it to disk

Uses pygraphviz to set some graph attributes, layout the graph and write it to disk

Parameters

path_to_resfile (str) – The file path of the PNG image file that will be created

otoole.visualise.res.extract_edges(package_rows: List[Dict], from_column: str, to_column: str, parameter_name: str, directed: bool = True) List[Tuple[str, str, Dict]][source]#

Add edges from a Tabular Data Table

Parameters
  • package_rows (list of dict) –

  • from_column (str) – The name of the column to use as source of the edge

  • to_column (str) – The name of the column to use as a destination of the edge

  • parameter_name (str) – The name of the parameter

  • directed (bool, default=True) – Specifies whether the edge should have an arrow or not

Returns

A list of edges with from/to nodes names and edge attributes

Return type

list of tuple

otoole.visualise.res.extract_nodes(package_rows: List[List], node_type='technology', color='red', shape='circle') List[Tuple[str, Dict]][source]#

Add nodes from a Tabular Data Table

Parameters
  • package_rows (list of dict) –

  • node_type (str, default='technology') –

  • color (str, default='red') –

  • shape (str, default='circle') –

Returns

A list of nodes with attributes

Return type

list of tuple

Module contents#

Visualise different aspects of an OSeMOSYS model and data

Provides the following commands:

otoole viz res <input_data_format> <path_to_input_data> <path_to_res_image> <path_to_user_config>

otoole viz res generates an image of the reference energy system

otoole.visualise.create_res(input_data: Dict[str, DataFrame], path_to_resfile: str)[source]#

Create a reference energy system diagram

Parameters
  • input_data (Dict[str, pd.DataFrame]) – Internal datastore for otoole input data

  • path_to_resfile (str) – The path to the image file to be created