flasc.analysis.expected_power_analysis_by#

Module for performing expected power analyses by wind direction or wind speed.

Functions

total_uplift_expected_power_by_wd_shift_ws_min

Calculate total uplift by wind direction for different minimum wind speed values.

Classes

total_uplift_expected_power_by_wd

Compute total uplift using expected power methods by wind direction.

total_uplift_expected_power_by_ws

Compute total uplift using expected power methods by wind speed.

class flasc.analysis.expected_power_analysis_by._total_uplift_expected_power_by_(wd_or_ws: str, a_in: AnalysisInput, uplift_pairs: List[Tuple[str, str]], uplift_names: List[str], test_turbines: List[int], wd_turbines: List[int] | None = None, ws_turbines: List[int] | None = None, use_predefined_wd: bool = False, use_predefined_ws: bool = False, wd_step: float = 2.0, wd_min: float = 0.0, wd_max: float = 360.0, ws_step: float = 1.0, ws_min: float = 0.0, ws_max: float = 50.0, bin_cols_in: List[str] = ['wd_bin', 'ws_bin'], weight_by: str = 'min', df_freq: DataFrame | None = None, use_standard_error: bool = True, N: int = 1, percentiles: List[float] = [2.5, 97.5], remove_any_null_turbine_bins: bool = False, cov_terms: str = 'zero')[source]#

Compute total uplift expected power by wind direction or wind speed.

Parameters:
  • wd_or_ws (str)

  • a_in (AnalysisInput)

  • uplift_pairs (List[Tuple[str, str]])

  • uplift_names (List[str])

  • test_turbines (List[int])

  • wd_turbines (List[int])

  • ws_turbines (List[int])

  • use_predefined_wd (bool)

  • use_predefined_ws (bool)

  • wd_step (float)

  • wd_min (float)

  • wd_max (float)

  • ws_step (float)

  • ws_min (float)

  • ws_max (float)

  • bin_cols_in (List[str])

  • weight_by (str)

  • df_freq (DataFrame)

  • use_standard_error (bool)

  • N (int)

  • percentiles (List[float])

  • remove_any_null_turbine_bins (bool)

  • cov_terms (str)

plot(ax=None, color_dict={}, overwrite_label=None, plot_unc=True) Tuple[Figure, Axes][source]#

Plot the total uplift results by wind direction or wind speed.

Parameters:
  • ax (plt.Axes) -- An existing matplotlib Axes object to plot on. Defaults to None.

  • color_dict (Dict) -- A dictionary of uplift names and colors. Defaults to {}.

  • overwrite_label (str) -- If not None, overwrite the uplift names with this label. Defaults to None.

  • plot_unc (bool) -- If True, plot the uncertainty bounds. Defaults to True.

Returns:

A tuple containing the matplotlib Figure and Axes objects.

Return type:

Tuple[plt.Figure, plt.Axes]

plot_with_distributions(axarr=None, color_dict={}) Tuple[Figure, List[Axes]][source]#

Plot results by wind direction or wind speed with histograms and distributions.

Plot the total uplift results by wind direction or wind speed with accompanying histograms and distributions of wind speed or wind direction.

Parameters:
  • axarr (List[plt.Axes]) -- An existing list of matplotlib Axes objects to plot on. Defaults to None.

  • color_dict (Dict) -- A dictionary of uplift names and colors. Defaults to {}.

Returns:

A tuple containing the matplotlib Figure

and list of Axes objects.

Return type:

Tuple[plt.Figure, List[plt.Axes]]

class flasc.analysis.expected_power_analysis_by.total_uplift_expected_power_by_wd(a_in: AnalysisInput, uplift_pairs: List[Tuple[str, str]], uplift_names: List[str], test_turbines: List[int], wd_turbines: List[int] | None = None, ws_turbines: List[int] | None = None, use_predefined_wd: bool = False, use_predefined_ws: bool = False, wd_step: float = 2.0, wd_min: float = 0.0, wd_max: float = 360.0, ws_step: float = 1.0, ws_min: float = 0.0, ws_max: float = 50.0, bin_cols_in: List[str] = ['wd_bin', 'ws_bin'], weight_by: str = 'min', df_freq: DataFrame | None = None, use_standard_error: bool = True, N: int = 1, percentiles: List[float] = [2.5, 97.5], remove_any_null_turbine_bins: bool = False, cov_terms: str = 'zero')[source]#

Compute total uplift using expected power methods by wind direction.

Parameters:
  • a_in (AnalysisInput)

  • uplift_pairs (List[Tuple[str, str]])

  • uplift_names (List[str])

  • test_turbines (List[int])

  • wd_turbines (List[int])

  • ws_turbines (List[int])

  • use_predefined_wd (bool)

  • use_predefined_ws (bool)

  • wd_step (float)

  • wd_min (float)

  • wd_max (float)

  • ws_step (float)

  • ws_min (float)

  • ws_max (float)

  • bin_cols_in (List[str])

  • weight_by (str)

  • df_freq (DataFrame)

  • use_standard_error (bool)

  • N (int)

  • percentiles (List[float])

  • remove_any_null_turbine_bins (bool)

  • cov_terms (str)

class flasc.analysis.expected_power_analysis_by.total_uplift_expected_power_by_ws(a_in: AnalysisInput, uplift_pairs: List[Tuple[str, str]], uplift_names: List[str], test_turbines: List[int], wd_turbines: List[int] | None = None, ws_turbines: List[int] | None = None, use_predefined_wd: bool = False, use_predefined_ws: bool = False, wd_step: float = 2.0, wd_min: float = 0.0, wd_max: float = 360.0, ws_step: float = 1.0, ws_min: float = 0.0, ws_max: float = 50.0, bin_cols_in: List[str] = ['wd_bin', 'ws_bin'], weight_by: str = 'min', df_freq: DataFrame | None = None, use_standard_error: bool = True, N: int = 1, percentiles: List[float] = [2.5, 97.5], remove_any_null_turbine_bins: bool = False, cov_terms: str = 'zero')[source]#

Compute total uplift using expected power methods by wind speed.

Parameters:
  • a_in (AnalysisInput)

  • uplift_pairs (List[Tuple[str, str]])

  • uplift_names (List[str])

  • test_turbines (List[int])

  • wd_turbines (List[int])

  • ws_turbines (List[int])

  • use_predefined_wd (bool)

  • use_predefined_ws (bool)

  • wd_step (float)

  • wd_min (float)

  • wd_max (float)

  • ws_step (float)

  • ws_min (float)

  • ws_max (float)

  • bin_cols_in (List[str])

  • weight_by (str)

  • df_freq (DataFrame)

  • use_standard_error (bool)

  • N (int)

  • percentiles (List[float])

  • remove_any_null_turbine_bins (bool)

  • cov_terms (str)

flasc.analysis.expected_power_analysis_by.total_uplift_expected_power_by_wd_shift_ws_min(a_in: AnalysisInput, uplift_pairs: List[Tuple[str, str]], uplift_names: List[str], test_turbines: List[int], wd_turbines: List[int] | None = None, ws_turbines: List[int] | None = None, use_predefined_wd: bool = False, use_predefined_ws: bool = False, wd_step: float = 2.0, wd_min: float = 0.0, wd_max: float = 360.0, ws_step: float = 1.0, ws_min: float = 0.0, ws_max: float = 50.0, bin_cols_in: List[str] = ['wd_bin', 'ws_bin'], weight_by: str = 'min', df_freq: DataFrame | None = None, use_standard_error: bool = True, N: int = 1, percentiles: List[float] = [2.5, 97.5], remove_any_null_turbine_bins: bool = False, cov_terms: str = 'zero', n_step: int = 10, ax=None)[source]#

Calculate total uplift by wind direction for different minimum wind speed values.

Calculate total uplift using expected power methods by wind direction for different wind speed minimum ws_min values. Plots total uplift as a function of wind direction for each choice of ws_min.

Parameters:
  • a_in (AnalysisInput) -- An AnalysisInput object containing the dataframes to analyze.

  • uplift_pairs (List[Tuple[str, str]]) -- A list of tuples containing the df_name values to compare.

  • uplift_names (List[str]) -- A list of names for the uplift results for each uplift pair.

  • test_turbines (List[int]) -- A list of turbine indices to include when computing total uplift.

  • wd_turbines (List[int]) -- A list of turbine indices for determining the reference wind direction. Defaults to None.

  • ws_turbines (List[int]) -- A list of turbine indices for determining the reference wind speed. Defaults to None.

  • use_predefined_wd (bool) -- Use predefined wind direction. Defaults to False.

  • use_predefined_ws (bool) -- Use predefined wind speed. Defaults to False.

  • wd_step (float) -- The step size for the wind direction bins. Defaults to 2.0.

  • wd_min (float) -- The minimum wind direction value. Defaults to 0.0.

  • wd_max (float) -- The maximum wind direction value. Defaults to 360.0.

  • ws_step (float) -- The step size for the wind speed bins. Defaults to 1.0.

  • ws_min (float) -- The minimum wind speed value. Defaults to 0.0.

  • ws_max (float) -- The maximum wind speed value. Defaults to 50.0.

  • bin_cols_in (List[str]) -- A list of column names to bin the dataframes by. Defaults to ["wd_bin", "ws_bin"].

  • weight_by (str) -- The method used to weight the bins when computing total energy if df_freq is None ("min" or "sum"). If "min", the minimum number of points in a bin over all dataframes is used. If, "sum", the sum of the points over all dataframes is used. Defaults to "min".

  • df_freq (pd.DataFrame) -- A pandas dataframe with the frequency of each bin. Defaults to None.

  • use_standard_error (bool) --

    If True, uncertainty in the total uplift is quantified by propagating bin-level standard errors. If False, bootstrapping is used.

    Defaults to True.

  • N (int) -- The number of bootstrap samples. If use_standard_error is True, N must be 1. Defaults to 1.

  • percentiles (List[float]) -- The lower and upper percentiles for quantifying uncertainty in total uplift. Defaults to [2.5, 97.5].

  • remove_any_null_turbine_bins (bool) -- If True, when computing farm power, remove any bins where any of the test turbines is null. Defaults to False.

  • cov_terms (str) -- If use_standard_error is True, the approach for determining the power covariance terms betweens pairs of test turbines whe computing uncertainty. Can be "zero", "var" or "cov". If "zero" all covariance terms are set to zero. If "var" all covariance terms are set to the product of the square root of the variances of each individual turbine. If "cov" the computed covariance terms are used as is when enough data are present in a bin, with missing terms set to the product of the square root of the individual turbine variances. Defaults to "zero".

  • n_step (int) -- The number of steps to perform the minimum wind speed sweep over. Defaults to 10.

  • ax (plt.Axes) -- An existing matplotlib Axes object to plot on. Defaults to None.