Model

class OBLib.Model.Model[source]

Bases: object

Abstract model class. This is the top-level class and should not be used directly. Instead this class is inherited by other more specialised model classes.

property inputs

The model inputs. Access this object to change the model inputs.

Read-only property.

Return type

ScheduleInputs

run()[source]

Runs the model.

This is an abstract method and should be overloaded by subclasses.

Returns

The model outputs.

Return type

DeterministicOutputs

class OBLib.Model.Inputs[source]

Bases: object

Abstract model inputs class. This is the top-level class and should not be used directly. Instead this class is inherited by other more specialised model inputs classes.

set_timestamps(start=None, end=None, *args, **kwargs)[source]

Convenience method to set the timestamps property.

Parameters
  • start (tuple) – The start timestamp (optional)

  • end (tuple) – The end timestamp (optional)

The remaining input arguments here are passed to the pandas.date_range method. See the pandas documentation for details.

Typcial inputs might be:

  • start=(2021,1,1,0,0) (i.e. 1st January 2021)

  • freq=’H’ (for hourly intervals)

  • periods=24 (to generate 1 day of hourly intervals)

Return type

pandas.DatetimeIndex

property timestamps

The input timestamps. Model predictions will be made for each timestamp.

Read / write property.

Return type

pandas.DatetimeIndex

class OBLib.Model.Outputs[source]

Bases: object

Abstract model outputs class. This is the top-level class and should not be used directly. Instead this class is inherited by other more specialised model outputs classes.

property data

The model predictions.

Read-only property.

Returns

A dictionary of the model results. Key-value pairs are: keys -> the name of the quantity or variable; values -> a list of the model predictions (this list aligns with the output timestamps).

Return type

dict

property df

A Pandas dataframe of the timestamps and data.

Read-only property.

Returns

A dataframe with: index -> timestamps; columns -> ‘data’ keys; values -> data values.

Return type

pandas.DataFrame

property timestamps

The outputs timestamps.

Read-only property.

Return type

pandas.DatetimeIndex