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 Complex Sounding Layout Example #3161

Merged
merged 11 commits into from
Sep 6, 2023
Merged

Add Complex Sounding Layout Example #3161

merged 11 commits into from
Sep 6, 2023

Conversation

kylejgillett
Copy link
Contributor

Description Of Changes

Adds a more advanced Skew-T layout example to examples\. Closes issue #2460. Uses the existing Advanced_Sounding.py example to build into a more complex plot. The same imports needed for the aforementioned existing example are used in this new example. Some simple adjustments and additions, mostly through Matplotlib manipulation, help improve the readability and complexity of the base MetPy functionality.

This example produces this plot from MetPy test data:

newmetpyexample

Checklist

@kylejgillett kylejgillett requested a review from a team as a code owner August 21, 2023 02:07
@kylejgillett kylejgillett requested review from dcamron and removed request for a team August 21, 2023 02:07
@CLAassistant
Copy link

CLAassistant commented Aug 21, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@kgoebber kgoebber left a comment

Choose a reason for hiding this comment

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

Thanks for the addition, @kylejgillett! Just a few things to clean up and I love that the example uses so many of the sounding calculations and of course the layout structure is great!

examples/Complex-Sounding-Plot.py Outdated Show resolved Hide resolved
examples/Complex-Sounding-Plot.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@kgoebber kgoebber left a comment

Choose a reason for hiding this comment

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

All looks good to me. @dcamron any other feedback?

@dopplershift dopplershift added this to the September 2023 milestone Aug 30, 2023
@kgoebber kgoebber merged commit c0826bc into Unidata:main Sep 6, 2023
25 checks passed
@kylejgillett
Copy link
Contributor Author

Hey guys,

I just check out this example under the dev release and it is showing up kinda wonky.

https://unidata.github.io/MetPy/dev/examples/Complex-Sounding-Plot.html

I think this may be due to the use of the these lines:

###########################################

A few of them need to be removed. Should a fix this with a new commit?

@kgoebber
Copy link
Collaborator

kgoebber commented Sep 16, 2023 via email

@kylejgillett
Copy link
Contributor Author

kylejgillett commented Sep 16, 2023

Hey @kgoebber,

I may have recreated the plotting issue you found. Is this what you saw?

soundingfig

I could only recreate this when using plt.savefig(), and not with plt.show(). Using plt.show() in a Jupyter Notebook creates the correct-sized plot for me on my machine. However, I corrected this issue with plt.savefig() by adding the bbox_inches='tight' kwarg. That created this:

soundingfig2

Could it be some sort of issue with the plt.figtext() and the way I am calling new axes (ex: plt.axes((0.43, 0.40, 0.5, 0.5))), that may appear differently on varying machines due to different aspect ratios/resolutions or something along those lines? I can't seem to find any other discussion on an issue like this.

How would you feel about just including the plt.savefig('filename', bbox_inches='tight') instead of plt.show()?

@kgoebber
Copy link
Collaborator

Interesting. I don't think we want to introduce a plt.savefig() here. I've been attempting to run down a few things, most of which did not bear fruit. However, if in setting up the skew axes and setting the rect anchor point (left, bottom) to 0.05, 0.05 instead of 0.0, 0.0 and amending all of the plt.figtext() calls to add 0.05 to both the x and y positions, then the figure appears with the axes in the documentation (with still a bit of extra white space on the right side of the figure). The hodograph would also need to be reposted by adding 0.05 to both the left, bottom values. If those changes are made, how does the output from a Jupyter Notebook look?

@kylejgillett
Copy link
Contributor Author

kylejgillett commented Sep 17, 2023

Making those changes did not change how the plot looks in the Notebook, so that's good.

soundingfig3

@kgoebber
Copy link
Collaborator

@kylejgillett are you planning on pushing a new PR to make the corrections? If not, just let me know and I can do that.

@kylejgillett
Copy link
Contributor Author

Hey @kgoebber, I created a new pull request with the updated code.

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.

Improve SkewT layout examples
4 participants