-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add column relative humidity function #416
Add column relative humidity function #416
Conversation
I wonder if typhon would benefit from leveraging the work in metpy https://unidata.github.io/MetPy/latest/index.html |
@florian-roemer, @stefanbuehler: Here is the PR from Leonie. I'll merge it if you give it a thumbs-up. |
Comments:
|
Oliver and I came up with a more compact version of the function that implements Stefan's comments: def column_relative_humidity(vmr, p, T, axis=0):
r"""Convert VMR, pressure and temperature into column relative humidity.
.. math::
\mathrm{CRH} = \frac{IWV}{IWV_{saturated}}
The integrated water vapour (IWV) is caluculated using ty.physics.integrate_water_vapor(vmr, p).
To calculate the saturated intergrated water vapour (IWVS) the saturated mixing ratio (VMRS) is needed
which is calculated from the saturated water vapour pressure (es) which is derived via
ty.physics.e_eq_mixed_mk(T).
Parameters:
vmr (ndarray): Volume mixing ratio,
p (ndarray): Pressure [Pa],
T (ndarray): Temperature [K].
Returns:
float or ndarray: Column relative humidity.
"""
# saturated vmr
es = thermodynamics.e_eq_mixed_mk(T)
a = [1] * len(vmr.shape)
a[axis] = len(p)
p.shape = a
vmrs = es / p
# vmr to integrated water vapour content
iwv = integrate_water_vapor(vmr, p, axis=axis)
# vmrs to integrated saturated water vapour content
iwvs = integrate_water_vapor(vmrs, p, axis=axis)
return iwv/iwvs |
After this PR is done, I'll merge |
Looks good. |
Add column relative humidity function and water vapour pressure to specific humidity