flasc.utilities.floris_tools.interpolate_floris_from_df_approx#
- flasc.utilities.floris_tools.interpolate_floris_from_df_approx(df, df_approx, method='linear', wrap_0deg_to_360deg=True, extrapolate_ws=True, extrapolate_ti=True, mirror_nans=True, verbose=True)[source]#
Interpolate FLORIS predictions from a precalculated table of solutions.
This function generates the FLORIS predictions for a set of historical data, 'df', quickly by linearly interpolating from a precalculated set of FLORIS solutions, 'df_approx'. We use linear interpolation to eliminate dependency of the computation time on the size of the dataframe/number of timeseries samples.
- Parameters:
df (pd.DataFrame) -- A Pandas DataFrame containing the timeseries for
contain (which the FLORIS predictions should be calculated. It should)
'wd' (at least the columns)
'ws'
'ti' (and)
the (which are respectively)
direction (ambient wind)
speed (ambient wind)
turbulence (and ambient)
example (intensity to be used in the FLORIS predictions. An)
df= -- time wd ws ti
00 (1 2018-01-01) -- 10:00 213.1 7.81 0.08
00 -- 20:00 215.6 7.65 0.08
... (... ... ... ...)
23 (52104 2018-12-31) -- 30:00 15.6 11.0 0.08
23 -- 40:00 15.3 11.1 0.08
df_approx (pd.DataFrame) -- A Pandas DataFrame containing the precalculated
directions (solutions of the FLORIS model for a large grid of ambient wind)
:param : :param wind speeds and turbulence intensities. This table is typically calculated: :param using the 'calc_floris_approx_table: :type using the 'calc_floris_approx_table: ... :param can also be generated by hand using other tools like PyWake. df_approx: :param typically has the form: :param df_approx=: wd ws ti pow_000 pow_001 ... pow_006 :param 0 0.0 1.0 0.03 0.0 0.0 ... 0.0: :param 1 3.0 1.0 0.03 0.0 0.0 ... 0.0: :param ... ... ... ... ... ... ... ...: :param 32399 357.0 24.0 0.18 5.0e6 5.0e6 ... 5.0e6: :param 32400 360.0 24.0 0.18 5.0e6 5.0e6 ... 5.0e6: :param method: Interpolation method, options are 'nearest' and :type method: str, optional :param 'linear'. Defaults to 'linear'.: :param wrap_0deg_to_360deg: The precalculated set of FLORIS solutions :type wrap_0deg_to_360deg: bool, optional :param are typically calculates from 0 deg to 360 deg in steps of 2.0 deg or 3.0 deg.: :param This means the last wind direction in the precalculated table of solutions is: :param at 357.0 deg or 358.0 deg. If the user uses this for interpolation: :param any wind: :param directions in 'df' with a value between 358.0 deg and 360.0 deg cannot be: :param interpolated because it falls outside the bounds. This option copies the: :param precalculated table solutions from 0 deg over to 360 deg to allow interpolation: :param for the entire wind rose. Recommended to set to True. Defaults to True.: :param extrapolate_ws: The precalculated set of FLORIS solutions, :type extrapolate_ws: bool, optional :param df_approx: :param only covers a finite range of wind speeds: :param typically from 1 m/s up: :param to 25 m/s. Any wind speed values below or above this range therefore cannot: :param be interpolated using the 'linear' method and therefore becomes a NaN. To: :param prevent this: :param we can copy over the lowest and highest wind speed value interpolated: :param to finite bounds to avoid this. For example: :param if our lowest wind speed calculated is: :param 1 m/s: :param we copy the solutions at 1 m/s over to a wind speed of 0 m/s: :param implicitly: :param assuming these values are equal. This allows interpolation over wind speeds below: :param 1 m/s. Additionally: :type 1 m/s. Additionally: e.g., 25 m/s :param we copy the highest wind speed solutions: :type we copy the highest wind speed solutions: e.g., 25 m/s :param to a wind speed of 99 m/s to allow interpolation of values up to 99 m/s.: :param Defaults to True.: :param extrapolate_ti: The precalculated set of FLORIS solutions, :type extrapolate_ti: bool, optional :param df_approx: :param only covers a finite range of turbulence intensities: :param typically from: :param 0.03 to 0.18: :param being respectively 3% and 18%. In the same fashion at: :param 'extrapolate_ws': :param we copy the lowest and highest turbulence intensity solutions: :param over to 0.00 and 1.00 turbulence intensity: :param to cover all possible conditions: :param we may find and to avoid any NaN interpolation. This implicitly makes the: :param assumption that the solutions at 0% TI are equal to your solutions at 3% TI: :param : :param and that your solutions at 100% TI are equal to your solutions at 18% TI.: :param This may or may not be a valid assumption for your scenario. Defaults to True.: :param mirror_nans: The raw data for which the FLORIS predictions are :type mirror_nans: bool, optional :param made may contain NaNs for specific turbines: :param e.g.: :param due to sensor issues or due: :param to irregular turbine behavior. By setting mirror_nans=True: :param the NaNs for turbines: :param from the raw data will be copied such that NaNs in the raw data will also mean: :param NaNs in the FLORIS predictions. Recommended to set this to True to ensure the: :param remainder of the energy ratio analysis is a fair and accurate comparison. Defaults: :param to True.: :param verbose: Print warnings and information to the console. :type verbose: bool, optional :param Defaults to True.:
- Returns:
The Pandas Dataframe containing the timeseries 'wd', 'ws' and 'ti', plus the power productions (and potentially local inflow conditions) of the turbines interpolated from the precalculated solutions table. For example,
- df=
time wd ws ti pow_000 pow_001 ... pow_006
0 2018-01-01 00:10:00 213.1 7.81 0.08 1251108.2 825108.2 ... 725108.9 1 2018-01-01 00:20:00 215.6 7.65 0.08 1202808.0 858161.8 ... 692111.2 ... ... ... ... ... ... ... ... ... 52103 2018-12-31 23:30:00 15.6 11.0 0.08 4235128.7 3825108.4 ... 2725108.3 52104 2018-12-31 23:40:00 15.3 11.1 0.08 3860281.3 3987634.7 ... 2957021.7
- Return type:
df (pd.DataFrame)