kylejgillett / sounderpy

A python package that helps you to access and plot vertical profile data for meteorological analysis
https://kylejgillett.github.io/sounderpy/
MIT License
47 stars 12 forks source link

Improve Sounding Plot Functions #3

Closed ethankerrwx closed 10 months ago

ethankerrwx commented 11 months ago

I first want to say that I have very limited experience working with packages. I've only used python for statisitcs/data analysis before, so I've only ever intalled pandas, numpy, seaborn, etc, and called it a day. However, sounderpy looks awesome so I'm trying to install it.

When installing sounderpy, this error message appears:

ERROR: Could not find a version that satisfies the requirement sounderpy ERROR: No matching distribution found for sounderpy

I don't know if this is something trivial or not, but I couldn't really find any online help of where to go from here.

Thanks!

kylejgillett commented 11 months ago

Thanks for reaching out! Glad you would like to use SounderPy.

Do you know what version of Python you have? SounderPy requires Python 3.10 or greater.

ethankerrwx commented 11 months ago

Hmmm, that could have been the problem. It’s been a while since I ran up Python on my computer so I’ll have to check it out. Thanks!

On Thu, Jul 20, 2023 at 11:32 PM Kyle J Gillett @.***> wrote:

Thanks for reaching out! Glad you would like to use SounderPy.

Do you know what version of Python you have? SounderPy requires Python 3.10 or greater.

— Reply to this email directly, view it on GitHub https://github.com/kylejgillett/sounderpy/issues/3#issuecomment-1644935891, or unsubscribe https://github.com/notifications/unsubscribe-auth/BBMN2SLTTFA5E5JPSTICN6DXRHZ6FANCNFSM6AAAAAA2Q3BJ3Y . You are receiving this because you authored the thread.Message ID: @.***>

kylejgillett commented 11 months ago

Awesome, let me know if that works!

ethankerrwx commented 11 months ago

Good evening,

Apologies for taking so long to respond. I just got back to trying this again, and this time it worked! When I previously tried, I did it on a Jupyter Notebook and ran into trouble. I've been switching my Python operations over to PyCharm and installing it there was a piece of cake! When I generate a sounding, some of the wording and information seems more cluttered than it should be and overlaps. How would I fix that?

Thanks, Ethan Kerr [image: image.png]

On Sun, Jul 23, 2023 at 10:05 AM Kyle J Gillett @.***> wrote:

Awesome, let me know if that works!

— Reply to this email directly, view it on GitHub https://github.com/kylejgillett/sounderpy/issues/3#issuecomment-1646848661, or unsubscribe https://github.com/notifications/unsubscribe-auth/BBMN2SJVB5L2P67SBELGYX3XRUVQ7ANCNFSM6AAAAAA2Q3BJ3Y . You are receiving this because you authored the thread.Message ID: @.***>

kylejgillett commented 11 months ago

Glad you got it working!

As to the plot titles: yes that is something I have realized to be a bit of an issue with specific models; that not everything fits in the title line like it should. The fix in that regard lies within the source code. One option you may consider is creating a plot yourself using MetPy's plotting functions examples. I am working on a new MetPy sounding plot example that can be found here: https://github.com/Unidata/MetPy/issues/2460#issuecomment-1661174128.

You should be able to rather easily convert this example into one that works with SounderPy data. For example, this section of code in the MetPy example that gets observed data:

col_names = ['pressure', 'height', 'temperature', 'dewpoint', 'direction', 'speed']

df = pd.read_fwf(get_test_data('may4_sounding.txt', as_file_obj=False),
                 skiprows=5, usecols=[0, 1, 2, 3, 6, 7], names=col_names)

# Drop any rows with all NaN values for T, Td, winds
df = df.dropna(subset=('temperature', 'dewpoint', 'direction', 'speed'
                       ), how='all').reset_index(drop=True)

p = df['pressure'].values * units.hPa
T = df['temperature'].values * units.degC
Td = df['dewpoint'].values * units.degC
wind_speed = df['speed'].values * units.knots
wind_dir = df['direction'].values * units.degrees
u, v = mpcalc.wind_components(wind_speed, wind_dir)

could be converted too:

clean_data = spy.get_bufkit_data('HRRR', 'KMOP', 0)

p = clean_data['p']
T = clean_data['T']
Td = clean_data['Td']
u = clean_data['u']
v  = clean_data['v']

then, after applying the actual plot code that I provide in that MetPy issue, you could make something like this:

My eventual plan is to implement a more advanced plot much like the one below into SounderPy. Hopefully that is soon!

255392709-a56a2fdb-dd10-4513-aaf9-9fdc204369b0

ethankerrwx commented 11 months ago

Alright, that sounds easy enough. Thank you!

On Thu, Aug 10, 2023 at 2:37 PM Kyle J Gillett @.***> wrote:

Glad you got it working!

As to the plot titles: yes that is something I have realized to be a bit of an issue with specific models; that not everything fits in the title line like it should. The fix in that regard lies within the source code. One option you may consider is creating a plot yourself using MetPy's plotting functions examples. I am working on a new MetPy sounding plot example that can be found here: Unidata/MetPy#2460 (comment) https://github.com/Unidata/MetPy/issues/2460#issuecomment-1661174128.

You should be able to rather easily convert this example into one that works with SounderPy data. For example, this section of code in the MetPy example that gets observed data:

col_names = ['pressure', 'height', 'temperature', 'dewpoint', 'direction', 'speed']

df = pd.read_fwf(get_test_data('may4_sounding.txt', as_file_obj=False), skiprows=5, usecols=[0, 1, 2, 3, 6, 7], names=col_names)

Drop any rows with all NaN values for T, Td, winds

df = df.dropna(subset=('temperature', 'dewpoint', 'direction', 'speed' ), how='all').reset_index(drop=True)

p = df['pressure'].values units.hPa T = df['temperature'].values units.degC Td = df['dewpoint'].values units.degC wind_speed = df['speed'].values units.knots wind_dir = df['direction'].values * units.degrees u, v = mpcalc.wind_components(wind_speed, wind_dir)

could be converted too:

clean_data = spy.get_bufkit_data('HRRR', 'KMOP', 0)

p = clean_data['p'] T = clean_data['T'] Td = clean_data['Td'] u = clean_data['u'] v = clean_data['v']

then, after applying the actual plot code that I provide in that MetPy issue, you could make something like this:

My eventual plan is to implement a more advanced plot much like the one below into SounderPy. Hopefully that is soon!

[image: 255392709-a56a2fdb-dd10-4513-aaf9-9fdc204369b0] https://user-images.githubusercontent.com/100786530/259839012-f948513f-7176-4d36-8aa9-c8399c7983a5.png

— Reply to this email directly, view it on GitHub https://github.com/kylejgillett/sounderpy/issues/3#issuecomment-1673719395, or unsubscribe https://github.com/notifications/unsubscribe-auth/BBMN2SJMUK2NFUNMO3337HDXUUS6LANCNFSM6AAAAAA2Q3BJ3Y . You are receiving this because you authored the thread.Message ID: @.***>

kylejgillett commented 10 months ago

Improved plotting functions for both the Skew-T and hodograph have been developed and will be implemented into the next release of SounderPy.

Here is an example of the new plot: NEW-HODO-EXAMPLE

NEW-SKEW-EXAMPLE

ethankerrwx commented 8 months ago

Good evening,

I've been using Sounderpy lately, and I'm getting a better hang of things. I love how easy and quick it is to make a sounding. My only issue is that I still can't figure out for the life of me how to prevent all the text from being jumbled up. Any suggestions?

Thanks, Ethan Kerr

image

ethankerrwx commented 8 months ago

Hold up, I literally just came across a tweet that answered my question. That's kind of crazy. Thanks for answering my question via some random tweet!

kylejgillett commented 8 months ago

hey @ethankerrwx !

Thanks again for using SounderPy -- I love that so many folks are finding it useful!

I am glad you came across that tweet haha! It turns out that displaying the plot inline can cause some formatting issues on smaller screens.

In case anyone comes across this in the future, the fix for this issue will be saving the plot to a file -- then the dimensions and formatting will be correct.

use the method='save' kwarg:

metpy_sounding(clean_data, method='save', filename="some_filename")