Skip to content

Conversation

@tjwixtrom
Copy link
Contributor

This contains implementations of the different methods of calculating saturation vapor pressure referenced in #508. When a method is chosen, the others can be removed from the thermo file and tests updated, along with better documentation.

Copy link
Contributor

@jrleeman jrleeman left a comment

Choose a reason for hiding this comment

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

Some cleanup to do.

Instead of temperature, dewpoint may be used in order to calculate
the actual (ambient) water vapor (partial) pressure.
The formula used is that from [Koutsoyiannis2012]_ for T in degrees Celsius:
Copy link
Contributor

Choose a reason for hiding this comment

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

No such reference in the docs.

#######
# This version uses MetPy constants with the Koutsoyiannis2012 formula
sat_pressure = 6.11657 * units.hPa
T0 = 273.16 * units.kelvin
Copy link
Contributor

Choose a reason for hiding this comment

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

273.15?

Copy link
Member

Choose a reason for hiding this comment

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

IIRC, It's 0.01K above the freezing point

The formula used is that from [Koutsoyiannis2012]_ for T in degrees Celsius:
.. math:: 6.112 e^\frac{17.67T}{T + 243.5}
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this reflect the implementation in the function?


###################
# This is the same as above, but incorporates a variable Lv
sat_pressure = 6.11657 * units.hPa
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comments as previous function

# a formula plays havoc with units support.

###################
# This is the same as above, but incorporates a variable Lv
Copy link
Contributor

Choose a reason for hiding this comment

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

Use a function name here - no guarantees as to function ordering being preserved.


@exporter.export
@check_units('[temperature]')
def saturation_vapor_pressure_metpy_orig(temperature):
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if this stays, but if it does the spelling will have to be determined.

@tjwixtrom
Copy link
Contributor Author

Just to clarify, this is waiting for a determination of which method to go with. Then the others will be removed, docstring updated, and tests updated.

@dopplershift
Copy link
Member

I doubt a decision will be made before 0.6, but it's good to have this hanging around so we can move quickly when we have the cycles for it.

@dopplershift dopplershift added Area: Calc Pertains to calculations Type: Enhancement Enhancement to existing functionality labels Aug 2, 2017
@tjwixtrom
Copy link
Contributor Author

@dopplershift Not a problem, just letting both of you know that a detailed code review is not really important at this stage.

@jrleeman jrleeman added Status: Needs Review Pull request needs review Status: Team Discussion Development team needs to discuss issue to decide how to proceed and removed Status: Needs Review Pull request needs review labels Aug 4, 2017
@jrleeman jrleeman added this to the Fall 2017 milestone Aug 7, 2017
@jrleeman jrleeman modified the milestones: Fall 2017, 0.6.1, Winter 2017 Oct 26, 2017
@jrleeman jrleeman removed this from the 0.7 milestone Nov 15, 2017
@dopplershift dopplershift added this to the Spring 2018 milestone Nov 15, 2017
@jrleeman jrleeman removed this from the 0.8 milestone Apr 11, 2018
@dopplershift dopplershift modified the milestones: 1.1, 1.0 Apr 16, 2020
@jthielen jthielen modified the milestones: 1.0, 1.1 Jun 11, 2020
@deeplycloudy deeplycloudy added the Subarea: Thermo Pertains to thermodynamic calculations and their physical correctness label Aug 21, 2020
Base automatically changed from master to main February 22, 2021 22:39
@dopplershift dopplershift modified the milestones: 1.1.0, 1.2.0 Aug 2, 2021
@dopplershift dopplershift modified the milestones: 1.2.0, 1.3.0 Oct 8, 2021
@dopplershift dopplershift modified the milestones: 1.3.0, May 2022 Mar 31, 2022
@dopplershift dopplershift modified the milestones: May 2022, July 2022 May 16, 2022
@dopplershift dopplershift removed this from the September 2022 milestone Sep 15, 2022
@dopplershift dopplershift requested a review from a team as a code owner October 31, 2024 20:36
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.

Some suggestions for the pint decorators to ensure the units wind up how the function expects, though I had to guess at what those units actually were. Reading the referenced papers would likely help with those guesses.

#3726 seems to have similar ideas, if you want to poke at that.



@exporter.export
@check_units('[temperature]')
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
@check_units('[temperature]')
@check_units('degC')

Given the conversion to Kelvin, I think this would be the right units



@exporter.export
@check_units('[temperature]')
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
@check_units('[temperature]')
@check_units('kelvin')

I'm guessing, given the division



@exporter.export
@check_units('[temperature]')
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
@check_units('[temperature]')
@check_units('kelvin')

This one actually does specify

@dopplershift
Copy link
Member

#3726 updated the calculation to use Ambaum (2020) and incorporate saturation over ice as well. The Ambaum (2020) formulation is very similar to the desired approach here, so we can close this.

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

Labels

Area: Calc Pertains to calculations Status: Team Discussion Development team needs to discuss issue to decide how to proceed Subarea: Thermo Pertains to thermodynamic calculations and their physical correctness Type: Enhancement Enhancement to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants