flasc.data_processing.northing_offset_change_hoger

flasc.data_processing.northing_offset_change_hoger#

Module for homogenizing the wind direction data using the HOGER method.

HOGER was developed by Paul Poncet (engie-paul-poncet)

and Thomas Duc (engie-thomas-duc) of Engie,

and Rubén González-Lope (rglope) and Alvaro Gonzalez Salcedo (alvarogonzalezsalcedo) of CENER within the TWAIN project.

Functions

homogenize_hoger

Homogenization routine of the Scada directions of the different wind turbines based on "var".

flasc.data_processing.northing_offset_change_hoger._get_leaves_and_knots(tree: DecisionTreeRegressor) tuple[ndarray, ndarray][source]#

Function to get the values of the superficial knots and leaves of a Tree Regression.

Parameters:

tree (DecisionTreeRegressor) -- Decision Tree Regression model.

Returns:

Values of the leaves and positions of the knots.

Return type:

tuple[np.ndarray, np.ndarray]

flasc.data_processing.northing_offset_change_hoger._discretize(x: Series, threshold: int) ndarray[source]#

Get the class of the knots based on the times they repeat.

Parameters:
  • x (pd.Series) -- Series of knot positions of the trees for the different wind turbines.

  • threshold (int) -- Threshold used to declare a tree branch.

Returns:

Classes of the knots.

Return type:

np.ndarray

flasc.data_processing.northing_offset_change_hoger._shorth_mode(x: Series) float64[source]#

Estimates the Venter mode through the shorth method for the given data.

Parameters:

x (pd.Series) -- Data for which the mode will be estimated

Returns:

Mode of the data

Return type:

np.float64

flasc.data_processing.northing_offset_change_hoger._plot_regression(y_data: Series, y_regr: ndarray, date_time: Series, ylabel: str)[source]#

Function to plot the results of the regression tree.

Parameters:
  • y_data (pd.Series) -- Data used on the regression.

  • y_regr (np.ndarray) -- Results obtained from the tree regression.

  • date_time (pd.Series) -- Dates of the original data.

  • ylabel (str) -- Data that is shown in the plot.

flasc.data_processing.northing_offset_change_hoger.homogenize_hoger(scada: DataFrame | FlascDataFrame, var: str = 'wd', threshold: int = 1000, reference: str = 'last', plot_it: bool = False, max_depth: int = 4, ccp_alpha: float = 0.09) tuple[DataFrame, DataFrame][source]#

Homogenization routine of the Scada directions of the different wind turbines based on "var".

The Scada data is explored by applying a regression tree procedure to the differences in direction nof the wind turbines to get the most common jumps and their positions. These jumps are then reversed to correct the deviations.

Parameters:
  • scada (Union[pd.DataFrame, FlascDataFrame]) -- DataFrame containing the SCADA data.

  • var (str, optional) -- Variable to homogenize (yaw or wd). Defaults to 'wd'.

  • threshold (int, optional) -- Threshold for discretization. Defaults to 1000.

  • reference (str, optional) -- Reference point for homogenization. Defaults to 'last'.

  • plot_it (bool, optional) -- Whether to plot the results. Defaults to False.

  • max_depth (int, optional) -- Maximum depth of the regression tree. Defaults to 4.

  • ccp_alpha (float, optional) -- Complexity parameter for pruning. Defaults to 0.09

Returns:

Homogenized SCADA data and the results used to

homogenize it with the jumps and their knots.

Return type:

tuple[pd.DataFrame, pd.DataFrame]