brightwind.analyse.shear.Shear.BySector

class brightwind.analyse.shear.Shear.BySector(wspds, heights, wdir, min_speed=3, calc_method='power_law', sectors=12, direction_bin_array=None, direction_bin_labels=None)

Calculates alpha, using the power law, or the roughness coefficient, using the log law, for a wind series binned by direction. 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 of wind speeds to be used for calculating

shear. :type wspds: pandas.DataFrame, list of pandas.Series or list. :param heights: List of anemometer heights :type heights: list :param wdir: Wind direction measurements :type wdir: pandas.DataFrame or Series :param: min_speed: Only speeds higher than this would be considered for calculating shear, default is 3. :type: min_speed: float :param calc_method: Method to use for calculation, either ‘power_law’ (returns alpha) or ‘log_law’

(returns the roughness coefficient).

Parameters
  • sectors (int) – Number of sectors for the shear to be calculated for.

  • direction_bin_array (array) – Specific array of directional bins to be used. If None, bins are calculated by 360/sectors.

  • direction_bin_labels (array) – Labels to be given to the above direction_bin array.

Returns

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

Return type

BySector object

Example usage

::

import brightwind as bw import pprint

# Load anemometer data to calculate exponents data = bw.load_csv(C:UsersStephenDocumentsAnalysisdemo_data) anemometers = data[[‘Spd80mS’, ‘Spd60mS’,’Spd40mS’]] heights = [80, 60, 40] directions = data[‘Dir78mS’]

# Calculate shear exponents using default bins ([345,15,45,75,105,135,165,195,225,255,285,315,345]) by_sector_power_law= bw.Shear.BySector(anemometers, heights, directions) by_sector_log_law= bw.Shear.BySector(anemometers, heights, directions, calc_method=’log_law’)

# Calculate shear exponents using custom bins custom_bins = [0,30,60,90,120,150,180,210,240,270,300,330,360] by_sector_power_law_custom_bins = bw.Shear.BySector(anemometers, heights, directions, direction_bin_array=custom_bins)

# Get alpha or roughness values calculated by_sector_power_law.alpha by_sector_log_law.roughness

# View plot by_sector_power_law.plot by_sector_log_law.plot

# View input data by_sector_power_law.wspds by_sector_log_law.wspds

# View other information pprint.pprint(by_sector_power_law.info) pprint.pprint(by_sector_log_law.info)

__init__(wspds, heights, wdir, min_speed=3, calc_method='power_law', sectors=12, direction_bin_array=None, direction_bin_labels=None)

Calculates alpha, using the power law, or the roughness coefficient, using the log law, for a wind series binned by direction. 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 of wind speeds to be used for calculating

shear. :type wspds: pandas.DataFrame, list of pandas.Series or list. :param heights: List of anemometer heights :type heights: list :param wdir: Wind direction measurements :type wdir: pandas.DataFrame or Series :param: min_speed: Only speeds higher than this would be considered for calculating shear, default is 3. :type: min_speed: float :param calc_method: Method to use for calculation, either ‘power_law’ (returns alpha) or ‘log_law’

(returns the roughness coefficient).

Parameters
  • sectors (int) – Number of sectors for the shear to be calculated for.

  • direction_bin_array (array) – Specific array of directional bins to be used. If None, bins are calculated by 360/sectors.

  • direction_bin_labels (array) – Labels to be given to the above direction_bin array.

Returns

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

Return type

BySector object

Example usage

::

import brightwind as bw import pprint

# Load anemometer data to calculate exponents data = bw.load_csv(C:UsersStephenDocumentsAnalysisdemo_data) anemometers = data[[‘Spd80mS’, ‘Spd60mS’,’Spd40mS’]] heights = [80, 60, 40] directions = data[‘Dir78mS’]

# Calculate shear exponents using default bins ([345,15,45,75,105,135,165,195,225,255,285,315,345]) by_sector_power_law= bw.Shear.BySector(anemometers, heights, directions) by_sector_log_law= bw.Shear.BySector(anemometers, heights, directions, calc_method=’log_law’)

# Calculate shear exponents using custom bins custom_bins = [0,30,60,90,120,150,180,210,240,270,300,330,360] by_sector_power_law_custom_bins = bw.Shear.BySector(anemometers, heights, directions, direction_bin_array=custom_bins)

# Get alpha or roughness values calculated by_sector_power_law.alpha by_sector_log_law.roughness

# View plot by_sector_power_law.plot by_sector_log_law.plot

# View input data by_sector_power_law.wspds by_sector_log_law.wspds

# View other information pprint.pprint(by_sector_power_law.info) pprint.pprint(by_sector_log_law.info)

Methods

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

Calculates alpha, using the power law, or the roughness coefficient, using the log law, for a wind series binned by direction.

apply(wspds, wdir, height, shear_to)

Applies shear calculated to a wind speed time series by wind direction to scale wind speed from one height to another.

Attributes

alpha

roughness