flasc.data_processing.dataframe_manipulations.set_wd_by_upstream_turbines_in_radius

flasc.data_processing.dataframe_manipulations.set_wd_by_upstream_turbines_in_radius#

flasc.data_processing.dataframe_manipulations.set_wd_by_upstream_turbines_in_radius(df: DataFrame | FlascDataFrame, df_upstream: DataFrame, turb_no: int, x_turbs: List[float], y_turbs: List[float], max_radius: float, include_itself: bool = True) DataFrame | FlascDataFrame[source]#

Add wind direction column using in-radius upstream turbines.

Add a column called 'wd' to your dataframe, which is the mean of the columns wd_%03d for turbines that are upstream and also within radius [max_radius] of the turbine of interest [turb_no]. As an intermediate step, the average wind direction over all turbines is used to determine the set of upstream turbines from which the final wind direction signal is derived.

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.

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

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

  • max_radius (float) -- Maximum radius for the upstream turbines until which they are still considered as relevant/used for the calculation of the averaged column quantity.

  • include_itself (bool, optional) -- Include the measurements of turbine turb_no in the determination of the averaged column quantity. Defaults to False.

Returns:

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

Return type:

pd.Dataframe | FlascDataFrame