Source code for foxes.models.vertical_profiles.abl_log_stable_ws
from foxes.core import VerticalProfile
from foxes.utils.abl import stable
import foxes.variables as FV
import foxes.constants as FC
[docs]
class ABLLogStableWsProfile(VerticalProfile):
"""
The stable ABL wind speed log profile.
Attributes
----------
ustar_input: bool
Flag for using ustar as an input
:group: models.vertical_profiles
"""
[docs]
def __init__(self, *args, ustar_input=False, **kwargs):
"""
Constructor.
Parameters
----------
args: tuple, optional
Additional arguments for VerticalProfile
ustar_input: bool
Flag for using ustar as an input
kwargs: dict, optional
Additional arguments for VerticalProfile
"""
super().__init__(*args, **kwargs)
self.ustar_input = ustar_input
[docs]
def calculate(self, data, heights):
"""
Run the profile calculation.
Parameters
----------
data: dict
The input data
heights: numpy.ndarray
The evaluation heights
Returns
-------
results: numpy.ndarray
The profile results, same
shape as heights
"""
z0 = data[FV.Z0]
mol = data[FV.MOL]
if self.ustar_input:
ustar = data[FV.USTAR]
else:
ws = data[FV.WS]
h0 = data[FV.H]
ustar = stable.ustar(ws, h0, z0, mol, kappa=FC.KAPPA)
psi = stable.psi(heights, mol)
return stable.calc_ws(heights, z0, ustar, psi, kappa=FC.KAPPA)