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

Scan mode issue when reading cfradial #1481

Closed
swnesbitt opened this issue Oct 27, 2023 · 3 comments · Fixed by #1484
Closed

Scan mode issue when reading cfradial #1481

swnesbitt opened this issue Oct 27, 2023 · 3 comments · Fixed by #1484
Labels
Bug Issue in the Code

Comments

@swnesbitt
Copy link
Collaborator

swnesbitt commented Oct 27, 2023

  • Py-ART version: 1.15.2
  • Python version: 3.11.4
  • Operating System: tested on MacOS and Linux

Description

Tried to open a cfradial 360 sweep file produced from RadxConvert (originally a DOW produced DORADE)

What I Did

Tried to produce a radar display, but it says can't deal with scan_mode of "other" in the radar object.

Looked at the cfradial file, and the sweep_mode is azimuth_surveillance which is legal according to cfradial conventions.

However, pyart.io.read is reading in sweep_mode from the cfradial as a masked array rather than a string.

 radar = pyart.io.read('/Users/snesbitt/data/DOW7-231005-cfrad/20231005/cfrad.20231005_153454.950_to_20231005_153512.742_DOW7high_SUR.nc')
radar.sweep_mode
{'long_name': 'scan_mode_for_sweep',
 'options': 'sector, coplane, rhi, vertical_pointing, idle, azimuth_surveillance, elevation_surveillance, sunscan, pointing, calibration, manual_ppi, manual_rhi, sunscan_rhi, doppler_beam_swinging, complex_trajectory, electronic_steering',
 'data': masked_array(data=[[b'a', b'z', b'i', b'm', b'u', b't', b'h', b'_', b's',
                     b'u', b'r', b'v', b'e', b'i', b'l', b'l', b'a', b'n',
                     b'c', b'e', --, --, --, --, --, --, --, --, --, --,
                     --, --]],
              mask=[[False, False, False, False, False, False, False,
                     False, False, False, False, False, False, False,
                     False, False, False, False, False, False,  True,
                      True,  True,  True,  True,  True,  True,  True,
                      True,  True,  True,  True]],
        fill_value=b'',
             dtype='|S1')}

This causes plotting routines to crash as it compares sweep_mode to a number of known strings, and upon failure of matching, sets scan_type (used in plotting routines) to "other".

@swnesbitt
Copy link
Collaborator Author

Manually setting radar.scan_type='ppi' as appropriate is a workaround.

@mgrover1 mgrover1 added the Bug Issue in the Code label Oct 31, 2023
@mgrover1
Copy link
Collaborator

@swnesbitt - can you share a sample file here? I can take a look at debugging here.

@mgrover1
Copy link
Collaborator

@swnesbitt - I think I found the culprit here. The byte-encoded string is being converted to a list... we should add a check on the dimensionality of the sweep mode array before grabbing the first element
https://github.com/ARM-DOE/pyart/blob/main/pyart/io/cfradial.py#L200

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issue in the Code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants