flasc.data_processing.dataframe_manipulations.set_ws_by_n_closest_upstream_turbines

flasc.data_processing.dataframe_manipulations.set_ws_by_n_closest_upstream_turbines#

flasc.data_processing.dataframe_manipulations.set_ws_by_n_closest_upstream_turbines(df: DataFrame | FlascDataFrame, df_upstream: DataFrame, turb_no: int, x_turbs: List[float], y_turbs: List[float], exclude_turbs: List[int] = [], N: int = 5) DataFrame | FlascDataFrame[source]#

Add wind speed column by N closest upstream turbines.

Add a column called 'ws' to your dataframe, which is the mean of the columns ws_%03d for the N closest turbines that are upstream of the turbine of interest [turb_no].

Parameters:
  • df (pd.DataFrame | FlascDataFrame) -- Dataframe with measurements. This dataframe typically consists of wd_%03d, ws_%03d, ti_%03d, pow_%03d, and potentially additional measurements.

  • df_upstream (pd.DataFrame) -- Dataframe containing rows indicating wind direction ranges and the corresponding upstream turbines for that wind direction range. This variable can be generated with flasc.utilities.floris_tools.get_upstream_turbs_floris(...). turb_no (int): Turbine number from which the radius should be calculated.

  • turb_no (int) -- Turbine number from which the radius should be

  • x_turbs ([list, array]) -- Array containing x locations of turbines.

  • y_turbs ([list, array]) -- Array containing y locations of turbines.

  • exclude_turbs ([list, array]) -- array-like variable containing turbine indices that should be excluded in determining the column mean quantity.

  • N (int) -- Number of closest turbines to consider for the calculation

Returns:

Dataframe which equals the inserted dataframe plus the additional column called 'pow_ref'.

Return type:

pd.Dataframe | FlascDataFrame