Site classes
Site: base class
UniformSite: Site with uniform (same wind over all, i.e. flat uniform terrain) and constant wind speed probability of 1. Only for one fixed wind speed
UniformWeibullSite: Site with uniform (same wind over all, i.e. flat uniform terrain) and weibull distributed wind speed
WaspGridSite: Site with non-uniform (different wind at different locations, e.g. complex non-flat terrain) weibull distributed wind speed. Data obtained from WAsP grid files
XRSite: The flexible general base class behind all Sites.
Site
- class py_wake.site._site.Site(distance)[source]
elevation
(x_i, y_i)Local terrain elevation (height above mean sea level)
local_wind
(x, y[, h, wd, ws, time, ...])Local free flow wind conditions
plot_ws_distribution
([x, y, h, wd, ws, ...])Plot wind speed distribution
plot_wd_distribution
([x, y, h, n_wd, ...])Plot wind direction (and speed) distribution
- abstract elevation(x_i, y_i)[source]
Local terrain elevation (height above mean sea level)
- Parameters:
x_i (array_like) – Local x coordinate
y_i (array_like) – Local y coordinate
- Returns:
elevation
- Return type:
array_like
- local_wind(x, y, h=None, wd=None, ws=None, time=False, wd_bin_size=None, ws_bins=None, **_)[source]
Local free flow wind conditions
- Parameters:
x (array_like) – Local x coordinate
y (array_like) – Local y coordinate
h (array_like, optional) – Local h coordinate, i.e., heights above ground
wd (float, int or array_like, optional) – Global wind direction(s). Override self.default_wd
ws (float, int or array_like, optional) – Global wind speed(s). Override self.default_ws
time (boolean or array_like) – If True or array_like, wd and ws is interpreted as a time series If False, full wd x ws matrix is computed
wd_bin_size (int or float, optional) – Size of wind direction bins. default is size between first and second element in default_wd
ws_bin (array_like or None, optional) – Wind speed bin edges
- Returns:
- WD_ilkarray_like
local free flow wind directions
- WS_ilkarray_like
local free flow wind speeds
- TI_ilkarray_like
local free flow turbulence intensity
- P_ilkarray_like
Probability/weight
- Return type:
LocalWind object containing
- plot_wd_distribution(x=0, y=0, h=70, n_wd=12, ws_bins=None, ax=None)[source]
Plot wind direction (and speed) distribution
- Parameters:
n_wd (int) – Number of wind direction sectors
ws_bins (None, int or array_like, default is None) –
Splits the wind direction sector pies into different colors to show the probability of different wind speeds
If int, number of wind speed bins in the range 0-30
If array_like, limits of the wind speed bins limited by ws_bins, e.g. [0,10,20], will show 0-10 m/wd_bin_size and 10-20 m/wd_bin_size
ax (pyplot or matplotlib axes object, default None)
- plot_ws_distribution(x=0, y=0, h=70, wd=[0], ws=array([0.05, 0.15, 0.25, 0.35, 0.45, 0.55, 0.65, 0.75, 0.85, 0.95, 1.05, 1.15, 1.25, 1.35, 1.45, 1.55, 1.65, 1.75, 1.85, 1.95, 2.05, 2.15, 2.25, 2.35, 2.45, 2.55, 2.65, 2.75, 2.85, 2.95, 3.05, 3.15, 3.25, 3.35, 3.45, 3.55, 3.65, 3.75, 3.85, 3.95, 4.05, 4.15, 4.25, 4.35, 4.45, 4.55, 4.65, 4.75, 4.85, 4.95, 5.05, 5.15, 5.25, 5.35, 5.45, 5.55, 5.65, 5.75, 5.85, 5.95, 6.05, 6.15, 6.25, 6.35, 6.45, 6.55, 6.65, 6.75, 6.85, 6.95, 7.05, 7.15, 7.25, 7.35, 7.45, 7.55, 7.65, 7.75, 7.85, 7.95, 8.05, 8.15, 8.25, 8.35, 8.45, 8.55, 8.65, 8.75, 8.85, 8.95, 9.05, 9.15, 9.25, 9.35, 9.45, 9.55, 9.65, 9.75, 9.85, 9.95, 10.05, 10.15, 10.25, 10.35, 10.45, 10.55, 10.65, 10.75, 10.85, 10.95, 11.05, 11.15, 11.25, 11.35, 11.45, 11.55, 11.65, 11.75, 11.85, 11.95, 12.05, 12.15, 12.25, 12.35, 12.45, 12.55, 12.65, 12.75, 12.85, 12.95, 13.05, 13.15, 13.25, 13.35, 13.45, 13.55, 13.65, 13.75, 13.85, 13.95, 14.05, 14.15, 14.25, 14.35, 14.45, 14.55, 14.65, 14.75, 14.85, 14.95, 15.05, 15.15, 15.25, 15.35, 15.45, 15.55, 15.65, 15.75, 15.85, 15.95, 16.05, 16.15, 16.25, 16.35, 16.45, 16.55, 16.65, 16.75, 16.85, 16.95, 17.05, 17.15, 17.25, 17.35, 17.45, 17.55, 17.65, 17.75, 17.85, 17.95, 18.05, 18.15, 18.25, 18.35, 18.45, 18.55, 18.65, 18.75, 18.85, 18.95, 19.05, 19.15, 19.25, 19.35, 19.45, 19.55, 19.65, 19.75, 19.85, 19.95, 20.05, 20.15, 20.25, 20.35, 20.45, 20.55, 20.65, 20.75, 20.85, 20.95, 21.05, 21.15, 21.25, 21.35, 21.45, 21.55, 21.65, 21.75, 21.85, 21.95, 22.05, 22.15, 22.25, 22.35, 22.45, 22.55, 22.65, 22.75, 22.85, 22.95, 23.05, 23.15, 23.25, 23.35, 23.45, 23.55, 23.65, 23.75, 23.85, 23.95, 24.05, 24.15, 24.25, 24.35, 24.45, 24.55, 24.65, 24.75, 24.85, 24.95, 25.05, 25.15, 25.25, 25.35, 25.45, 25.55, 25.65, 25.75, 25.85, 25.95, 26.05, 26.15, 26.25, 26.35, 26.45, 26.55, 26.65, 26.75, 26.85, 26.95, 27.05, 27.15, 27.25, 27.35, 27.45, 27.55, 27.65, 27.75, 27.85, 27.95, 28.05, 28.15, 28.25, 28.35, 28.45, 28.55, 28.65, 28.75, 28.85, 28.95, 29.05, 29.15, 29.25, 29.35, 29.45, 29.55, 29.65, 29.75, 29.85, 29.95]), include_wd_distribution=False, ax=None)[source]
Plot wind speed distribution
- Parameters:
wd (int or array_like) – Wind direction(s) (one curve pr wind direction)
ws (array_like, optional) – Wind speeds to calculate for
include_wd_distributeion (bool, default is False) – If true, the wind speed probability distributions are multiplied by the wind direction probability. The sector size is set to 360 / len(wd). This only makes sense if the wd array is evenly distributed
ax (pyplot or matplotlib axes object, default None)
UniformSite
- class py_wake.site.UniformSite(p_wd=[1], ti=0.1, ws=12, interp_method='nearest', shear=None, initial_position=None, distance=None)[source]
Site with uniform (same wind over all, i.e. flat uniform terrain) and constant wind speed probability of 1. Only for one fixed wind speed
- __init__(p_wd=[1], ti=0.1, ws=12, interp_method='nearest', shear=None, initial_position=None, distance=None)[source]
Instantiate a site from an xarray dataset
- Parameters:
ds (xarray dataset) – See https://topfarm.pages.windenergy.dtu.dk/PyWake/notebooks/Site.html#XRSite for details
initial_position (array_like, optional) – initial position of turbines can be stored in the site object
interp_method ({'linear', 'nearest'} or dict) – interpolation method. Default is linear. Methods can be mixed by specifying the variable and corresponding method in a dict, e.g. {‘wd’: ‘nearest’, ‘x’: ‘linear’}
shear (Shear-object or function (lw, WS_ref, lw.h) -> WS_z) – Function to compute the wind speed at different heights
distance (Distance-object or None) – If None, default, the distance method is set to StraightDistance
default_ws (array_like) – The default range of wind speeds
bounds ({'check', 'limit', 'ignore'}) –
Specifies how bounds is handled:
’check’: bounds check is performed. An error is raised if interpolation point outside area
’limit’: interpolation points are forced inside the area
’ignore’: Faster option with no check. Use this option if data is guaranteed to be inside the area
UniformWeibullSite
- class py_wake.site.UniformWeibullSite(p_wd, a, k, ti=None, interp_method='nearest', shear=None, distance=None)[source]
Site with uniform (same wind over all, i.e. flat uniform terrain) and weibull distributed wind speed
- __init__(p_wd, a, k, ti=None, interp_method='nearest', shear=None, distance=None)[source]
Initialize UniformWeibullSite
- Parameters:
p_wd (array_like) – Probability of wind direction sectors
a (array_like) – Weilbull scaling parameter of wind direction sectors
k (array_like) – Weibull shape parameter
ti (float or array_like, optional) – Turbulence intensity
interp_method ('nearest', 'linear') – p_wd, a, k, ti and alpha are interpolated to 1 deg sectors using this method
shear (Shear object) – Shear object, e.g. NoShear(), PowerShear(h_ref, alpha)
distance (Distance object or None) – Distance object to calculate the distance between wind turbines. Defaults to StaightDistance based on reference wind direction
Notes
The wind direction sectors will be: [0 +/- w/2, w +/- w/2, …] where w is 360 / len(p_wd)
WaspGridSite
- class py_wake.site.WaspGridSite(ds, distance=<py_wake.site.distance.TerrainFollowingDistance object>, mode='valid')[source]
Site with non-uniform (different wind at different locations, e.g. complex non-flat terrain) weibull distributed wind speed. Data obtained from WAsP grid files
- __init__(ds, distance=<py_wake.site.distance.TerrainFollowingDistance object>, mode='valid')[source]
- Parameters:
ds (xarray) – dataset as returned by load_wasp_grd
distance (Distance object, optional) – Alternatives are StraightDistance and TerrainFollowingDistance2
mode ({'valid', 'extrapolate'}, optional) – if valid, terrain elevation outside grid area is NAN if extrapolate, the terrain elevation at the grid border is returned outside the grid area
XRSite
- class py_wake.site.XRSite(ds, initial_position=None, interp_method='linear', shear=None, distance=None, default_ws=array([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]), bounds='check')[source]
The flexible general base class behind all Sites
- __init__(ds, initial_position=None, interp_method='linear', shear=None, distance=None, default_ws=array([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]), bounds='check')[source]
Instantiate a site from an xarray dataset
- Parameters:
ds (xarray dataset) – See https://topfarm.pages.windenergy.dtu.dk/PyWake/notebooks/Site.html#XRSite for details
initial_position (array_like, optional) – initial position of turbines can be stored in the site object
interp_method ({'linear', 'nearest'} or dict) – interpolation method. Default is linear. Methods can be mixed by specifying the variable and corresponding method in a dict, e.g. {‘wd’: ‘nearest’, ‘x’: ‘linear’}
shear (Shear-object or function (lw, WS_ref, lw.h) -> WS_z) – Function to compute the wind speed at different heights
distance (Distance-object or None) – If None, default, the distance method is set to StraightDistance
default_ws (array_like) – The default range of wind speeds
bounds ({'check', 'limit', 'ignore'}) –
Specifies how bounds is handled:
’check’: bounds check is performed. An error is raised if interpolation point outside area
’limit’: interpolation points are forced inside the area
’ignore’: Faster option with no check. Use this option if data is guaranteed to be inside the area