MetPy icon indicating copy to clipboard operation
MetPy copied to clipboard

Add Weisman-Klemp analytical sounding function

Open aschueth opened this issue 4 years ago • 2 comments

As the title suggests, I added the Weisman-Klemp analytical sounding function to calc/indices.py.

  • [x] Closes #1342
  • [ ] Tests added

aschueth avatar Jan 28 '21 02:01 aschueth

The way I wrote this function has all the parameters as keyword arguments, and doesn't accept any normal arguments. The lack of normal arguments makes it a strange type of function. Is the formatting of the keyword arguments (as is) acceptable, or is there a better way to do it? Another option is to remove the keyword arguments and make it a static function, but in my opinion, it severely limits the flexibility of the function.

I am also unsure how to go about testing this since it is not a simple I/O function. Preliminarily, I was thinking of calculating CAPE, LCL, LFC, EL, and/or other parameters and comparing them to known values from this thermodynamic sounding. However, that would require the test function to use metpy calc functions which is somewhat recursive and might not be favorable?

aschueth avatar Jan 28 '21 07:01 aschueth

@aschueth Thanks for coming back around to this and apologies on the delayed response.

  1. Actually, you can pass normal arguments, it's just that all arguments have defaults, so to pass by order you have to override all the others. I think the current interface is fine.
  2. Tests for this function per-se aren't probably precisely needed. I mean, if you have a reference for what the values at say 500 hPa or 850 hPa are, you could do that as a sanity check.
  3. More interesting is to use this function in tests for some of our other calculations. That would literally be the same test as you outlined above, but it would be testing our calculation functions, rather than necessarily the analytical sounding. Which I think very much has some value.

dopplershift avatar Mar 13 '21 00:03 dopplershift