Skip to content

Commit

Permalink
ADD: unit tests for 'determine_sweeps'
Browse files Browse the repository at this point in the history
  • Loading branch information
isilber committed Dec 6, 2023
1 parent 8ae5a44 commit 47966fe
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/util/test_radar_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,24 @@ def test_to_vpt():
assert len(radar.instrument_parameters["prt_mode"]["data"]) == 108


def test_determine_sweeps():
# ppi
radar = pyart.testing.make_empty_ppi_radar(10, 36, 3)
radar.elevation['data'] = radar.elevation['data'] * np.ceil(np.arange(1, 36*3 + 1) / 36)
pyart.util.determine_sweeps(radar)
assert np.all(radar.sweep_end_ray_index['data'] == [35, 71, 107])
assert np.all(radar.sweep_start_ray_index['data'] == [0, 36, 72])
assert len(radar.sweep_number['data']) == 3

# rhi
radar = pyart.testing.make_empty_rhi_radar(10, 25, 5)
radar.azimuth['data'] = radar.azimuth['data'] * np.ceil(np.arange(1, 25*5 + 1) / 25) * 25
pyart.util.determine_sweeps(radar)
assert np.all(radar.sweep_end_ray_index['data'] == [ 24, 49, 74, 99, 124])
assert np.all(radar.sweep_start_ray_index['data'] == [ 0, 25, 50, 75, 100])
assert len(radar.sweep_number['data']) == 5


def test_subset_radar():
radar = pyart.testing.make_empty_ppi_radar(10, 36, 3)
field = {"data": np.ones((36 * 3, 10))}
Expand Down

0 comments on commit 47966fe

Please sign in to comment.