Skip to content

Commit

Permalink
MNT: Refactor montgomery_streamfunction
Browse files Browse the repository at this point in the history
Rewrite to forward on to dry_static_energy since they are identical
calculations. Also add references to each other in the docstrings.
  • Loading branch information
dopplershift committed Oct 31, 2020
1 parent 54129e6 commit 02e7494
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/metpy/calc/kinematics.py
Expand Up @@ -484,7 +484,6 @@ def ageostrophic_wind(height, u, v, dx=None, dy=None, latitude=None, x_dim=-1, y


@exporter.export
@preprocess_and_wrap(wrap_like='height', broadcast=('height', 'temperature'))
@check_units('[length]', '[temperature]')
def montgomery_streamfunction(height, temperature):
r"""Compute the Montgomery Streamfunction on isentropic surfaces.
Expand Down Expand Up @@ -519,10 +518,11 @@ def montgomery_streamfunction(height, temperature):
See Also
--------
get_isentropic_pressure
get_isentropic_pressure, dry_static_energy
"""
return (mpconsts.g * height) + (mpconsts.Cp_d * temperature)
from . import dry_static_energy
return dry_static_energy(height, temperature)


@exporter.export
Expand Down
4 changes: 4 additions & 0 deletions src/metpy/calc/thermo.py
Expand Up @@ -2358,6 +2358,10 @@ def dry_static_energy(height, temperature):
`pint.Quantity`
The dry static energy
See Also
--------
montgomery_streamfunction
"""
return (mpconsts.g * height + mpconsts.Cp_d * temperature).to('kJ/kg')

Expand Down

0 comments on commit 02e7494

Please sign in to comment.