diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2023-09-02 00:16:39 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2023-09-02 00:16:39 +0200 |
commit | 7142ee404df02eb8bb3f4a919091277d7a3104e1 (patch) | |
tree | b106c75c5169dd94f9a35c40427a1f9d67dd6883 | |
parent | 983b1225a5504c271be3e10d5da5675fdcaf2cf4 (diff) | |
download | meteo_toolbox-7142ee404df02eb8bb3f4a919091277d7a3104e1.tar.gz |
hacky fix for skewt
-rw-r--r-- | skewt.py | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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) |