Skip to content

Commit

Permalink
FIX: Fix dimensions for grid origin (#1574)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrover1 authored May 1, 2024
1 parent e5636e3 commit 439d287
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pyart/map/grid_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,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)
Expand Down
8 changes: 8 additions & 0 deletions tests/map/test_grid_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 439d287

Please sign in to comment.