brightwind.analyse.analyse.dist_by_dir_sector

brightwind.analyse.analyse.dist_by_dir_sector(var_series, direction_series, sectors=12, aggregation_method='%frequency', direction_bin_array=None, direction_bin_labels=None, return_data=False)

Derive the distribution of a time series variable with respect to wind direction sectors. For example, if time series of wind speeds is sent, it produces a wind rose.

Parameters
  • var_series (pd.Series) – Time series of the variable whose distribution we need to find.

  • direction_series (pd.Series) – Time series of wind directions between [0-360].

  • sectors (int) – Number of direction sectors to bin in to. The first sector is centered at 0 by default. To change that behaviour specify direction_bin_array, which overwrites sectors.

  • aggregation_method (str) – Statistical method used to find distribution it can be mean, max, min, std, count, %frequency or a custom function. Computes frequency in percentages by default.

  • direction_bin_array (list, array, None) – Optional, to change default behaviour of first sector centered at 0 assign an array of bins to this.

  • direction_bin_labels (list, array, None) – Optional, you can specify an array of labels to be used for the bins. Uses string labels of the format ‘30-90’ by default. Overwrites sectors.

  • return_data (bool) – Set to True if you want the data returned.

Returns

A plot of a rose and a DataFrame/Series with wind direction sector as row indexes and columns with statistics chosen by aggregation_method.

Example usage

import brightwind as bw
df = bw.load_campbell_scientific(bw.datasets.demo_campbell_scientific_site_data)

rose, distribution = bw.dist_by_dir_sector(df.Spd40mN, df.Dir38mS, return_data=True)

#For using custom bins
rose, distribution = bw.dist_by_dir_sector(df.Spd40mN, df.Dir38mS,
                        direction_bin_array=[0,90,130,200,360],
                        direction_bin_labels=['northerly','easterly','southerly','westerly'],
                        return_data=True)

#For measuring standard deviation in a sector rather than frequency in percentage (default)
rose, distribution = bw.dist_by_dir_sector(df.Spd40mN, df.Dir38mS, aggregation_method='std',
    return_data=True)