Skip to content

Conversation

@isilber
Copy link
Contributor

@isilber isilber commented May 13, 2022

Description Of Changes

In this pull request, I've modified the equilibrium vapor pressure (e_s) calculation to a more accurate formulation based on Murphy and Koop (2005; reference added). I've also added a method to calculate the ice equilibrium vapor pressure (e_i) based on the same manuscript as well as a unit test for this method. Different variations (using different input coefficients) of Teten's formula have been used in the literature (e.g., Bolton, 1980; Alduchov and Eskrige, 1996) but the use of the exponential form of this type of parameterization means that the fits are valid in a relatively limited range of temperatures. The MP2005 formulation on the other hand is valid for a much broader range of temperatures.

I was contemplating whether to add an optional input parameter to saturation_vapor_pressure for the water phase with a default to ice, but then thought that it might be better to add a separate method for ice, thus making code and documentation easier to follow.
Also, I would recommend using the "equilibrium vapor pressure" term rather than "saturation vapor pressure" as that is a more physically accurate term, but that would likely result in plenty of mess after changing the terminology and method terms.

Checklist

  • [ V] Fully documented

@isilber isilber requested a review from a team as a code owner May 13, 2022 15:48
@isilber isilber requested review from dopplershift and removed request for a team May 13, 2022 15:48
@CLAassistant
Copy link

CLAassistant commented May 13, 2022

CLA assistant check
All committers have signed the CLA.

@dopplershift dopplershift added this to the 1.7.0 milestone Jan 22, 2025
Copy link
Contributor

@DWesl DWesl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks fine to me, though I haven't looked at the physical side yet.

#3726 is another PR along this line, if you want to poke at that


@exporter.export
@preprocess_and_wrap(wrap_like='temperature')
@process_units({'temperature': '[temperature]'}, '[pressure]')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps

Suggested change
@process_units({'temperature': '[temperature]'}, '[pressure]')
@process_units({'temperature': 'kelvin'}, '[pressure]')

to ensure it converts if someone passes Celsius or Fahrenheit? I should check whether the MetPy decorator works like the pint one.

Comment on lines +299 to +301
def test_ice_sat_vapor_pressure():
"""Test ice_saturation_vapor_pressure calculation."""
temp = (np.arange(1, 38) * units.degC).to(units.degK)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be worth parametrizing the test to pass temperature once in Kelvin and once in Celsius to ensure the conversion works properly? Something like:

Suggested change
def test_ice_sat_vapor_pressure():
"""Test ice_saturation_vapor_pressure calculation."""
temp = (np.arange(1, 38) * units.degC).to(units.degK)
@pytest.mark.parametrize('unit', [units.degK, units.degC])
def test_ice_sat_vapor_pressure(unit):
"""Test ice_saturation_vapor_pressure calculation."""
temp = (np.arange(1, 38) * units.degC).to(unit)

@dopplershift
Copy link
Member

dopplershift commented Apr 30, 2025

I really appreciate the time you put into this contribution, and apologies on us not getting you prompt feedback. In the end, we implemented a newer approach to calculate saturation vapor pressure over liquid and ice based on Ambaum (2020) in #3726. Please feel free to reach out if there are still shortcomings in the implementation for your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants