Skip to content

Commit 33475e0

Browse files
authored
fix: index to ES is not setting bbox correctly (#475)
* breaking: using latest uds-lib + update docker * feat: use latest uds-lib * fix: index to ES is not setting bbox correctly
1 parent 335a925 commit 33475e0

File tree

3 files changed

+195
-139
lines changed

3 files changed

+195
-139
lines changed

cumulus_lambda_functions/granules_to_es/granules_indexer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __get_potential_files(self):
4747
potential_files = []
4848
self.__input_file_list = self.__cumulus_record['files']
4949
for each_file in self.__input_file_list:
50-
if 'type' in each_file and each_file['type'].strip().lower() != self.__valid_filetype_name:
50+
if 'type' in each_file and self.__valid_filetype_name not in each_file['type'].strip().lower():
5151
LOGGER.debug(f'Not metadata. skipping {each_file}')
5252
continue
5353
if 'fileName' not in each_file and 'name' in each_file: # add fileName if there is only name
@@ -93,6 +93,8 @@ def start(self):
9393
else:
9494
LOGGER.warning(f'unable to find STAC JSON file in {potential_files}')
9595
stac_item = ItemTransformer().to_stac(self.__cumulus_record)
96+
if stac_input_meta is not None and stac_input_meta.bbox is not None:
97+
stac_item['bbox'] = stac_input_meta.bbox
9698
if 'bbox' in stac_item:
9799
stac_item['bbox'] = GranulesDbIndex.to_es_bbox(stac_item['bbox'])
98100
collection_identifier = UdsCollections.decode_identifier(self.__cumulus_record['collectionId'])

cumulus_lambda_functions/metadata_stac_generate_cmr/stac_input_metadata.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ def __init__(self, input_stac_dict: dict):
1717
self.__prod_dt = None
1818
self.__insert_dt = None
1919
self.__custom_properties = {}
20+
self.__bbox = None
21+
22+
@property
23+
def bbox(self):
24+
return self.__bbox
25+
26+
@bbox.setter
27+
def bbox(self, val):
28+
"""
29+
:param val:
30+
:return: None
31+
"""
32+
self.__bbox = val
33+
return
2034

2135
@property
2236
def custom_properties(self):
@@ -132,6 +146,7 @@ def start(self) -> GranuleMetadataProps:
132146
stac_item: Item = ItemTransformer().from_stac(self.__input_stac_dict)
133147
self.__custom_properties = deepcopy(stac_item.properties)
134148
self.__remove_default_keys_in_custom_props()
149+
self.__bbox = stac_item.bbox
135150
# self.__custom_properties['collection_id'] = stac_item.collection_id # TODO version is included
136151
# collection_led_granule_id = stac_item.id if stac_item.id.startswith(stac_item.collection_id) else f'{stac_item.collection_id}:{stac_item.id}'
137152
# self.__custom_properties['granule_id'] = collection_led_granule_id # This needs to be start with collection_id to be consistent with cumulus granule_id which starts with collection

0 commit comments

Comments
 (0)