flasc.utilities.energy_ratio_utilities.bin_and_group_dataframe#
- flasc.utilities.energy_ratio_utilities.bin_and_group_dataframe(df_, ref_cols, test_cols, wd_cols, ws_cols, wd_step=2.0, wd_min=0.0, wd_max=360.0, ws_step=1.0, ws_min=0.0, ws_max=50.0, wd_bin_overlap_radius=0.0, remove_all_nulls=False, bin_cols_without_df_name=None, num_df=0)[source]#
Bin and aggregate a DataFrame based on wind direction and wind speed parameters.
This function takes a Polars DataFrame (df_) and performs binning and aggregation operations based on wind direction (wd) and wind speed (ws). It allows for optional handling of reflected rows and grouping by specific columns. The resulting DataFrame contains aggregated statistics for reference and test power columns within specified bins.
- Parameters:
df (DataFrame) -- The input Polars DataFrame to be processed.
ref_cols (List[str]) -- List of columns containing reference power data.
test_cols (List[str]) -- List of columns containing test power data.
wd_cols (List[str]) -- List of columns containing wind direction data.
ws_cols (List[str]) -- List of columns containing wind speed data.
wd_step (float, optional) -- Step size for wind direction binning. Defaults to 2.0.
wd_min (float, optional) -- Minimum wind direction value. Defaults to 0.0.
wd_max (float, optional) -- Maximum wind direction value. Defaults to 360.0.
ws_step (float, optional) -- Step size for wind speed binning. Defaults to 1.0.
ws_min (float, optional) -- Minimum wind speed value. Defaults to 0.0.
ws_max (float, optional) -- Maximum wind speed value. Defaults to 50.0.
wd_bin_overlap_radius (float, optional) -- Radius for overlapping wind direction bins. Defaults to 0.0.
remove_all_nulls (bool, optional) -- If True, remove rows unless all valid instead of any. Defaults to False.
bin_cols_without_df_name (List[str], optional) -- List of columns used for grouping without 'df_name'.
num_df (int, optional) -- Number of dataframes required for each bin combination.
df_ (DataFrame)
- Returns:
The resulting Polars DataFrame with aggregated statistics.
- Return type:
DataFrame