solarforecastarbiter.reference_forecasts.persistence.persistence_interval(observation, data_start, data_end, forecast_start, interval_length, interval_label, load_data)[source]

Make a persistence forecast for an observation using the mean values of each interval_length bin from data_start to data_end. The forecast starts at forecast_start and is of length data_end - data_start. A frequent use of this function is to create a day ahead persistence forecast using the previous day’s observations.

In the example below, we use GHI to be concrete but the concept applies to any kind of observation data. The persistence forecast for multiple intervals is:

\[GHI_{t_{f_m}} = \overline{GHI_{t_{{start}_m}} \ldots GHI_{t_{{end}_m}}}\]


\[\begin{split}m &\in \{0, 1, \ldots \frac{\textrm{data end} - \textrm{data start}} {\textrm{interval_length}} - 1\} \\ t_{start_m} &= \textrm{data start} + m \times \textrm{interval_length} \\ t_{end_m} &= \textrm{data start} + (1 + m) \times \textrm{interval_length} \\ t_{f_m} &= \textrm{forecast start} + m \times \textrm{interval_length} \\\end{split}\]

Further, persistence of multiple intervals requires that data_start, data_end, and forecast_start are all integer multiples of interval_length. For example, if interval_length = 60 minutes, data_start may be 12:00 or 01:00, but not 12:30.

  • observation (datamodel.Observation) –
  • data_start (pd.Timestamp) – Observation data start. Forecast is inclusive of this instant if observation.interval_label is beginning or instant.
  • data_end (pd.Timestamp) – Observation data end. Forecast is inclusive of this instant if observation.interval_label is ending or instant.
  • forecast_start (pd.Timestamp) – Forecast start. Forecast is inclusive of this instant if interval_label is beginning or instant.
  • interval_length (pd.Timedelta) – Forecast interval length
  • interval_label (str) – instant, beginning, or ending
  • load_data (function) – A function that loads the observation data. Must have the signature load_data(observation, data_start, data_end) and properly account for observation interval label.

forecast (pd.Series) – The persistence forecast.