solarforecastarbiter.reference_forecasts.main.run_persistence(session, observation, forecast, run_time, issue_time, index=False)[source]

Run a persistence forecast for an observation.

For intraday forecasts, the index argument controls if the forecast is constructed using persistence of the measured values (index = False) or persistence using clear sky index or AC power index.

For day ahead forecasts, only persistence of measured values (index = False) is supported.

Forecasts may be run operationally or retrospectively. For operational forecasts, run_time is typically set to now. For retrospective forecasts, run_time is the time by which the forecast should be run so that it could have been be delivered for the issue_time. Forecasts will only use data with timestamps before run_time.

The persistence window is the time over which the persistence quantity (irradiance, power, clear sky index, or power index) is averaged. The persistence window is automatically determined from the forecast attributes:

  • Intraday persistence forecasts:
    window = run_time - forecast.run_length. No longer than 1 hour.
  • Day ahead forecasts:
    window = forecast.interval_length.

Users that would like more flexibility may use the lower-level functions in solarforecastarbiter.reference_forecasts.persistence.

  • session (api.Session) – The session object to use to request data from the SolarForecastArbiter API.
  • observation (datamodel.Observation) – The metadata of the observation to be used to create the forecast.
  • forecast (datamodel.Forecast) – The metadata of the desired forecast.
  • run_time (pd.Timestamp) – Run time of the forecast.
  • issue_time (pd.Timestamp) – Issue time of the forecast run.
  • index (bool, default False) – If False, use persistence of observed value. If True, use persistence of clear sky or AC power index.

forecast (pd.Series) – Forecast conforms to the metadata specified by the forecast argument.

  • ValueError – If forecast and issue_time are incompatible.
  • ValueError – If persistence window < observation.interval_length.
  • ValueError – If forecast.run_length = 1 day and forecast period is not midnight to midnight.
  • ValueError – If forecast.run_length = 1 day and index=True.
  • ValueError – If instantaneous forecast and instantaneous observation interval lengths do not match.
  • ValueError – If average observations are used to make instantaneous forecast.