waves.utilities.floris_runners#

Provides the FLORIS-based methods for pre-processing data and post-processing results.

Functions

calculate_monthly_wind_rose_results(...)

Calculate the turbine AEP contribution for each month of a year, in MWh.

check_monthly_wind_rose(project_wind_rose, ...)

Checks the monthly wind rose parameterizations to ensure the DataFrames are the correct shape, so that when the frequency column is extracted, the compared data is the same.

create_monthly_wind_rose(weather_df)

Create a dictionary of month and a long-term WindRose object based on all the wind condition data for that month.

create_single_month_wind_rose(weather_df, month)

Creates the FLORIS WindRose object for a given month based on the weather_df's DatetimeIndex.

run_chunked_time_series_floris(args)

Runs fi.calculate_wake() over a chunk of a larger time series analysis and returns the individual turbine powers for each corresponding time.

run_parallel_time_series_floris(args_list[, ...])

Runs the time series floris calculations in parallel.

waves.utilities.floris_runners.run_chunked_time_series_floris(args)[source]#

Runs fi.calculate_wake() over a chunk of a larger time series analysis and returns the individual turbine powers for each corresponding time.

Return type:

tuple[tuple[int, int], FlorisInterface, DataFrame]

Parameters:
  • fi (FlorisInterface) -- A copy of the base FlorisInterface object.

  • weather (pd.DataFrame) -- A subset of the full weather profile, with only the datetime index and columns: "windspeed" and "wind_direction".

  • chunk_id (tuple[int, int]) -- A tuple of the year and month for the data being processed.

  • reinit_kwargs (dict, optional) -- Any additional reinitialization keyword arguments. Defaults to {}.

  • run_kwargs (dict, optional) -- Any additional calculate_wake keyword arguments. Defaults to {}.

  • args (tuple)

Returns:

tuple[tuple[int, int], FlorisInterface, pd.DataFrame] -- The chunk_id, a reinitialized fi using the appropriate wind parameters that can be used for further post-processing, and the resulting turbine powers.

waves.utilities.floris_runners.run_parallel_time_series_floris(args_list, nodes=-1)[source]#

Runs the time series floris calculations in parallel.

Return type:

tuple[dict[tuple[int, int], FlorisInterface], DataFrame]

Parameters:
  • args_list (list[tuple[FlorisInterface, pd.DataFrame, tuple[int, int], dict, dict]])) -- A list of the chunked by month arguments that get passed to run_chunked_time_series_floris.

  • nodes (int, optional) -- The number of nodes to parallelize over. If -1, then it will use the floor of 80% of the available CPUs on the computer. Defaults to -1.

Returns:

tuple[dict[tuple[int, int], FlorisInterface], pd.DataFrame] -- A dictionary of the chunk_id and FlorisInterface object, and the full turbine power dataframe (without renamed columns).

waves.utilities.floris_runners.create_single_month_wind_rose(weather_df, month)[source]#

Creates the FLORIS WindRose object for a given month based on the weather_df's DatetimeIndex.

Return type:

tuple[int, WindRose]

Parameters:
  • weather_df (pd.DataFrame) -- The weather profile used to create long-term, month-based WindRose objects

  • month (int) -- The month of the year to create a WindRose object.

Returns:

tuple[int, WindRose] -- A tuple of the month passed and the final WindRose object.

waves.utilities.floris_runners.create_monthly_wind_rose(weather_df)[source]#

Create a dictionary of month and a long-term WindRose object based on all the wind condition data for that month.

Return type:

dict[int, WindRose]

Parameters:
  • weather_df (pd.DataFrame) -- The weather profile used to create long-term, month-based WindRose objects

  • month (int) -- The month of the year to create a WindRose object.

Returns:

dict[int, WindRose] -- A dictionary of the integer month and the long-term WindRose object associated with all the wind conditions during that month.

waves.utilities.floris_runners.check_monthly_wind_rose(project_wind_rose, monthly_wind_rose)[source]#

Checks the monthly wind rose parameterizations to ensure the DataFrames are the correct shape, so that when the frequency column is extracted, the compared data is the same.

Return type:

dict[int, WindRose]

Parameters:
  • project_wind_rose (WindRose) -- The WindRose created using the long term reanalysis weather profile.

  • monthly_wind_rose (dict[int, WindRose]) -- A dictionary of the month as an int and WindRose created from the long term project reanalysis weather profile that was filtered on weather data for the focal month.

Returns:

dict[int, WindRose] -- The monthly_wind_rose but with an missing wind conditions added into the WindRose with 0 frequency.

waves.utilities.floris_runners.calculate_monthly_wind_rose_results(turbine_power, freq_monthly)[source]#

Calculate the turbine AEP contribution for each month of a year, in MWh.

Return type:

DataFrame

Parameters:
  • turbine_power (np.ndarray) -- The array of turbine powers, with shape (num wd x num ws x num turbines), calculated from the possible wind conditions at the site given the turbine layout.

  • freq_monthly (dict[int, np.ndarray]) -- The dictionary of integer months (i.e., 1 for January) and array of frequences, with shape (num wd x num ws), created by the long term wind conditions filtered on the month.

Returns:

pd.DataFrame, pd.DataFrame -- A DataFrame of each month's contribution to the AEP for each turbine in the wind farm, with shape (12 x num turbines).