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

GempakSounding.snxarray fails to return list of soundings #3563

Open
wx4stg opened this issue Jul 14, 2024 · 1 comment
Open

GempakSounding.snxarray fails to return list of soundings #3563

wx4stg opened this issue Jul 14, 2024 · 1 comment
Labels
Type: Bug Something is not working like it should

Comments

@wx4stg
Copy link
Contributor

wx4stg commented Jul 14, 2024

What went wrong?

Reading this sounding file: https://github.com/wx4stg/LRC/blob/main/data/240713.ua
with GempakSounding and attempting to call snxarray() on it gives an error

Operating System

Linux

Version

1.6.2

Python Version

3.12

Code to Reproduce

from metpy.io import GempakSounding
gs = GempakSounding('240713.ua')
gs.snxarray()

Errors, Traceback, and Logs

Cell In[21], line 1
----> 1 gs.snxarray()

File ~/micromamba/envs/LRC/lib/python3.12/site-packages/metpy/io/gempak.py:2196, in GempakSounding.snxarray(self, station_id, station_number, date_time, state, country)
   2192     raise KeyError('No stations were matched with given parameters.')
   2194 sndno = [(s.DTNO, s.SNDNO) for s in matched]
-> 2196 data = self._unpack_merged(sndno) if self.merged else self._unpack_unmerged(sndno)
   2198 soundings = []
   2199 for snd in data:

File ~/micromamba/envs/LRC/lib/python3.12/site-packages/metpy/io/gempak.py:1554, in GempakSounding._unpack_unmerged(self, sndno)
   1549             for iprm, param in enumerate(parameters['name']):
   1550                 sounding[part.name][param] = (
   1551                     np.array(packed_buffer[iprm::nparms], dtype=np.float32)
   1552                 )
-> 1554     soundings.append(self._merge_sounding(sounding))
   1555 return soundings

File ~/micromamba/envs/LRC/lib/python3.12/site-packages/metpy/io/gempak.py:2066, in GempakSounding._merge_sounding(self, parts)
   2063     _interp_logp_pressure(merged, self.prod_desc.missing_float)
   2065 # Interpolate missing data
-> 2066 _interp_logp_data(merged, self.prod_desc.missing_float)
   2068 # Add below ground MAN data
   2069 if merged['PRES'][0] != self.prod_desc.missing_float and bgl > 0:

File ~/micromamba/envs/LRC/lib/python3.12/site-packages/metpy/io/gempak.py:241, in _interp_logp_data(sounding, missing)
    239         bdata[param] = val[iabove]
    240 vlev = sounding['PRES'][i]
--> 241 outdata = _interp_parameters(vlev, adata, bdata, missing)
    242 sounding[var1][i] = outdata[var1]
    243 if var2 is not None:

File ~/micromamba/envs/LRC/lib/python3.12/site-packages/metpy/io/gempak.py:458, in _interp_parameters(vlev, adata, bdata, missing)
    452 between = (((pres1 < pres2) and (pres1 < vlev)
    453            and (vlev < pres2))
    454            or ((pres2 < pres1) and (pres2 < vlev)
    455            and (vlev < pres1)))
    457 if not between:
--> 458     raise ValueError('Current pressure does not fall between levels.')
    459 elif pres1 <= 0 or pres2 <= 0:
    460     raise ValueError('Pressure cannot be negative.')

ValueError: Current pressure does not fall between levels.
@wx4stg wx4stg added the Type: Bug Something is not working like it should label Jul 14, 2024
@wx4stg
Copy link
Contributor Author

wx4stg commented Jul 14, 2024

I'll debug this later...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something is not working like it should
Projects
None yet
Development

No branches or pull requests

1 participant