visualization

Visualization functions

visualization.line

Several line plots of predictions and truths.

make_trace

def make_trace(x, y, truth: bool, show_legend: bool = True)

Make a plotly trace data (x,y).

Arguments:

  • x - time series of data
  • y - values of data
  • truth - if y is the truth or predictions. The colour of the line changed depending on this
  • show_legend - option to show the legend for this trace or not.

Returns:plotly trace

plot_one_result

def plot_one_result(x, y, y_hat)

Plot one result.

Arguments:

  • x - time series for the forecast predictions, should be size [forecast length]
  • y - the truth values of pv yield, should be size [forecast length]
  • y_hat - the predicted values of pv yield, should be size [forecast length]

Returns:a plotly figure

plot_batch_results

def plot_batch_results(x: Union[np.array, List], y: np.array, y_hat: np.array, model_name: str, x_hat: Union[np.array, List] = None)

Plot batch results.

Arguments:

  • x - is a list of time series for the different predictions in the batch, should be size [batch_size, forecast length]
  • y - the truth values of pv yield, should be size [batch_size, forecast length]
  • y_hat - the predicted values of pv yield, should be size [batch_size, forecast length]
  • model_name - the name of the model
  • x_hat - the x values for the predictions (y_hat), note that if none is supplied then x is used instead

  • Returns - a plotly figure

visualization.visualization

Matplotlib functions to plot a example dataset and model outputs.

Author: Jack Kelly

plot_example

def plot_example(batch, model_output, history_minutes: int, forecast_minutes: int, nwp_channels: Iterable[str], example_i: int = 0, epoch: Optional[int] = None, output_variable: str = "pv_yield") -> plt.Figure

Plots an example with the satellite imagery, timeseries and PV yield.

Arguments:

  • batch - The batch to plot
  • model_output - The output from the model
  • history_minutes - The number of minutes of the input history
  • forecast_minutes - The number minutes of forecast
  • nwp_channels - The names of nwp channels
  • example_i - Which example to plot from the batch
  • epoch - The optional epoch number
  • output_variable - this can be 'pv_yield' or 'gsp_yield'

Returns:

Matplotlib Figure containing the plotted graphs and images