windkit.shear_extrapolate#

windkit.shear_extrapolate(wind_speed, height, shear_exponent=0.143, coord_height='height')[source]#

Shear extrapolate wind speeds to new heights using the power law.

Notes

Power-law shear extrapolation:

u_2 &= u_1 * (h_2/h_1)^{\alpha}

where:

h_1 &= \mathrm{ known\, height} h_2 &= \mathrm{ new\, height} u_1 &= \mathrm{ wind\, speed\, at\, height\,} h_1 u_2 &= \mathrm{ wind\, speed\, at\, height\,} h_2 \alpha &= \mathrm{ shear\, exponent}

Parameters:
  • wind_speed (xarray.DataArray) – Wind speed DataArray with wind speeds at known heights. A height coordinate must be present. If the height coordinate is also a dimension with more than one known height, the nearest height to each target height will be used. If wind speeds are at unstructured heights (i.e., height is a coordinate but not a dimension), only one target height can be used, or varying heights that match the dimensions of wind_speed.

  • height (number, collection of numbers, or xarray.DataArray) – New heights to which wind speeds will be extrapolated.

  • shear_exponent (number, xarray.DataArray, optional) – Shear exponent for the power law, by default 0.143. A DataArray can be provided to have varying shear exponents over other dimensions (e.g., time). If the shear exponent also varies with height, the height nearest to the target height will be used.

  • coord_height (str, optional) – Name of the height coordinate in wind_speeds and new_heights, by default “height”.

Returns:

New time-series wind climate dataset with wind speeds at the specified heights.

Return type:

xarray.Dataset

Examples

>>> import numpy as np
>>> import pandas as pd
>>> import xarray as xr
>>> import windkit as wk
>>> wind_speed = xr.DataArray(
        np.array([[10.0, 12.0, 14.0], [10.5, 12.5, 14.5], [11.0, 13.0, 15.0]]).T,
        dims=["time", "height"],
        coords={
            "time": pd.date_range("2023-01-01", periods=3, freq="h"),
            "height": [10.0, 30.0, 40.0],
        },
    )
>>> wind_speed_new = wk.shear_extrapolate(wind_speed, 100, shear_exponent=0.143)
>>> print(wind_speed_new)
<xarray.DataArray (time: 3, height: 1)> Size: 24B
array([[12.54001646],
       [14.82001945],
       [17.10002244]])
Coordinates:
* time     (time) datetime64[ns] 24B 2023-01-01 ... 2023-01-01T02:00:00
* height   (height) int64 8B 100