Repository navigation
Conversation
The latent heat of melting is the latent heat of sublimation minus that of vaporization, so it changes with temperature as c_pl - c_pi, as the docstring already says (L_m = L_m0 + (c_pl - c_pi)(T - T0)). The code subtracted the term instead, so the value grew below freezing. Add it, update the docstring example and the test value at 233 K, and test that melting equals sublimation minus vaporization. Fixes Unidata#4182
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description Of Changes
water_latent_heat_meltingreturnedLf - (Cp_l - Cp_i) * (T - T0). Its own docstring (Ambaum 2020) givesL_m = L_m0 + (c_pl - c_pi)(T - T0), so the sign of the second term was inverted. As a result, the latent heat of melting grew below freezing instead of falling. The term is now added.As the issue points out,
L_mshould equalL_s - L_v. With MetPy's ownwater_latent_heat_sublimationandwater_latent_heat_vaporization,(Lv0 - (Cp_l - Cp_v)ΔT)subtracted from(Ls0 - (Cp_i - Cp_v)ΔT)givesLf + (Cp_l - Cp_i)ΔT.Value changes:
Checklist
test_water_latent_heat_melting_is_sublimation_minus_vaporizationchecks the result against sublimation minus vaporization at three temperatures.test_water_latent_heat_melting_decreases_below_freezingchecks that the value is belowLfat −15 °C. Both fail onmainand pass here.tests/calcpasses (650 passed). The calc doctests pass (81) with the CI pins fromci/requirements.txt. ruff, flake8 and codespell pass on the changed files.