flasc.analysis.energy_ratio_output#

Store the results of the energy ratio calculations.

Classes

EnergyRatioOutput

Store the results of the energy ratio calculations.

class flasc.analysis.energy_ratio_output.EnergyRatioOutput(df_result: DataFrame, er_in: EnergyRatioInput, df_freq: DataFrame, ref_cols: List[str], test_cols: List[str], wd_cols: List[str], ws_cols: List[str], uplift_cols: List[str], 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, wd_bin_overlap_radius: float, N: int, remove_all_nulls: bool = False)[source]#

Store the results of the energy ratio calculations.

Additionally provide convenient methods for plotting and saving the results.

Parameters:
  • df_result (pd.DataFrame)

  • er_in (EnergyRatioInput)

  • df_freq (pd.DataFrame)

  • ref_cols (List[str])

  • test_cols (List[str])

  • wd_cols (List[str])

  • ws_cols (List[str])

  • uplift_cols (List[str])

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

  • wd_bin_overlap_radius (float)

  • N (int)

  • remove_all_nulls (bool)

plot_energy_ratios(df_names_subset: List[str] | None = None, labels: List[str] | None = None, color_dict: Dict[str, Any] | None = None, axarr: Axes | List[Axes] | None = None, polar_plot: bool = False, show_wind_direction_distribution: bool = True, show_wind_speed_distribution: bool | None = None, overlay_frequency: bool = False, _is_uplift: bool = False) Axes | List[Axes][source]#

Plot the energy ratios.

Parameters:
  • df_names_subset (Optional[List[str]], optional) -- A subset of the dataframes used in the energy ratio calculation. Defaults to None.

  • labels (Optional[List[str]], optional) -- The labels for the energy ratios. Defaults to None.

  • color_dict (Optional[Dict[str, Any]], optional) -- A dictionary mapping labels to colors. Defaults to None.

  • axarr (Optional[Union[axes.Axes, List[axes.Axes]]], optional) -- The axes to plot on. Defaults to None.

  • polar_plot (bool, optional) -- Whether to plot the energy ratios on a polar plot. Defaults to False.

  • show_wind_direction_distribution (bool, optional) -- Whether to show the wind direction distribution. Defaults to True.

  • show_wind_speed_distribution (bool, optional) -- Whether to show the wind speed distribution. Defaults to True, unless polar_plot is True.

  • overlay_frequency (bool, optional) -- Whether to plot the frequency distribution used for calculation.

  • _is_uplift (bool, optional) -- Whether being called by plot_uplift(). Defaults to False.

Returns:

The axes used for plotting.

Return type:

Union[axes.Axes, List[axes.Axes]]

Raises:

ValueError -- If show_wind_speed_distribution is True and polar_plot is True.

Notes

  • If df_names_subset is None, all dataframes will be plotted.

  • If df_names_subset is not a list, it will be converted to a list.

  • If labels is None, the dataframe names will be used as labels.

  • If color_dict is None, a default color scheme will be used.

  • If axarr is None, a new figure will be created.

plot_uplift(uplift_names_subset: List[str] | None = None, labels: List[str] | None = None, color_dict: Dict[str, Any] | None = None, axarr: Axes | List[Axes] | None = None, polar_plot: bool = False, show_wind_direction_distribution: bool = True, show_wind_speed_distribution: bool = True, overlay_frequency: bool = False) Axes | List[Axes][source]#

Plot the uplift in energy ratio.

Parameters:
  • uplift_names_subset (Optional[List[str]], optional) -- A subset of the uplifts computed to print. Defaults to None.

  • labels (Optional[List[str]], optional) -- The labels for the uplifts. Defaults to None.

  • color_dict (Optional[Dict[str, Any]], optional) -- A dictionary mapping labels to colors. Defaults to None.

  • axarr (Optional[Union[axes.Axes, List[axes.Axes]]], optional) -- The axes to plot on. Defaults to None.

  • polar_plot (bool, optional) -- Whether to plot the uplift on a polar plot. Defaults to False.

  • show_wind_direction_distribution (bool, optional) -- Whether to show the wind direction distribution. Defaults to True.

  • show_wind_speed_distribution (bool, optional) -- Whether to show the wind speed distribution. Defaults to True, unless polar_plot is True.

  • overlay_frequency (bool, optional) -- Whether to plot the frequency distribution used for calculation.

Raises:

ValueError -- If show_wind_speed_distribution is True and polar_plot is True.

Returns:

The axes used for plotting.

Return type:

Union[axes.Axes, List[axes.Axes]]

Notes

  • If axarr is None, a new figure will be created.

  • If axarr is a single axes object, it will be used to plot the uplift.

  • If axarr is a list of axes objects, each

    component of the uplift will be plotted on a separate axes object.

  • If polar_plot is True, the uplift will be plotted on a polar plot.

  • If show_wind_direction_distribution is True,

    the wind direction distribution will be shown.

  • If show_wind_speed_distribution is True, the wind speed distribution will be shown.

_compute_ws_counts()[source]#

Compute the ws bin counts.