Skip to content

Conversation

@blue-jaye-121
Copy link
Contributor

@blue-jaye-121 blue-jaye-121 commented Jun 20, 2025

Description Of Changes

Added new argument to metpy.plot.SkewT function for an optional secondary y-axis of height calculated from metpy.calc.pressure_to_height_std(). Defaults to 'False'; axis can be accessed as a matplotlib axis using 'heightax'.

Checklist

@CLAassistant
Copy link

CLAassistant commented Jun 20, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ blue-jaye-121
❌ Jaye Norman


Jaye Norman seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Comment on lines 266 to 267
def __init__(self, fig=None, rotation=30, subplot=None, rect=None,
aspect=80.5, show_heights=False):
Copy link
Member

Choose a reason for hiding this comment

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

How would you feel about this interface,

skew = metpy.calc.SkewT(show_heights=True)

vs

skew = metpy.calc.SkewT()
skew.heightax()
# or
skew.add_heightax()
# or
skew.add_height_scale()

etc etc etc., or something like that? To me, a height axis almost exactly straddles the line of "plot config" vs "physical parameter", so I'm torn, personally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dopplershift Mentioned on the original issue:

I'd really like to have it separated from the plotting call
In an ideal world, it'd be dynamically updated from the y-axis in pressure coords. I'm not sure if a
matplotlib spine is enough, or if maybe we do need the separate Axes, but we use matplotlib's event
handling to update the range on the height scale

Which to me points to a separate method like add_heightax(). I originally interpreted the issue this way because a height axis feels a bit more like a "plot config" but in theory it shouldn't be hard to switch it around; the issue will be making sure it can dynamically update. I'll bake this up (maybe in a separate branch for now) and see what it entails

Aspect ratio (i.e. ratio of y-scale to x-scale) to maintain in the plot.
Defaults to 80.5. Passing the string ``'auto'`` tells matplotlib to handle
the aspect ratio automatically (this is not recommended for SkewT).
show_heights : boolean, optional
Copy link
Member

@dcamron dcamron Jun 21, 2025

Choose a reason for hiding this comment

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

Suggested change
show_heights : boolean, optional
show_heights : bool, optional

if we keep this interface, this should fix the doc builds yelling at you!

@blue-jaye-121
Copy link
Contributor Author

I reverted the skewT file to the best functioning version that I had. This works beautifully - unless you add a ylim that is greater than 1013.25 hPa. Then because the secondary axis uses the same log scale as a primary axis, it doesn't work and won't reset the limits. Here's a couple examples:

  1. Works great with set_ylim(1000, 100)
image 2. Works great with set_ylim(1000, 400) image 3. Does not work with set_ylim(2000, 100) - it keeps the limits the same as the default image

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.

Height scale for SkewT

3 participants