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

Fixed bug introduced in issues/36 where valid bboxes were raising an exception #149

Merged
merged 1 commit into from
Aug 24, 2023
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
5 changes: 1 addition & 4 deletions subscriber/podaac_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,7 @@ def validate(args):
raise ValueError(
"Error parsing '--bounds': " + args.bbox + ". Format is W Longitude,S Latitude,E Longitude,N Latitude without spaces ") # noqa E501

if num_bounds[0] > num_bounds[2]:
raise ValueError('Error parsing "--bounds": W Longitude must be <= E Longitude')

if num_bounds[1] > num_bounds[2]:
if num_bounds[1] > num_bounds[3]:
raise ValueError('Error parsing "--bounds": S Latitude must be <= N Latitude')


Expand Down
11 changes: 11 additions & 0 deletions tests/test_subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,17 @@ def test_validate():
with pytest.raises(ValueError):
a = validate(["-c", "viirs", "-d", "/data", "-b=-180,-90,180", "-m", "100"])

# bbox crossing the IDL should not raise exception
validate(["-c", "viirs", "-d", "/data", "-dy", "-e", ".nc", "-m", "60", "-b=120,-60,-120,60"])
# valid bbox values should not raise exception
validate(["-c", "viirs", "-d", "/data", "-dy", "-e", ".nc", "-m", "60", "-b=-180,-60,-120,60"])
validate(["-c", "viirs", "-d", "/data", "-dy", "-e", ".nc", "-m", "60", "-b=-170,-20,-30,20"])

# bbox with invalid latitude values should raise an exception
with pytest.raises(ValueError):
validate(["-c", "viirs", "-d", "/data", "-b=-180,90,180,-90", "-m", "100"])


# #don't work
# with pytest.raises(SystemExit):
# a = validate([])
Expand Down