otoole.results package

Submodules

otoole.results.convert module

Converts an OSeMOSYS solution file from CPLEX, CBC or GLPK into CBC or CSV format

class otoole.results.convert.ConvertLine(data: List[T], start_year: int, end_year: int, output_format='cbc')[source]

Bases: object

Abstract class which defines the interface to the family of convertors

Inherit this class and implement the _do_it() method to produce the data to be written out into a new format

Example

>>> cplex_line = "AnnualCost        REGION  CDBACKSTOP      1.0     0.0     137958.8400384134"
>>> convertor = RegionTechnology()
>>> convertor.convert()
VariableName(REGION,TECHCODE01,2015)       42.69         0\n
VariableName(REGION,TECHCODE01,2017)       137958.84         0\n
convert() → List[str][source]
convert_cbc() → List[str][source]

Format the data for writing to a CBC file

convert_csv() → List[str][source]

Format the data for writing to a csv file

class otoole.results.convert.RegionTechnology(data: List[T], start_year: int, end_year: int, output_format='cbc')[source]

Bases: otoole.results.convert.ConvertLine

class otoole.results.convert.RegionTimeSliceTechnologyMode(data: List[T], start_year: int, end_year: int, output_format='cbc')[source]

Bases: otoole.results.convert.ConvertLine

otoole.results.convert.convert_cplex_file(cplex_filename: str, output_filename: str, start_year=2015, end_year=2070, output_format='cbc')[source]

Converts a CPLEX solution file into that of the CBC solution file

Parameters:
  • cplex_filename (str) – Path to the transformed CPLEX solution file
  • output_filename (str) – Path for the processed data to be written to
otoole.results.convert.process_line(line: str, start_year: int, end_year: int, output_format: str) → List[str][source]

Processes an individual line in a CPLEX file

A different ConvertLine implementation is chosen depending upon the variable name

Parameters:
  • line (str) –
  • start_year (int) –
  • end_year (int) –
  • output_format (str) – The file format required - either csv or cbc

Module contents