From d4d1b4e9165c68c4982c9c624eba95b0662fc83a Mon Sep 17 00:00:00 2001 From: kim Date: Tue, 5 Dec 2023 11:12:18 -0900 Subject: [PATCH 1/3] adds validity start date for static opera product types --- SearchAPI/CMR/Output/jsonlite.py | 4 +++- SearchAPI/CMR/Translate/parse_cmr_response.py | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/SearchAPI/CMR/Output/jsonlite.py b/SearchAPI/CMR/Output/jsonlite.py index 6fabc9db..4070735a 100644 --- a/SearchAPI/CMR/Output/jsonlite.py +++ b/SearchAPI/CMR/Output/jsonlite.py @@ -181,7 +181,9 @@ def getItem(self, p): if p.get('operaBurstID') is not None or result['productID'].startswith('OPERA'): result['opera'] = { 'operaBurstID': p.get('operaBurstID'), - 'additionalUrls': p.get('additionalUrls') + 'additionalUrls': p.get('additionalUrls'), } + if p.get('ValidityStartDate'): + result['opera']['ValidityStartDate'] = p.get('ValidityStartDate') return result diff --git a/SearchAPI/CMR/Translate/parse_cmr_response.py b/SearchAPI/CMR/Translate/parse_cmr_response.py index 1a4ec8db..f59d0e41 100644 --- a/SearchAPI/CMR/Translate/parse_cmr_response.py +++ b/SearchAPI/CMR/Translate/parse_cmr_response.py @@ -212,6 +212,10 @@ def float_or_none(a): result['additionalUrls'] = list(set([*accessUrls, *OnlineResources])) result['configurationName'] = "Interferometric Wide. 250 km swath, 5 m x 20 m spatial resolution and burst synchronization for interferometry. IW is considered to be the standard mode over land masses." result['browse'] = [url for url in get_all_vals('./AssociatedBrowseImageUrls/ProviderBrowseUrl/URL') if not url.startswith('s3://')] + + if 'STATIC' in result['processingLevel']: + result['ValidityStartDate'] = get_val('./Temporal/SingleDateTime') + return result From bd5b2ecb3a6ac812d793e19efd617fb691a38b31 Mon Sep 17 00:00:00 2001 From: kim Date: Tue, 5 Dec 2023 11:17:51 -0900 Subject: [PATCH 2/3] fixes capitalization --- SearchAPI/CMR/Output/jsonlite.py | 4 ++-- SearchAPI/CMR/Translate/parse_cmr_response.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SearchAPI/CMR/Output/jsonlite.py b/SearchAPI/CMR/Output/jsonlite.py index 4070735a..99795463 100644 --- a/SearchAPI/CMR/Output/jsonlite.py +++ b/SearchAPI/CMR/Output/jsonlite.py @@ -183,7 +183,7 @@ def getItem(self, p): 'operaBurstID': p.get('operaBurstID'), 'additionalUrls': p.get('additionalUrls'), } - if p.get('ValidityStartDate'): - result['opera']['ValidityStartDate'] = p.get('ValidityStartDate') + if p.get('validityStartDate'): + result['opera']['validityStartDate'] = p.get('validityStartDate') return result diff --git a/SearchAPI/CMR/Translate/parse_cmr_response.py b/SearchAPI/CMR/Translate/parse_cmr_response.py index f59d0e41..3868dd6e 100644 --- a/SearchAPI/CMR/Translate/parse_cmr_response.py +++ b/SearchAPI/CMR/Translate/parse_cmr_response.py @@ -214,7 +214,7 @@ def float_or_none(a): result['browse'] = [url for url in get_all_vals('./AssociatedBrowseImageUrls/ProviderBrowseUrl/URL') if not url.startswith('s3://')] if 'STATIC' in result['processingLevel']: - result['ValidityStartDate'] = get_val('./Temporal/SingleDateTime') + result['validityStartDate'] = get_val('./Temporal/SingleDateTime') return result From c4c0e5d659207c56ee6a98d31daec59f7b6f7ffd Mon Sep 17 00:00:00 2001 From: kim Date: Tue, 5 Dec 2023 12:13:13 -0900 Subject: [PATCH 3/3] checks if providerbrowseUrls available --- SearchAPI/CMR/Translate/parse_cmr_response.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SearchAPI/CMR/Translate/parse_cmr_response.py b/SearchAPI/CMR/Translate/parse_cmr_response.py index 3868dd6e..1296c3cb 100644 --- a/SearchAPI/CMR/Translate/parse_cmr_response.py +++ b/SearchAPI/CMR/Translate/parse_cmr_response.py @@ -211,7 +211,9 @@ def float_or_none(a): OnlineResources = [url for url in get_all_vals('./OnlineResources/OnlineResource/URL') if not url.endswith('.md5') and not url.startswith('s3://') and not 's3credentials' in url] result['additionalUrls'] = list(set([*accessUrls, *OnlineResources])) result['configurationName'] = "Interferometric Wide. 250 km swath, 5 m x 20 m spatial resolution and burst synchronization for interferometry. IW is considered to be the standard mode over land masses." - result['browse'] = [url for url in get_all_vals('./AssociatedBrowseImageUrls/ProviderBrowseUrl/URL') if not url.startswith('s3://')] + + if (providerbrowseUrls := get_all_vals('./AssociatedBrowseImageUrls/ProviderBrowseUrl/URL')): + result['browse'] = [url for url in providerbrowseUrls if not url.startswith('s3://')] if 'STATIC' in result['processingLevel']: result['validityStartDate'] = get_val('./Temporal/SingleDateTime')