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.
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: - forecast (datamodel.Forecast) – The metadata of the desired forecast.
- model (function) – NWP model loading and processing function.
See
solarforecastarbiter.reference_forecasts.models
for options. - run_time (pd.Timestamp) – Run time of the forecast.
- issue_time (pd.Timestamp) – Issue time of the forecast run.
Returns: - ghi (pd.Series)
- dni (pd.Series)
- dhi (pd.Series)
- air_temperature (pd.Series)
- wind_speed (pd.Series)
- ac_power (pd.Series)
Examples
The following code would return hourly average forecasts derived from the subhourly HRRR model.
>>> from solarforecastarbiter import datamodel >>> from solarforecastarbiter.reference_forecasts import models >>> init_time = pd.Timestamp('20190328T1200Z') >>> start = pd.Timestamp('20190328T1300Z') # typical available time >>> end = pd.Timestamp('20190329T1300Z') # 24 hour forecast >>> modeling_parameters = datamodel.FixedTiltModelingParameters( ... ac_capacity=10, dc_capacity=15, ... temperature_coefficient=-0.004, 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) >>> ghi, dni, dhi, temp_air, wind_speed, ac_power = run( ... power_plant, models.hrrr_subhourly_to_hourly_mean, ... init_time, start, end)