Skip to content

Commit

Permalink
fix: update how to validate bbox
Browse files Browse the repository at this point in the history
  • Loading branch information
wphyojpl committed Jan 15, 2025
1 parent 3561039 commit 6a57900
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions cumulus_lambda_functions/lib/uds_db/granules_db_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@ def __init__(self):

@staticmethod
def to_es_bbox(bbox_array):
# lon = x, lat = y
# lon, lat, lon, lat
# x can be 170 to -170
# 170, 0, -170, 10
minX, minY, maxX, maxY = bbox_array

# Ensure the values are properly sorted
if minX > maxX:
minX, maxX = maxX, minX
# if minX > maxX:
# minX, maxX = maxX, minX
if minY > maxY:
minY, maxY = maxY, minY

Expand Down Expand Up @@ -274,3 +278,6 @@ def dsl_search(self, tenant: str, tenant_venue: str, search_dsl: dict):
'hits': result
}
}



2 changes: 1 addition & 1 deletion tests/integration_tests/test_stage_out_ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def test_03_upload_complete_catalog_role_as_key(self):
"coordinates": [0.0, 0.0]
},
# bbox=[0.0, 0.0, 0.1, 0.1],
bbox=[0.1, 0.1, 0.0, 0.0], # Testing invalid geo-shape
bbox=[170, 20, -170, 10], # Testing invalid geo-shape
datetime=TimeUtils().parse_from_unix(0, True).get_datetime_obj(),
properties={
"start_datetime": "2016-01-31T18:00:00.009057Z",
Expand Down

0 comments on commit 6a57900

Please sign in to comment.