flasc.analysis.energy_ratio.compute_energy_ratio

flasc.analysis.energy_ratio.compute_energy_ratio#

flasc.analysis.energy_ratio.compute_energy_ratio(er_in: EnergyRatioInput, 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, uplift_absolute=False, N=1, percentiles=None, remove_all_nulls=False) EnergyRatioOutput[source]#

Compute the energy ratio between two sets of turbines with bootstrapping.

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 correspond 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"

  • uplift_absolute -- (bool): If True, return uplift in absolute error instead of default percent change defaults to True

  • 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:

EnergyRatioOutput