diff --git a/pyart/map/grid_mapper.py b/pyart/map/grid_mapper.py index 5ccb75ac07..4800041c33 100644 --- a/pyart/map/grid_mapper.py +++ b/pyart/map/grid_mapper.py @@ -140,14 +140,14 @@ def grid_from_radars( origin_latitude["data"] = np.array([kwargs["grid_origin"][0]]) origin_longitude["data"] = np.array([kwargs["grid_origin"][1]]) else: - origin_latitude["data"] = first_radar.latitude["data"] - origin_longitude["data"] = first_radar.longitude["data"] + origin_latitude["data"] = first_radar.latitude["data"][:1] + origin_longitude["data"] = first_radar.longitude["data"][:1] origin_altitude = get_metadata("origin_altitude") if "grid_origin_alt" in kwargs: origin_altitude["data"] = np.array([kwargs["grid_origin_alt"]]) else: - origin_altitude["data"] = first_radar.altitude["data"] + origin_altitude["data"] = first_radar.altitude["data"][:1] # metadata dictionary metadata = dict(first_radar.metadata) diff --git a/tests/map/test_grid_mapper.py b/tests/map/test_grid_mapper.py index 50c5c041e9..7ed38a1238 100644 --- a/tests/map/test_grid_mapper.py +++ b/tests/map/test_grid_mapper.py @@ -210,6 +210,14 @@ def test_map_to_grid_errors(): ) +def test_grid_from_radars_dims(): + radar = pyart.testing.make_target_radar() + radar.latitude["data"] = np.append(radar.latitude["data"], 0) + grids = pyart.map.grid_from_radars(radar, **COMMON_MAP_TO_GRID_ARGS) + origin_latitude = grids.origin_latitude["data"] + assert_almost_equal(origin_latitude, radar.latitude["data"][:1]) + + def test_grid_from_radars_errors(): pytest.raises( ValueError,