-
Notifications
You must be signed in to change notification settings - Fork 416
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
Return input temperature units for LCL/LFC/EL temperature, disallow LFC if EL below LCL #1172
Conversation
44b60c0
to
3219614
Compare
these changes have caused the following error when calculating CAPE as mentioned in #1167: Traceback (most recent call last):
File "/nerc/n02/n02/amethyst/minic/envs/newenv/lib/python3.6/site-packages/sharedmem/sharedmem.py", line 294, in _slaveMain
self.main(self, *self.args)
File "/nerc/n02/n02/amethyst/minic/envs/newenv/lib/python3.6/site-packages/sharedmem/sharedmem.py", line 628, in _main
r = realfunc(work)
File "/nerc/n02/n02/amethyst/minic/envs/newenv/lib/python3.6/site-packages/sharedmem/sharedmem.py", line 703, in realfunc
else: return func(i)
File "/var/spool/torque/mom_priv/jobs/255664.rdf-xcat.SC", line 69, in cape_func
cape, cin = most_unstable_cape_cin(vl_lst, prof_t, prof_td) # muCAPE calculation
File "/nerc/n02/n02/amethyst/minic/envs/newenv/lib/python3.6/site-packages/metpy/xarray.py", line 487, in wrapper
return func(*args, **kwargs)
File "/nerc/n02/n02/amethyst/minic/envs/newenv/lib/python3.6/site-packages/metpy/units.py", line 312, in wrapper
return func(*args, **kwargs)
File "/nerc/n02/n02/amethyst/minic/envs/newenv/lib/python3.6/site-packages/metpy/calc/thermo.py", line 1797, in most_unstable_cape_cin
return cape_cin(p, t, td, mu_profile)
File "/nerc/n02/n02/amethyst/minic/envs/newenv/lib/python3.6/site-packages/metpy/xarray.py", line 487, in wrapper
return func(*args, **kwargs)
File "/nerc/n02/n02/amethyst/minic/envs/newenv/lib/python3.6/site-packages/metpy/units.py", line 312, in wrapper
return func(*args, **kwargs)
File "/nerc/n02/n02/amethyst/minic/envs/newenv/lib/python3.6/site-packages/metpy/calc/thermo.py", line 1431, in cape_cin
parcel_temperature_profile=parcel_profile)
File "/nerc/n02/n02/amethyst/minic/envs/newenv/lib/python3.6/site-packages/metpy/xarray.py", line 487, in wrapper
return func(*args, **kwargs)
File "/nerc/n02/n02/amethyst/minic/envs/newenv/lib/python3.6/site-packages/metpy/units.py", line 312, in wrapper
return func(*args, **kwargs)
File "/nerc/n02/n02/amethyst/minic/envs/newenv/lib/python3.6/site-packages/metpy/calc/thermo.py", line 451, in lfc
if el_pres > this_lcl[0]:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()" |
Ah, thanks for checking that. I'll go back and fix the code to only check one value there. |
3219614
to
41c0cfc
Compare
Disallow LFC when it and EL both occur below LCL.
41c0cfc
to
60ca790
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. LFC logic is getting a bit unwieldy, but at least we have a good test suite for some day refactoring it.
Ignoring Code Climate.
Description Of Changes
First, allows for return of LCL/LFC/EL temperature in the units of the input temperature. There may still be a bug in
SkewT.plot
that I need to investigate more, as I don't think things are getting auto-converted to the same units when you plot multiple things.Second, this disallows a LFC below a LCL when an "EL" is also below the LCL. This bug was causing CAPE to calculate as the LFC was being adjusted to the LCL, and it didn't see an end to the profile (ending up in very large values of negative CAPE).
Checklist