Skip to content

Plotting mixing ratio on a sounding #2100

Answered by dopplershift
singhvasu1626 asked this question in Q&A
Discussion options

You must be logged in to vote

MetPy's skewT class always plots with temperatures. If all you have is mixing ratio, you have to convert to dewpoint first:

import matplotlib.pyplot as plt
import metpy.calc as mpcalc
from metpy.plots import SkewT

sh = mpcalc.specific_humidity_from_mixing_ratio(mr)
dewp = mpcalc.dewpoint_from_specific_humidity(press, temp, sh)

fig = plt.figure()
skew = SkewT(fig)

# Plot temperature
skew.plot(press, temp)

# Plot moisture using the dewpoint calculated from mixing ratio
skew.plot(press, dewp)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dopplershift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2095 on September 13, 2021 15:54.