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

Adding Showalter Index to Thermo Functions #1673

Merged
merged 14 commits into from
Jun 23, 2021

Conversation

michaelavs
Copy link
Contributor

@michaelavs michaelavs commented Jan 27, 2021

Description Of Changes

Adding a function to calculate the Showalter Index. Currently an individual file in the directory for testing purposes but will eventually be added to the "thermo.py" file when ready for approval/merging. Tested using dataset available in the GeoCAT-datafiles library and then by hand using guidelines for the function described by Galway on the visualization of the dataset in the GeoCAT-examples gallery.

Checklist

@CLAassistant
Copy link

CLAassistant commented Jan 27, 2021

CLA assistant check
All committers have signed the CLA.

@lgtm-com
Copy link

lgtm-com bot commented Jan 27, 2021

This pull request introduces 2 alerts when merging fc559c4 into 9ed0829 - view on LGTM.com

new alerts:

  • 1 for Unused local variable
  • 1 for Unused import

@dopplershift
Copy link
Member

Thanks for the contribution @michaelavs ! Before delving into the details of the implementation, I have a design question. Right now the function is:

def showalter_index(pressure, temperature, lcl850, t500):

This requires the users to manually calculate the LCL from 850 hPa as well as pull out the environmental temperature. From your perspective as a user, would it be simpler to use to allow the user to only pass in the profile pressure and temperature and have the function do everything else:

def showalter_index(pressure, temperature):

? Or would that miss some use cases?

@michaelavs
Copy link
Contributor Author

Thanks for the contribution @michaelavs ! Before delving into the details of the implementation, I have a design question. Right now the function is:

def showalter_index(pressure, temperature, lcl850, t500):

This requires the users to manually calculate the LCL from 850 hPa as well as pull out the environmental temperature. From your perspective as a user, would it be simpler to use to allow the user to only pass in the profile pressure and temperature and have the function do everything else:

def showalter_index(pressure, temperature):

? Or would that miss some use cases?

I don't see a reason to not narrow down the function to pass only profile pressure and temperature! I will be pushing a newer version here shortly with that change!

@lgtm-com
Copy link

lgtm-com bot commented Jan 27, 2021

This pull request introduces 1 alert when merging 3e39f67 into 3adfbd8 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

Base automatically changed from master to main February 22, 2021 22:39
@lgtm-com
Copy link

lgtm-com bot commented Feb 22, 2021

This pull request introduces 1 alert when merging 3e39f67 into 1aaf805 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Mar 2, 2021

This pull request introduces 1 alert when merging cb5619e into 90e92c8 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Mar 2, 2021

This pull request introduces 1 alert when merging 9a21918 into 90e92c8 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Mar 2, 2021

This pull request introduces 1 alert when merging ea3c914 into 90e92c8 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

Copy link
Member

@dopplershift dopplershift 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 contribution! This is generally in pretty good, and thanks for including a test. I have a few comments to make things fit pep8 style better, plus a few clean-ups. Also, there are apparently some "blank" lines that have spaces--those seem to be angering the style checker.

tests/calc/test_thermo.py Show resolved Hide resolved
src/metpy/calc/thermo.py Show resolved Hide resolved
src/metpy/calc/thermo.py Show resolved Hide resolved
src/metpy/calc/thermo.py Outdated Show resolved Hide resolved
src/metpy/calc/thermo.py Outdated Show resolved Hide resolved
src/metpy/calc/thermo.py Outdated Show resolved Hide resolved
src/metpy/calc/thermo.py Show resolved Hide resolved
src/metpy/calc/thermo.py Outdated Show resolved Hide resolved
src/metpy/calc/thermo.py Outdated Show resolved Hide resolved
@dopplershift dopplershift added Area: Calc Pertains to calculations Type: Feature New functionality labels May 14, 2021
@dopplershift dopplershift added this to the 1.1.0 milestone May 14, 2021
@michaelavs
Copy link
Contributor Author

@dopplershift
I went through and made the changes you requested. I believe all of the checks have passed that can pass without maintainer approval. In the mean time, I'll re-request your review on this one for when you are able to go over the changes again!

@michaelavs michaelavs requested a review from dopplershift May 20, 2021 14:14
Copy link
Member

@dopplershift dopplershift left a comment

Choose a reason for hiding this comment

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

I can't believe it's been 4 weeks--time flies! This is looking good! Just a few things the style checker is complaining about. Also, can you add showalter_index to our list of functions in docs/_templates/overrides/metpy.calc.rst under "Soundings"? That way it will show up in the right table in our docs.

Thanks for working on this!

src/metpy/calc/thermo.py Show resolved Hide resolved
src/metpy/calc/thermo.py Outdated Show resolved Hide resolved
src/metpy/calc/thermo.py Outdated Show resolved Hide resolved
src/metpy/calc/thermo.py Outdated Show resolved Hide resolved
Copy link
Member

@dopplershift dopplershift left a comment

Choose a reason for hiding this comment

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

This is looking really good, thanks for sticking with us. One last thing: we have, internally MetPy banned the syntax like a * units.hPa because with arrays it can lead to hidden bugs when using masked arrays.

So while what you had wasn't in any way wrong, can you update to what I suggested to make the checker happy?

src/metpy/calc/thermo.py Outdated Show resolved Hide resolved
src/metpy/calc/thermo.py Outdated Show resolved Hide resolved
src/metpy/calc/thermo.py Outdated Show resolved Hide resolved
src/metpy/calc/thermo.py Outdated Show resolved Hide resolved
Copy link
Member

@dopplershift dopplershift left a comment

Choose a reason for hiding this comment

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

🎉 Just need the bots to pass and this will be in!

@dopplershift dopplershift enabled auto-merge (squash) June 23, 2021 19:17
@dopplershift dopplershift merged commit d3f8a83 into Unidata:main Jun 23, 2021
@dopplershift
Copy link
Member

Congrats on your first contribution to MetPy @michaelavs !

@michaelavs michaelavs deleted the showalter branch June 23, 2021 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Calc Pertains to calculations Type: Feature New functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Showalter and Modified Showalter Index
3 participants