Skip to content

FIX: convert each Py-ART Grid only once in get_dd_wind_field - #172

Open
Wahaj18 wants to merge 1 commit into
openradar:mainfrom
Wahaj18:fix-167-pyart-grid-list
Open

Wahaj18 wants to merge 1 commit into
openradar:mainfrom
Wahaj18:fix-167-pyart-grid-list

Conversation

@Wahaj18

@Wahaj18 Wahaj18 commented Oct 11, 2026

Copy link
Copy Markdown

Closes #167

get_dd_wind_field converted a list of Py-ART Grids inside a redundant outer loop:

for x in Grids:
    new_grids = [read_from_pyart_grid(x) for x in Grids]

so every grid went through read_from_pyart_grid once per grid in the list. That conversion pops data from the Grid's radar_latitude/radar_longitude/radar_altitude dicts, so the second pass over the first grid fails with KeyError: 'data'. In practice, passing two or more Py-ART Grids straight to get_dd_wind_field always failed. Lists of xarray Datasets and a single Py-ART Grid were not affected.

This PR drops the outer loop so each grid is converted once.

Testing: added test_list_of_pyart_grids, which passes two Py-ART test grids to get_dd_wind_field. It fails on main with KeyError: 'data' and passes with this change. The rest of test_cost_functions.py, test_initialization.py and test_retrieval.py passes locally on the SciPy engine (Jax/TensorFlow tests skipped). I left out test_get_iem_data (network) and test_twpice_case_parallel (dask), and the two HRRR tests fail only because cfgrib isn't installed in my environment. ruff and black are clean on the changed files.

A list of Py-ART Grids was converted inside a redundant outer loop, so
every grid went through read_from_pyart_grid once per grid in the list.
The conversion pops the radar location data from the Grid, so the second
pass raised KeyError: 'data' for any list of two or more Py-ART Grids.

Closes openradar#167

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug in get_dd_wind_field

1 participant