openradar/xradar

StopIteration Error while reading in cfradial 1.4 radar data

syedhamidali opened this issue · 1 comments

  • xradar version: 0.4.0
  • Python version: 3.11.5
  • Operating System: macOS 13.4

Description

Unable to read in cfradial1.4 format data file

What I Did

dtree = xd.io.open_cfradial1_datatree(files[2])
---------------------------------------------------------------------------
StopIteration                             Traceback (most recent call last)
Cell In[61], line 1
----> 1 xd.io.open_cfradial1_datatree(files[2])

File ~/miniconda3/envs/radar-env/lib/python3.11/site-packages/xradar/io/backends/cfradial1.py:343, in open_cfradial1_datatree(filename_or_obj, **kwargs)
    340 DataTree(subgroup, name="radar_parameters", parent=dtree)
    342 # radar_calibration (connected with calib-dimension)
--> 343 calib = _get_radar_calibration(ds)
    344 if calib:
    345     DataTree(calib, name="radar_calibration", parent=dtree)

File ~/miniconda3/envs/radar-env/lib/python3.11/site-packages/xradar/io/backends/cfradial1.py:279, in _get_radar_calibration(ds)
    277 calib_vars = {}
    278 for name in subgroup.data_vars:
--> 279     item = next(
    280         filter(lambda x: x[0] in name, radar_calibration_subgroup.items())
    281     )
    282     item = item[1] if item[1] else item[0]
    283     calib_vars[name] = item

StopIteration: 

Dataset info

{'Conventions': 'CF-1.7',
 'Sub_conventions': 'CF-Radial instrument_parameters radar_parameters radar_calibration',
 'version': 'CF-Radial-1.4',
 'title': '',
 'institution': '',
 'references': '',
 'source': 'ARCHIVE 2 data',
 'history': '',
 'comment': '',
 'original_format': 'NEXRAD',
 'driver': 'RadxConvert(NCAR)',
 'created': '2022/07/26 08:57:19.152',
 'start_datetime': '2022-03-30T21:51:43Z',
 'time_coverage_start': '2022-03-30T21:51:43Z',
 'start_time': '2022-03-30 21:51:43.057',
 'end_datetime': '2022-03-30T21:57:59Z',
 'time_coverage_end': '2022-03-30T21:57:59Z',
 'end_time': '2022-03-30 21:57:59.750',
 'instrument_name': 'KGWX',
 'site_name': 'XWGK',
 'scan_name': 'Surveillance',
 'scan_id': 212,
 'platform_is_mobile': 'false',
 'n_gates_vary': 'false',
 'ray_times_increase': 'true'}

You can find the data here

@kmuehlbauer I think I managed this issue in this PR #132.