API Reference¶
- class wind_stats.GWAReader¶
Methods
load(fp)Deserialize fp GWC file-like object to dataset.
loads(s[, encoding])Deserialize s (a str, bytes or bytearray instance containing a GWC document) to Dataset.
- static load(fp: SupportsRead) Dataset¶
Deserialize fp GWC file-like object to dataset.
- static loads(s: str | bytes, encoding: str = 'ASCII') Dataset¶
Deserialize s (a str, bytes or bytearray instance containing a GWC document) to Dataset.
- class wind_stats.PowerCurve(wind_speed: Quantity, power: Quantity)¶
Power curve.
- Parameters:
- wind_speed: `pint.Quantity`
wind speed data
- wind_speed: `pint.Quantity`
power data
Methods
__call__(x)Linear interpolation on the power curve.
Examples
>>> power_data = [ 43.0, 184.0, 421.0, 778.0, 1270.0, 1905.0, 2593.0, 3096.0, 3268.0, 3297.0, 3300.0, ] * units.kW >>> wind_speeds = np.arange(3, 13) * units("m/s") >>> power_curve = PowerCurve(wind_speeds, power_data) >>> power_curve(8 * units("m/s")) <Quantity(1905.0, 'kilowatt')> >>> power_curve(40 * units("m/s")) <Quantity(0.0, 'kilowatt')>
- class wind_stats.Site(latitude: float, longitude: float, distribution: ~wind_stats.models.WindDistribution, elevation: float = 0.0, avg_temperature=<Quantity(15, 'degree_Celsius')>, avg_humidity: float = 0.0)¶
Site location.
Attributes
latitude
longitude
distribution: WindDistribution
elevation
avg_temperature
Methods
create_gwa_data(latitude, longitude, ...)Create Site with Global Wind Atlas Data.
Get mean power density in W/m².
- property air_density¶
- classmethod create_gwa_data(latitude: float, longitude: float, roughness_length: float | List[float], height: float, **kwargs) Site¶
Create Site with Global Wind Atlas Data.
Retrieve GWA data & initiate Site with Wind distribution.
- get_mean_power_density() Quantity¶
Get mean power density in W/m².
Notes
Mean power density :
\[\bar{P}_{density} = \frac{1}{2} \cdot \rho \cdot \int_{0}^{\infty}[v^3 pdf(v)] dv\]
- property mean_power_density: Quantity¶
- property mean_wind: Quantity¶
Mean wind speeds at site in m/s.
- class wind_stats.WindDistribution(distribution: rv_continuous)¶
Wind distribution.
Attributes
mean_wind_speed
Methods
from_data(wind_speed_data, roughness_length, ...)Create KDE WindDistribution based on measurement data.
from_gwc(gwc_dataset, roughness_length, height)Create Weibull WindDistribution based on GWC file dataset.
moment(n)Get n-raw moment of the distribution.
pdf(x)Probability density function.
weibull(A, k)Create Weibull WindDistribution.
- classmethod from_data(wind_speed_data, roughness_length: float | List[float], measurement_height: float, height: float) WindDistribution¶
Create KDE WindDistribution based on measurement data.
- classmethod from_gwc(gwc_dataset: xr.Dataset, roughness_length: float | List[float], height: float) WindDistribution¶
Create Weibull WindDistribution based on GWC file dataset.
- property mean_wind_speed: Quantity¶
- moment(n: int) float¶
Get n-raw moment of the distribution.
- pdf(x: float) float¶
Probability density function.
- classmethod weibull(A: float, k: float) WindDistribution¶
Create Weibull WindDistribution.
- class wind_stats.WindTurbine(name: str, power_curve: Tuple[Quantity, Quantity], diameter: float, height: float)¶
Attributes
Swept rotor area.
Methods
Get annual energy production.
get_energy_production(site, time)Calculate energy output over a period of time.
get_mean_power(site)Mean power output.
Get Cp coefficients for wind speeds defined in the power curve.
- get_annual_energy_production(site: Site) Quantity¶
Get annual energy production.
Integrate wind frequency with power curve & annual hours.
- Parameters:
- site: Site
Site where the wind turbine is located.
- Returns:
- energy: pint.Quantity
Annual energy to be expected in Wh.
See also
get_energy_productionGet energy production over any period of time.
- get_energy_production(site: Site, time: Quantity) Quantity¶
Calculate energy output over a period of time.
- Parameters:
- site: Site
Site where the wind turbine is located.
- time: `pint.Quantity`
period of time the result energy is produced.
- Returns:
- energy_production: pint.Quantity
See also
get_annual_energy_productionGet energy output over a year.
Notes
The energy produced is the integration of the power production on the wind speed probability density function over time:
\[E = \bar{P} \cdot t\]\[E = \int_{0}^{\infty}[P(v) \cdot pdf(v) \cdot t] dv\]
- get_mean_power(site: Site) Quantity¶
Mean power output.
\[\bar{P} = \int_{0}^{\infty}[P(v) \cdot pdf(v)] dv\]- Parameters:
- site: Site
- Returns:
- mean_power: pint.Quantity
- get_power_coefficients() Tuple[ndarray, ndarray]¶
Get Cp coefficients for wind speeds defined in the power curve.
Notes
The power coefficient \(C_p\) is the ratio between the power extracted & the theoretical wind power available going through the swept area.
\[C_p = \frac{P}{\frac{1}{2}\rho A V^{2}}\]
- property rotor_area: Quantity¶
Swept rotor area.
- wind_stats.get_gwc_data(latitude: float, longitude: float) Dataset¶
Get GWC file from Global Wind Atlas API.
Notes
See Global Wind Atlas Term of Use : https://globalwindatlas.info/about/TermsOfUse
- wind_stats.get_weibull_parameters(ds: Dataset, roughness_length: list[float] | float, height: float) tuple[float, float, list[float]]¶
Get A, k Weibull parameters based on GWA dataset files.
It computes based on roughness length & height for each wind rose sector.
- Parameters:
- ds: xr.Dataset
dataset read from GWC file.
- roughness_length: float or list[float]
array of 12 roughness lengths for each azimuthal wind sector (30°) or a global roughness_length.
- height: float
height at which wind is measured.
- Returns:
- parameters: tuple
Global weibull parameters & normalized frequencies for each sector.