brightwind.analyse.shear.Shear.TimeOfDay

class brightwind.analyse.shear.Shear.TimeOfDay(wspds, heights, min_speed=3, calc_method='power_law', by_month=True, segment_start_time=7, segments_per_day=24, plot_type='line')

Calculates alpha, using the power law, or the roughness coefficient, using the log law, for a wind series binned by time of the day and (optionally by) month, depending on the user’s inputs. The alpha/roughness coefficient values are calculated based on the average wind speeds at each measurement height in each bin.

Parameters
  • wspds (pandas.DataFrame, list of pandas.Series or list.) – pandas.DataFrame, list of pandas.Series or list of wind speeds to be used for calculating shear.

  • heights (list) – List of anemometer heights..

  • min_speed (float) – Only speeds higher than this would be considered for calculating shear, default is 3

  • calc_method (str) – method to use for calculation, either ‘power_law’ (returns alpha) or ‘log_law’ (returns the roughness coefficient).

  • by_month (Boolean) – If True, calculate alpha or roughness coefficient values for each daily segment and month. If False, average alpha or roughness coefficient values are calculated for each daily segment across all months.

  • segment_start_time (int) – Starting time for first segment.

  • segments_per_day (int) – Number of segments into which each 24 period is split. Must be a divisor of 24.

  • plot_type (str) – Type of plot to be generated. Options include ‘line’, ‘step’ and ‘12x24’.

Returns

TimeOfDay object containing calculated alpha/roughness coefficient values, a plot and other data.

Return type

TimeOfDay object

Example usage

import brightwind as bw
import pprint

# Load anemometer data to calculate exponents
data = bw.load_csv(C:\Users\Stephen\Documents\Analysis\demo_data)
anemometers = data[['Spd80mS', 'Spd60mS','Spd40mS']]
heights = [80, 60, 40]

# Using with a DataFrame of wind speeds
timeofday_power_law = bw.Shear.TimeOfDay(anemometers, heights, daily_segments=2, segment_start_time=7)
timeofday_log_law = bw.Shear.TimeOfDay(anemometers, heights, calc_method='log_law', by_month=False)

# Get alpha or roughness values calculated
timeofday_power_law.alpha
timeofday_log_law.roughness

# View plot
timeofday_power_law.plot
timeofday_log_law.plot

# View input data
timeofday_power_law.wspds
timeofday_log_law.wspds

# View other information
pprint.pprint(timeofday_power_law.info)
pprint.pprint(timeofday_log_law.info)
__init__(wspds, heights, min_speed=3, calc_method='power_law', by_month=True, segment_start_time=7, segments_per_day=24, plot_type='line')

Calculates alpha, using the power law, or the roughness coefficient, using the log law, for a wind series binned by time of the day and (optionally by) month, depending on the user’s inputs. The alpha/roughness coefficient values are calculated based on the average wind speeds at each measurement height in each bin.

Parameters
  • wspds (pandas.DataFrame, list of pandas.Series or list.) – pandas.DataFrame, list of pandas.Series or list of wind speeds to be used for calculating shear.

  • heights (list) – List of anemometer heights..

  • min_speed (float) – Only speeds higher than this would be considered for calculating shear, default is 3

  • calc_method (str) – method to use for calculation, either ‘power_law’ (returns alpha) or ‘log_law’ (returns the roughness coefficient).

  • by_month (Boolean) – If True, calculate alpha or roughness coefficient values for each daily segment and month. If False, average alpha or roughness coefficient values are calculated for each daily segment across all months.

  • segment_start_time (int) – Starting time for first segment.

  • segments_per_day (int) – Number of segments into which each 24 period is split. Must be a divisor of 24.

  • plot_type (str) – Type of plot to be generated. Options include ‘line’, ‘step’ and ‘12x24’.

Returns

TimeOfDay object containing calculated alpha/roughness coefficient values, a plot and other data.

Return type

TimeOfDay object

Example usage

import brightwind as bw
import pprint

# Load anemometer data to calculate exponents
data = bw.load_csv(C:\Users\Stephen\Documents\Analysis\demo_data)
anemometers = data[['Spd80mS', 'Spd60mS','Spd40mS']]
heights = [80, 60, 40]

# Using with a DataFrame of wind speeds
timeofday_power_law = bw.Shear.TimeOfDay(anemometers, heights, daily_segments=2, segment_start_time=7)
timeofday_log_law = bw.Shear.TimeOfDay(anemometers, heights, calc_method='log_law', by_month=False)

# Get alpha or roughness values calculated
timeofday_power_law.alpha
timeofday_log_law.roughness

# View plot
timeofday_power_law.plot
timeofday_log_law.plot

# View input data
timeofday_power_law.wspds
timeofday_log_law.wspds

# View other information
pprint.pprint(timeofday_power_law.info)
pprint.pprint(timeofday_log_law.info)

Methods

__init__(wspds, heights[, min_speed, …])

Calculates alpha, using the power law, or the roughness coefficient, using the log law, for a wind series binned by time of the day and (optionally by) month, depending on the user’s inputs.

apply(wspds, height, shear_to)

Applies shear calculated to a wind speed time series by time of day (and optionally by month) to scale

Attributes

alpha

roughness