flasc.analysis.energy_ratio_output.EnergyRatioOutput#

class flasc.analysis.energy_ratio_output.EnergyRatioOutput(df_result, er_in, df_freq, ref_cols, test_cols, wd_cols, ws_cols, uplift_cols, wd_step, wd_min, wd_max, ws_step, ws_min, ws_max, bin_cols_in, weight_by, wd_bin_overlap_radius, N, remove_all_nulls=False)[source]#

Bases: object

Store the results of the energy ratio calculations.

Additionally provide convenient methods for plotting and saving the results.

Methods

plot_energy_ratios

Plot the energy ratios.

plot_uplift

Plot the uplift in energy ratio.

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=None, labels=None, color_dict=None, axarr=None, polar_plot=False, show_wind_direction_distribution=True, show_wind_speed_distribution=None, overlay_frequency=False, _is_uplift=False)[source]#

Plot the energy ratios.

Return type:

Union[Axes, List[Axes]]

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=None, labels=None, color_dict=None, axarr=None, polar_plot=False, show_wind_direction_distribution=True, show_wind_speed_distribution=True, overlay_frequency=False)[source]#

Plot the uplift in energy ratio.

Return type:

Union[Axes, List[Axes]]

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.