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

NEXRADLevel2 Reader Error for Older Files #256

Open
TCAlert opened this issue Jan 3, 2025 · 0 comments
Open

NEXRADLevel2 Reader Error for Older Files #256

TCAlert opened this issue Jan 3, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@TCAlert
Copy link

TCAlert commented Jan 3, 2025

  • xradar version: 0.8.0
  • Python version: 3.12.2
  • Operating System: Windows 11

Description

I was loading in some radar data from KLIX on 8/28/2005 at 1800z using the NEXRADLevel2 engine for xarray that xradar provides and ran into this error. Seems to only happen with the pre-super resolution radars -- I haven't encountered any issues with the modern sites.

What I Did

data = xr.open_dataset(r"C:\Users\deela\Downloads\radar" + f + ".gz", engine = 'nexradlevel2', group = f'sweep_{str(g).zfill(2)}')

Traceback

Traceback (most recent call last):
  File "C:\Users\deela\.anaconda\cyclobot\getRadar.py", line 155, in <module>
    print(getPastData('klix', '2005', '08', '28', '1800'))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\deela\.anaconda\cyclobot\getRadar.py", line 139, in getPastData
    data = xr.open_dataset(r"C:\Users\deela\Downloads\radar" + f + ".gz", engine = 'nexradlevel2', group = f'sweep_{str(g).zfill(2)}')
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\deela\anaconda3\envs\Env2272024\Lib\site-packages\xarray\backends\api.py", line 670, in open_dataset
    backend_ds = backend.open_dataset(
                 ^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\deela\anaconda3\envs\Env2272024\Lib\site-packages\xradar\io\backends\nexrad_level2.py", line 1447, in open_dataset
    ds = store_entrypoint.open_dataset(
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\deela\anaconda3\envs\Env2272024\Lib\site-packages\xarray\backends\store.py", line 44, in open_dataset
    vars, attrs = filename_or_obj.load()
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\deela\anaconda3\envs\Env2272024\Lib\site-packages\xarray\backends\common.py", line 305, in load
    (_decode_variable_name(k), v) for k, v in self.get_variables().items()
                                              ^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\deela\anaconda3\envs\Env2272024\Lib\site-packages\xradar\io\backends\nexrad_level2.py", line 1401, in get_variables
    for k, v in self.ds["sweep_data"].items()
                ^^^^^^^
  File "c:\Users\deela\anaconda3\envs\Env2272024\Lib\site-packages\xradar\io\backends\nexrad_level2.py", line 1321, in ds
    return self._acquire()
           ^^^^^^^^^^^^^^^
  File "c:\Users\deela\anaconda3\envs\Env2272024\Lib\site-packages\xradar\io\backends\nexrad_level2.py", line 1315, in _acquire
    root.get_sweep(self._group)
  File "c:\Users\deela\anaconda3\envs\Env2272024\Lib\site-packages\xradar\io\backends\nexrad_level2.py", line 490, in get_sweep
    moments = self.msg_31_data_header[sweep_number]["msg_31_data_header"].keys()
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\deela\anaconda3\envs\Env2272024\Lib\site-packages\xradar\io\backends\nexrad_level2.py", line 465, in msg_31_data_header
    ) = self.get_data_header()
        ^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\deela\anaconda3\envs\Env2272024\Lib\site-packages\xradar\io\backends\nexrad_level2.py", line 627, in get_data_header
    while self.init_next_record():
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\deela\anaconda3\envs\Env2272024\Lib\site-packages\xradar\io\backends\nexrad_level2.py", line 364, in init_next_record
    return self.init_record(self.record_number + 1)
                            ~~~~~~~~~~~~~~~~~~~^~~
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

@syedhamidali syedhamidali added the bug Something isn't working label Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants