flasc.analysis.total_uplift#
Module for computing the total uplift in energy production.
Functions
Compute the energy ratio between two sets of turbines with bootstrapping. |
- flasc.analysis.total_uplift._compute_total_uplift_single(df_, df_names, ref_cols, test_cols, wd_cols, ws_cols, wd_step=2.0, wd_min=0.0, wd_max=360.0, ws_step=1.0, ws_min=0.0, ws_max=50.0, bin_cols_in=['wd_bin', 'ws_bin'], weight_by='min', df_freq_pl=None, wd_bin_overlap_radius=0.0, uplift_pairs=[], uplift_names=[], remove_all_nulls=False)[source]#
Compute the total change in energy production between two sets of turbines.
- Parameters:
df (pl.DataFrame) -- A dataframe containing the data to use in the calculation.
df_names (list) -- A list of names to give to the dataframes.
ref_cols (list[str]) -- A list of columns to use as the reference turbines
test_cols (list[str]) -- A list of columns to use as the test turbines
wd_cols (list[str]) -- A list of columns to derive the wind directions from
ws_cols (list[str]) -- A list of columns to derive the wind speeds from
wd_step (float) -- The width of the wind direction bins.
wd_min (float) -- The minimum wind direction to use.
wd_max (float) -- The maximum wind direction to use.
ws_step (float) -- The width of the wind speed bins.
ws_min (float) -- The minimum wind speed to use.
ws_max (float) -- The maximum wind speed to use.
bin_cols_in (list[str]) -- A list of column names to use for the wind speed and wind direction bins.
weight_by (str) -- How to weight the energy ratio, options are 'min', or 'sum'. 'min' means the minimum count across the dataframes is used to weight the energy ratio. 'sum' means the sum of the counts across the dataframes is used to weight the energy ratio. Defaults to 'min'.
df_freq_pl (pl.Dataframe) -- Polars dataframe of pre-provided per bin weights
wd_bin_overlap_radius (float) -- The distance in degrees one wd bin overlaps into the next, must be less or equal to half the value of wd_step
uplift_pairs -- (list[tuple]): List of pairs of df_names to compute uplifts for. Each element of the list should be a tuple (or list) of length 2, where the first element will be the base case in the uplift calculation and the second element will be the test case in the uplift calculation. If None, no uplifts are computed.
uplift_names -- (list[str]): Names for the uplift columns, following the order of the pairs specified in uplift_pairs. If None, will default to "uplift_df_name1_df_name2",
remove_all_nulls -- (bool): Construct reference and test by strictly requiring all data to be available. If False, a minimum one data point from ref_cols, test_cols, wd_cols, and ws_cols must be available to compute the bin. Defaults to False.
- Returns:
- containing the results of the computation
and the frequency table. The dictionary contains the uplift results indexed by the uplift_names. The dataframe contains the weights for each wind direction
and wind speed bin.
- Return type:
A tuple (dict, pl.DataFrame)
- flasc.analysis.total_uplift._compute_total_uplift_bootstrap(er_in, ref_cols, test_cols, wd_cols, ws_cols, wd_step=2.0, wd_min=0.0, wd_max=360.0, ws_step=1.0, ws_min=0.0, ws_max=50.0, bin_cols_in=['wd_bin', 'ws_bin'], weight_by='min', df_freq_pl=None, wd_bin_overlap_radius=0.0, uplift_pairs=[], uplift_names=[], N=1, percentiles=[5.0, 95.0], remove_all_nulls=False)[source]#
Compute the total change in energy between two sets of turbines with bootstrapping.
- Parameters:
er_in (EnergyRatioInput) -- An EnergyRatioInput object containing the data to use in the calculation.
ref_cols (list[str]) -- A list of columns to use as the reference turbines
test_cols (list[str]) -- A list of columns to use as the test turbines
wd_cols (list[str]) -- A list of columns to derive the wind directions from
ws_cols (list[str]) -- A list of columns to derive the wind speeds from
wd_step (float) -- The width of the wind direction bins.
wd_min (float) -- The minimum wind direction to use.
wd_max (float) -- The maximum wind direction to use.
ws_step (float) -- The width of the wind speed bins.
ws_min (float) -- The minimum wind speed to use.
ws_max (float) -- The maximum wind speed to use.
bin_cols_in (list[str]) -- A list of column names to use for the wind speed and wind direction bins.
weight_by (str) -- How to weight the energy ratio, options are 'min', or 'sum'. 'min' means the minimum count across the dataframes is used to weight the energy ratio. 'sum' means the sum of the counts across the dataframes is used to weight the energy ratio.
df_freq_pl (pl.Dataframe) -- Polars dataframe of pre-provided per bin weights
wd_bin_overlap_radius (float) -- The distance in degrees one wd bin overlaps into the next, must be less or equal to half the value of wd_step
uplift_pairs -- (list[tuple]): List of pairs of df_names to compute uplifts for. Each element of the list should be a tuple (or list) of length 2, where the first element will be the base case in the uplift calculation and the second element will be the test case in the uplift calculation. If None, no uplifts are computed.
uplift_names -- (list[str]): Names for the uplift columns, following the order of the pairs specified in uplift_pairs. If None, will default to "uplift_df_name1_df_name2"
N (int) -- The number of bootstrap samples to use.
percentiles -- (list or None): percentiles to use when returning energy ratio bounds. If specified as None with N > 1 (bootstrapping), defaults to [5, 95].
remove_all_nulls -- (bool): Construct reference and test by strictly requiring all data to be available. If False, a minimum one data point from ref_cols, test_cols, wd_cols, and ws_cols must be available to compute the bin. Defaults to False.
- Returns:
A dataframe containing the energy ratio between the two sets of turbines.
- Return type:
pl.DataFrame
- flasc.analysis.total_uplift.compute_total_uplift(er_in, ref_turbines=None, test_turbines=None, wd_turbines=None, ws_turbines=None, use_predefined_ref=False, use_predefined_wd=False, use_predefined_ws=False, wd_step=2.0, wd_min=0.0, wd_max=360.0, ws_step=1.0, ws_min=0.0, ws_max=50.0, bin_cols_in=['wd_bin', 'ws_bin'], weight_by='min', df_freq=None, wd_bin_overlap_radius=0.0, uplift_pairs=None, uplift_names=None, N=1, percentiles=None, remove_all_nulls=False)[source]#
Compute the energy ratio between two sets of turbines with bootstrapping.
- Return type:
dict
- Parameters:
er_in (EnergyRatioInput) -- An EnergyRatioInput object containing the data to use in the calculation.
ref_turbines (list[int]) -- A list of turbine numbers to use as the reference.
test_turbines (list[int]) -- A list of turbine numbers to use as the test.
ws_turbines (list[int]) -- A list of turbine numbers to use for the wind speeds
wd_turbines (list[int]) -- A list of turbine numbers to use for the wind directions
use_predefined_ref (bool) -- If True, use the pow_ref column of df_ as the reference power.
use_predefined_ws (bool) -- If True, use the ws column of df_ as the wind speed.
use_predefined_wd (bool) -- If True, use the wd column of df_ as the wind direction.
wd_step (float) -- The width of the wind direction bins.
wd_min (float) -- The minimum wind direction to use.
wd_max (float) -- The maximum wind direction to use.
ws_step (float) -- The width of the wind speed bins.
ws_min (float) -- The minimum wind speed to use.
ws_max (float) -- The maximum wind speed to use.
bin_cols_in (list[str]) -- A list of column names to use for the wind speed and wind direction bins.
weight_by (str) -- How to weight the energy ratio, options are 'min', , or 'sum'. 'min' means the minimum count across the dataframes is used to weight the energy ratio. 'sum' means the sum of the counts across the dataframes is used to weight the energy ratio.
df_freq (pd.Dataframe) -- A dataframe which specifies the frequency of the ws/wd bin combinations. Provides a method to use an explicit or long-term weigthing of bins. Dataframe should include columns ws, wd and freq_val. ws and wd should orrespond to the bin centers resulting from the choices of the ws/wd_min / _max / _step. In the case that df_freq has extra bins that aren't included in those given by ws/wd min, max, step, they will be ignored in the energy ratio calculation. Any bins given by ws/wd min, max, step not present in df_freq will be assigned a frequency of zero. Defaults to None.
wd_bin_overlap_radius (float) -- The distance in degrees one wd bin overlaps into the next, must be less or equal to half the value of wd_step
uplift_pairs -- (list[tuple]): List of pairs of df_names to compute uplifts for. Each element of the list should be a tuple (or list) of length 2, where the first element will be the base case in the uplift calculation and the second element will be the test case in the uplift calculation. If None, no uplifts are computed.
uplift_names -- (list[str]): Names for the uplift columns, following the order of the pairs specified in uplift_pairs. If None, will default to "uplift_df_name1_df_name2"
N (int) -- The number of bootstrap samples to use.
percentiles -- (list or None): percentiles to use when returning energy ratio bounds. If specified as None with N > 1 (bootstrapping), defaults to [5, 95].
remove_all_nulls -- (bool): Construct reference and test by strictly requiring all data to be available. If False, a minimum one data point from ref_cols, test_cols, wd_cols, and ws_cols must be available to compute the bin. Defaults to False.
- Returns:
An EnergyRatioOutput object containing the energy ratio between the two sets of turbines.
- Return type: