solarforecastarbiter.reference_forecasts.main.run_nwp

solarforecastarbiter.reference_forecasts.main.run_nwp(forecast, model, run_time, issue_time)[source]

Calculate benchmark irradiance and power forecasts for a Forecast or ProbabilisticForecast.

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.

Parameters:
Returns:

  • ghi (pd.Series or pd.DataFrame)
  • dni (pd.Series or pd.DataFrame)
  • dhi (pd.Series or pd.DataFrame)
  • air_temperature (pd.Series or pd.DataFrame)
  • wind_speed (pd.Series or pd.DataFrame)
  • ac_power (pd.Series or pd.DataFrame)
  • Series are returned for deterministic forecasts, DataFrames are
  • returned for probabilisic forecasts.

Examples

The following code would return hourly average forecasts derived from the subhourly HRRR model.

>>> run_time = pd.Timestamp('20190515T0200Z')
>>> issue_time = pd.Timestamp('20190515T0000Z')
>>> modeling_parameters = datamodel.FixedTiltModelingParameters(
...     surface_tilt=30, surface_azimuth=180,
...     ac_capacity=10, dc_capacity=15,
...     temperature_coefficient=-0.4, dc_loss_factor=0,
...     ac_loss_factor=0)
>>> power_plant = datamodel.SolarPowerPlant(
...     name='Test plant', latitude=32.2, longitude=-110.9,
...     elevation=715, timezone='America/Phoenix',
...     modeling_parameters=modeling_parameters)
>>> forecast = datamodel.Forecast(
...     name='Test plant fx',
...     site=power_plant,
...     variable='ac_power',
...     interval_label='ending',
...     interval_value_type='interval_mean',
...     interval_length='1h',
...     issue_time_of_day=datetime.time(hour=0),
...     run_length=pd.Timedelta('24h'),
...     lead_time_to_start=pd.Timedelta('0h'))
>>> ghi, dni, dhi, temp_air, wind_speed, ac_power = run_nwp(
...     forecast, models.hrrr_subhourly_to_hourly_mean,
...     run_time, issue_time)