flasc.utilities.energy_ratio_utilities.add_wd_bin

Contents

flasc.utilities.energy_ratio_utilities.add_wd_bin#

flasc.utilities.energy_ratio_utilities.add_wd_bin(df_, wd_cols, wd_step=2.0, wd_min=0.0, wd_max=360.0, edges=None, remove_all_nulls=False)[source]#

Add the wd_bin column to a dataframe.

Given which columns to average over and the step sizes to use

Parameters:
  • df (pl.DataFrame) -- The Polars DataFrame containing the column to bin.

  • wd_cols (list(str)) -- The name of the columns to average across.

  • wd_step (float) -- Step size for binning

  • wd_min (float) -- Minimum wind direction

  • wd_max (float) -- Maximum wind direction

  • edges (array-like) -- The edges of the bins. Values will be placed into the bin whose left edge is the largest edge less than or equal to the value, and whose right edge is the smallest edge greater than the value. Defaults to None, in which case the edges are generated using ws_step, ws_min, and ws_max.

  • remove_all_nulls (bool) -- (bool): Remove all null values in wd_cols (rather than any)

  • df_ (DataFrame)

Returns:

A new Polars DataFrame with an additional ws_bin column

Return type:

pl.DataFrame