Skip to content

Commit

Permalink
adds s3urls to jsonlite and jsonlite2 endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
kim committed Mar 27, 2024
1 parent e520313 commit 0e32a0f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
6 changes: 5 additions & 1 deletion SearchAPI/CMR/Output/jsonlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def req_fields_jsonlite():
'subswath',
'pgeVersion',
'operaBurstID',
'additionalUrls'
'additionalUrls',
's3Urls'
]
return fields

Expand Down Expand Up @@ -186,4 +187,7 @@ def getItem(self, p):
if p.get('validityStartDate'):
result['opera']['validityStartDate'] = p.get('validityStartDate')

if p.get('platform') == 'NISAR':
result['s3Urls'] = p.get('s3Urls', [])

return result
3 changes: 3 additions & 0 deletions SearchAPI/CMR/Output/jsonlite2.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,7 @@ def getItem(self, p):
if p.get('opera') is not None:
result['s1o'] = p['opera']

if p.get('platform') == 'NISAR':
result['s3du'] = p.get('s3Urls', [])

return result
9 changes: 8 additions & 1 deletion SearchAPI/CMR/Translate/parse_cmr_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,14 @@ def float_or_none(a):

if 'STATIC' in result['processingLevel']:
result['validityStartDate'] = get_val('./Temporal/SingleDateTime')

if result.get('platform', '') == 'NISAR':
accessUrls = [url for url in get_all_vals('./OnlineAccessURLs/OnlineAccessURL/URL') if not url.endswith('.md5') and not url.startswith('s3://') and not 's3credentials' in url]
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['s3Urls'] = list(set(
*[url for url in get_all_vals('./OnlineResources/OnlineAccessURL/URL') if not url.endswith('.md5') and (url.startswith('s3://') or 's3credentials' in url)],
*[url for url in get_all_vals('./OnlineResources/OnlineResource/URL') if not url.endswith('.md5') and (url.startswith('s3://') or 's3credentials' in url)]
))
return result


Expand Down

0 comments on commit 0e32a0f

Please sign in to comment.