Skip to content

Commit 5223e52

Browse files
authored
Merge 3561039 into 8c4537f
2 parents 8c4537f + 3561039 commit 5223e52

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

cumulus_lambda_functions/lib/uds_db/granules_db_index.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,21 @@ def __init__(self):
3434

3535
@staticmethod
3636
def to_es_bbox(bbox_array):
37+
minX, minY, maxX, maxY = bbox_array
38+
39+
# Ensure the values are properly sorted
40+
if minX > maxX:
41+
minX, maxX = maxX, minX
42+
if minY > maxY:
43+
minY, maxY = maxY, minY
44+
3745
return {
3846
"type": "envelope",
39-
"coordinates": [
40-
[bbox_array[0], bbox_array[3]], # Top-left corner (minLon, maxLat)
41-
[bbox_array[2], bbox_array[1]] # Bottom-right corner (maxLon, minLat)
42-
]
47+
"coordinates": [[minX, maxY], [maxX, minY]],
48+
# "coordinates": [
49+
# [bbox_array[0], bbox_array[3]], # Top-left corner (minLon, maxLat)
50+
# [bbox_array[2], bbox_array[1]] # Bottom-right corner (maxLon, minLat)
51+
# ]
4352
}
4453

4554
@staticmethod

tests/integration_tests/test_stage_out_ingestion.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ def test_03_upload_complete_catalog_role_as_key(self):
232232
"type": "Point",
233233
"coordinates": [0.0, 0.0]
234234
},
235-
bbox=[0.0, 0.0, 0.1, 0.1],
235+
# bbox=[0.0, 0.0, 0.1, 0.1],
236+
bbox=[0.1, 0.1, 0.0, 0.0], # Testing invalid geo-shape
236237
datetime=TimeUtils().parse_from_unix(0, True).get_datetime_obj(),
237238
properties={
238239
"start_datetime": "2016-01-31T18:00:00.009057Z",

0 commit comments

Comments
 (0)