reVX.utilities.forecasts.FcstUtils
- class FcstUtils(fcst_h5, fcst_dset, actuals_h5=None, actuals_dset=None)[source]
Bases:
object
Forecast bias correcting and blending utilties
- Parameters:
fcst_h5 (str) – Path to forecast .h5 file
fcst_dset (str) – Dataset to correct
actuals_h5 (str, optional) – Path to forecast to .h5 file, by default None
actuals_dset (str, optional) – Actuals dataset, by default None
Methods
bias_correct
(fcst_h5, fcst_dset, out_h5[, ...])Bias correct forecast using actuals using bias correction factor: total actual generation / total forecasted generation
bias_correct_fcst
(actuals, fcsts)Bias correct forecast data using bias correction factor: total actual generation / total forecasted generation
blend
(fcst_h5, fcst_dset, out_h5, fcst_perc)Bias correct and blend forecast using actuals: - Bias correct forecast data using bias correction factor: total actual generation / total forecasted generation - Blend fcst_perc of forecast generation with (1 - fcst_perc) of actuals generation
blend_fcsts
(actuals, fcsts, fcst_perc)Bias correct and blend forecasts with actuals
compute_mae
(actuals, fcsts)Compute aggregate and normalized average MAE between actuals and forecasts.
correct
(fcst_h5, fcst_dset, out_h5[, ...])Bias correct and blend (if requested) forecasts using actuals: - Bias correct forecast data using bias correction factor: total actual generation / total forecasted generation - Blend fcst_perc of forecast generation with (1 - fcst_perc) of actuals generation
correct_dset
(out_h5[, fcst_perc])Bias correct and blend (if requested) forecasts: - Bias correct forecast data using bias correction factor: total actual generation / total forecasted generation - Blend fcst_perc of forecast generation with (1 - fcst_perc) of actuals generation
Attributes
Actuals dset to use to correct forecasts
Path to actuals .h5 file
Forecast dset to correct
Path to forecast .h5 file
- property fcst_h5
Path to forecast .h5 file
- Returns:
str
- property actuals_h5
Path to actuals .h5 file
- Returns:
str
- property fcst_dset
Forecast dset to correct
- Returns:
str
- property actuals_dset
Actuals dset to use to correct forecasts
- Returns:
str
- static bias_correct_fcst(actuals, fcsts)[source]
Bias correct forecast data using bias correction factor: total actual generation / total forecasted generation
- Parameters:
actuals (ndarray) – Timeseries actuals (time x sites)
fcsts (ndarray) – Timeseries forecats (time x sites)
- Returns:
fcsts (ndarray) – Bias corrected forecasts
- classmethod blend_fcsts(actuals, fcsts, fcst_perc)[source]
Bias correct and blend forecasts with actuals
- Parameters:
actuals (ndarray) – Timeseries actuals (time x sites)
fcsts (ndarray) – Timeseries forecats (time x sites)
fcst_perc (float) – Percentage of forecast to use for blending
- Returns:
fcsts (ndarray) – Bias corrected and blended forecasts
- static compute_mae(actuals, fcsts)[source]
Compute aggregate and normalized average MAE between actuals and forecasts. The MAE is normalized by the total actuals generation
- Parameters:
actuals (ndarray) – Timeseries actuals (time x sites)
fcsts (ndarray) – Timeseries forecats (time x sites)
- Returns:
agg_mae (float) – Aggregate MAE for all sites
ave_mae (float) – Average MEA for all sites
- correct_dset(out_h5, fcst_perc=None)[source]
Bias correct and blend (if requested) forecasts: - Bias correct forecast data using bias correction factor: total actual generation / total forecasted generation - Blend fcst_perc of forecast generation with (1 - fcst_perc) of actuals generation
- Parameters:
out_h5 (str) – Output path for corrected .h5 file
fcst_perc (float, optional) – Percentage of forecast to use for blending, by default None
- classmethod correct(fcst_h5, fcst_dset, out_h5, actuals_h5=None, actuals_dset=None, fcst_perc=None)[source]
Bias correct and blend (if requested) forecasts using actuals: - Bias correct forecast data using bias correction factor: total actual generation / total forecasted generation - Blend fcst_perc of forecast generation with (1 - fcst_perc) of actuals generation
- Parameters:
fcst_h5 (str) – Path to forecast .h5 file
fcst_dset (str) – Dataset to correct
out_h5 (str) – Output path for corrected .h5 file
actuals_h5 (str, optional) – Path to forecast to .h5 file, by default None
actuals_dset (str, optional) – Actuals dataset, by default None
fcst_perc (float, None) – Percentage of forecast to use for blending, by default None
- classmethod bias_correct(fcst_h5, fcst_dset, out_h5, actuals_h5=None, actuals_dset=None)[source]
Bias correct forecast using actuals using bias correction factor: total actual generation / total forecasted generation
- Parameters:
fcst_h5 (str) – Path to forecast .h5 file
fcst_dset (str) – Dataset to correct
out_h5 (str) – Output path for corrected .h5 file
actuals_h5 (str, optional) – Path to forecast to .h5 file, by default None
actuals_dset (str, optional) – Actuals dataset, by default None
- classmethod blend(fcst_h5, fcst_dset, out_h5, fcst_perc, actuals_h5=None, actuals_dset=None)[source]
Bias correct and blend forecast using actuals: - Bias correct forecast data using bias correction factor: total actual generation / total forecasted generation - Blend fcst_perc of forecast generation with (1 - fcst_perc) of actuals generation
- Parameters:
fcst_h5 (str) – Path to forecast .h5 file
fcst_dset (str) – Dataset to correct
out_h5 (str) – Output path for corrected .h5 file
fcst_perc (float) – Percentage of forecast to use for blending
actuals_h5 (str, optional) – Path to forecast to .h5 file, by default None
actuals_dset (str, optional) – Actuals dataset, by default None