From 7142ee404df02eb8bb3f4a919091277d7a3104e1 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Sat, 2 Sep 2023 00:16:39 +0200 Subject: hacky fix for skewt --- skewt.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'skewt.py') diff --git a/skewt.py b/skewt.py index 0b8f4a7..702e649 100644 --- a/skewt.py +++ b/skewt.py @@ -61,9 +61,15 @@ class Skewt: self._skew.plot(self._p, parcel, 'y') self._skew.plot(lvl[0], lvl[1], 'o', markerfacecolor='red', linewidth=1) - cape, cin = mpcalc.cape_cin(self._p, self._T, self._Td, parcel) - - self.addInfo(f'CAPE {int(cape.magnitude)} $J/kg$ CIN {int(cin.magnitude)} $J/kg$') + # TODO why exception on cape_cin()? + # ValueError: zero-size array to reduction operation minimum which has no identity + # https://github.com/Unidata/MetPy/pull/3132 + try: + cape, cin = mpcalc.cape_cin(self._p, self._T, self._Td, parcel, which_el='top') + self.addInfo(f'CAPE {int(cape.magnitude)} $J/kg$ CIN {int(cin.magnitude)} $J/kg$') + except ValueError: + print('CAPE/CIN Failed with ValueError') + self.addInfo('CAPE #### CIN ####') if shade: self._skew.shade_cape(self._p,self._T,parcel) -- cgit v1.2.3