otoole.visualise package

Submodules

otoole.visualise.res module

Visualise the reference energy system

otoole.visualise.res.add_fuel(package_rows: List[List[T]]) → List[Tuple[str, Dict[KT, VT]]][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[KT, VT]]], edges: List[Tuple[str, str, Dict[KT, VT]]]) → networkx.classes.digraph.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(datapackage: datapackage.package.Package)[source]

Creates a graph of technologies and fuels

Parameters:datapackage (datapackage.Package) –
Returns:networkx.DiGraph
Return type:graph
otoole.visualise.res.create_res(path_to_datapackage: str, path_to_resfile: str)[source]

Create a reference energy system diagram from a Tabular Data Package

Parameters:
  • path_to_datapackage (str) – The path to the datapackage.json
  • 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[KT, VT]], from_column: str, to_column: str, parameter_name: str, directed: bool = True) → List[Tuple[str, str, Dict[KT, VT]]][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[T]], node_type='technology', color='red', shape='circle') → List[Tuple[str, Dict[KT, VT]]][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

otoole.visualise.res.load_datapackage(path_to_datapackage: str) → datapackage.package.Package[source]

Module contents

Visualise different aspects of an OSeMOSYS model and data

Provides the following commands:

otoole viz res <path_to_datapackage.json> <path_to_res_image>

otoole viz res generates an image of the reference energy system in a datapackage

otoole.visualise.create_res(path_to_datapackage: str, path_to_resfile: str)[source]

Create a reference energy system diagram from a Tabular Data Package

Parameters:
  • path_to_datapackage (str) – The path to the datapackage.json
  • path_to_resfile (str) – The path to the image file to be created