windkit.ws_cdf#

windkit.ws_cdf(wc_obj, *, bysector=False, ws_bins=None, n_sectors=None)[source]#

Calculate the wind speed cumulative distribution function from a wind climate.

Parameters:
  • wc_obj (xarray.Dataset) – Binned, Weibull or time series wind climate.

  • bysector (bool) – Calculate the CDF by sector, defaults to False. For a Weibull wind climate the all-sector CDF is the wdfreq-weighted sum of the sectorwise CDFs. A time series wind climate is binned into sectors with windkit.wd_to_sector(), skipping samples without a direction.

  • ws_bins (int or array_like, optional) – Wind speed bins to evaluate the CDF of a Weibull or time series wind climate on, as accepted by windkit.create_wsbin_coords(). Defaults to its default bins. A binned wind climate uses its own bins.

  • n_sectors (int, optional) – Number of sectors to bin a time series wind climate into when bysector is True. Defaults to 12.

Returns:

wind_speed_cdf, the CDF at the wsceil of each wsbin. For a Weibull or time series wind climate this is the exact CDF: the frequency below the ceiling, which stays below 1 if some wind speeds exceed the last ceiling. A binned wind climate holds only the frequencies within its bins, so its CDF reaches 1 at the last ceiling. A time series counts the samples strictly below each ceiling, so a speed on a ceiling counts in the bin above, as in windkit.bwc_from_tswc(), except that its last bin also holds speeds equal to the last ceiling.

Return type:

xarray.DataArray

Raises:

ValueError – If wc_obj is not a known wind climate, ws_bins is given for a binned wind climate, or n_sectors is given for anything but a time series wind climate with bysector=True or is not a positive integer.