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

Add check if radars tuple is not empty #991

Merged
merged 2 commits into from
Apr 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pyart/map/gates_to_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ def map_gates_to_grid(
if isinstance(radars, Radar):
radars = (radars, )

if len(radars) == 0:
raise ValueError('Length of radars tuple cannot be zero')

skip_transform = False
if len(radars) == 1 and grid_origin_alt is None and grid_origin is None:
skip_transform = True
Expand Down
6 changes: 6 additions & 0 deletions pyart/map/grid_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ def grid_from_radars(radars, grid_shape, grid_limits,
if isinstance(radars, Radar):
radars = (radars, )

if len(radars) == 0:
raise ValueError('Length of radars tuple cannot be zero')

# map the radar(s) to a cartesian grid
if gridding_algo == 'map_to_grid':
grids = map_to_grid(radars, grid_shape, grid_limits, **kwargs)
Expand Down Expand Up @@ -396,6 +399,9 @@ def map_to_grid(radars, grid_shape, grid_limits, grid_origin=None,
# make a tuple if passed a radar object as the first argument
if isinstance(radars, Radar):
radars = (radars, )

if len(radars) == 0:
raise ValueError('Length of radars tuple cannot be zero')

skip_transform = False
if len(radars) == 1 and grid_origin_alt is None and grid_origin is None:
Expand Down