Skip to content

feat: daac product.name = granule id #589

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

Merged
merged 1 commit into from
May 29, 2025
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
4 changes: 2 additions & 2 deletions cumulus_lambda_functions/daac_archiver/daac_archiver_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def __extract_files(self, uds_cnm_json: dict, daac_config: dict):

def send_to_daac_internal(self, uds_cnm_json: dict):
LOGGER.debug(f'uds_cnm_json: {uds_cnm_json}')
granule_identifier = UdsCollections.decode_identifier(uds_cnm_json['identifier']) # This is normally meant to be for collection. Since our granule ID also has collection id prefix. we can use this.
granule_identifier = UdsCollections.decode_granule_identifier(uds_cnm_json['identifier']) # This is normally meant to be for collection. Since our granule ID also has collection id prefix. we can use this.
self.__archive_index_logic.set_tenant_venue(granule_identifier.tenant, granule_identifier.venue)
daac_config = self.__archive_index_logic.percolate_document(uds_cnm_json['identifier'])
if daac_config is None or len(daac_config) < 1:
Expand All @@ -120,7 +120,7 @@ def send_to_daac_internal(self, uds_cnm_json: dict):
"provider": granule_identifier.tenant,
"version": "1.6.0", # TODO this is hardcoded?
"product": {
"name": granule_identifier.id,
"name": granule_identifier.granule,
# "dataVersion": daac_config['daac_data_version'],
'files': self.__extract_files(uds_cnm_json, daac_config),
}
Expand Down
9 changes: 9 additions & 0 deletions cumulus_lambda_functions/lib/uds_db/uds_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@


CollectionIdentifier = namedtuple('CollectionIdentifier', ['urn', 'nasa', 'project', 'tenant', 'venue', 'id'])
GranuleIdentifier = namedtuple('CollectionIdentifier', ['urn', 'nasa', 'project', 'tenant', 'venue', 'id', 'granule'])


class UdsCollections:
Expand All @@ -35,6 +36,14 @@ def decode_identifier(incoming_identifier: str) -> CollectionIdentifier:
raise ValueError(f'invalid collection: {collection_identifier_parts}')
return CollectionIdentifier._make(collection_identifier_parts[0:6])

@staticmethod
def decode_granule_identifier(incoming_identifier: str) -> GranuleIdentifier:
collection_identifier_parts = incoming_identifier.split(':')
if len(collection_identifier_parts) < 7:
raise ValueError(f'invalid collection: {collection_identifier_parts}')
return GranuleIdentifier._make(collection_identifier_parts[0:6] + [':'.join(collection_identifier_parts[6:])])


def __bbox_to_polygon(self, bbox: list):
if len(bbox) != 4:
raise ValueError(f'not bounding box: {bbox}')
Expand Down
13 changes: 13 additions & 0 deletions tests/cumulus_lambda_functions/lib/uds_db/test_uds_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,18 @@ def test_02(self):
self.assertEqual(aa.venue, 'DEV', f'wrong venue')
self.assertEqual(aa.tenant, 'UDS_LOCAL', f'wrong tenant')
print(aa)

granule_id = 'URN:NASA:UNITY:unity:test:TRPSDL2ALLCRS1MGLOS___2:TROPESS_CrIS-JPSS1_L2_Standard_H2O_20250108_MUSES_R1p23_megacity_los_angeles_MGLOS_F2p5_J0'
aa = UdsCollections.decode_granule_identifier(granule_id)
self.assertEqual(aa.venue, 'test', f'wrong venue')
self.assertEqual(aa.tenant, 'unity', f'wrong tenant')
self.assertEqual(aa.granule, 'TROPESS_CrIS-JPSS1_L2_Standard_H2O_20250108_MUSES_R1p23_megacity_los_angeles_MGLOS_F2p5_J0')
print(aa)
granule_id = 'URN:NASA:UNITY:unity:test:TRPSDL2ALLCRS1MGLOS___2:TROPESS_CrIS-JPSS1_L2_Standard_H2O_20250108_MUSES_R1p23_megacity_los_angeles_MGLOS_F2p5_J0:1:2:3:4'
aa = UdsCollections.decode_granule_identifier(granule_id)
self.assertEqual(aa.venue, 'test', f'wrong venue')
self.assertEqual(aa.tenant, 'unity', f'wrong tenant')
self.assertEqual(aa.granule, 'TROPESS_CrIS-JPSS1_L2_Standard_H2O_20250108_MUSES_R1p23_megacity_los_angeles_MGLOS_F2p5_J0:1:2:3:4')

return

Loading