Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Stüve, Emagram plots #3626

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

cdholmes
Copy link

@cdholmes cdholmes commented Sep 9, 2024

This PR enables Stüve and Emagram plots, which are themodynamic diagrams like SkewT.

Description Of Changes

Two new classes, named Stuve and Emagram, are constructed as child classes of the SkewT parent class. They create Stüve diagrams and Emagrams, respectively. As child classes, they inherit plotting capabilities from SkewT (e.g. data, wind barbs, dry and saturated adiabats, and mixing ratio lines).

I confirmed that Advanced Sounding example works with the new Stuve and and Emagram classes as drop-in replacements for SkewT.

This Closes #837 and addresses the Stuve request in #418.

Checklist

  • [ x] Closes Add Stüve Plot #837
  • Tests added. The tests/plots/test_skewt.py could be repeated for Stuve and Emagram, but this has not been done.
  • [ x] Fully documented

Stüve and Emagram plots are enabled as child classes of SkewT parent class.
The child classes inherit plotting capabilities from SkewT (e.g. data, wind barbs, dry and saturated adiabats, and mixing ratio lines).
@cdholmes cdholmes requested a review from a team as a code owner September 9, 2024 19:41
@cdholmes cdholmes requested review from dopplershift and removed request for a team September 9, 2024 19:41
@dcamron
Copy link
Member

dcamron commented Sep 9, 2024

Thanks for the PR, and congrats on your first contribution here! This is super helpful stuff. We can start to review the implementation in the coming days/weeks. We will need new tests for these classes, do let us know if that's a pain point for you.

Also, if it's helpful, most of our linting headaches can be automatically fixed or made known before committing by following the Code Style steps within the MetPy dev guide!

New test files
tests/plots/test_emagram.py
tests/plots/test_stuve.py
replicate the SkewT tests done in
tests/plots/test_skewt.py

Whitespace changes for linter.

Signed-off-by: Christopher Holmes <cdholmes@fsu.edu>
tests/plots/test_emagram.py Fixed Show fixed Hide fixed
tests/plots/test_emagram.py Fixed Show fixed Hide fixed
tests/plots/test_stuve.py Fixed Show fixed Hide fixed
tests/plots/test_stuve.py Fixed Show fixed Hide fixed
@cdholmes
Copy link
Author

@dcamron, I added pytest files for the new classes. The CI tests pass on many platforms and Python versions, but not all. The failed test artifacts that I checked showed a couple single-pixel shifts, nothing a user would ever notice. From a user perspective, all of the test results look fine to me. This is the limit of what I can provide, so I hope that someone else more familiar with pytest --mpl can look at this or relax the test failure thresholds.

I created the baseline images with Python 3.12.5, Matplotlib 3.9.2, and latest MetPy (with modifications) on MacOS.

@cdholmes
Copy link
Author

Here is an example of a test result that was classified as a failure, but looks fine to me. This is Conda Tests / macOS 3.10.

Baseline:
baseline
Result:
result
Difference:
result-failed-diff

After creating a clean environment, a few pixels
changedin the baseline images for some of the
tests. This might fix some of the failing CI tests.

Signed-off-by: Christopher Holmes <cdholmes@fsu.edu>
@dopplershift
Copy link
Member

Yeah, that kind of failure is something where I double check the uploaded test image, and then just set the threshold to something slightly above the failure RMS, which should then have the test pass. If you're not up to doing that, we'll be happy to make those updates.

@cdholmes
Copy link
Author

I am not familiar with how to change pytest failure thresholds. I would appreciate if you could do that. Thanks

Images that failed pytest thresholds had only a few
pixels of difference, which is fine for users.

Signed-off-by: Christopher Holmes <cdholmes@fsu.edu>
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.

Add Stüve Plot
3 participants