Skip to content

Commit

Permalink
adds dataAccessUrls to opera product output
Browse files Browse the repository at this point in the history
  • Loading branch information
kim committed Sep 27, 2023
1 parent 9748a7c commit 4afb936
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions SearchAPI/CMR/Output/jsonlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def req_fields_jsonlite():
'subswath',
'pgeVersion',
'operaBurstID',
'additionalUrls'
]
return fields

Expand Down Expand Up @@ -177,9 +178,10 @@ def getItem(self, p):

result['burst'] = burst

if p.get('operaBurstID') is not None:
if p.get('operaBurstID') is not None or result['productID'].startswith('OPERA'):
result['opera'] = {
'operaBurstID': p.get('operaBurstID')
'operaBurstID': p.get('operaBurstID'),
'additionalUrls': p.get('additionalUrls')
}

return result
2 changes: 1 addition & 1 deletion SearchAPI/CMR/SubQuery.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def get_page(self, session):
api_url = self.cmr_api_url()
response = session.post(api_url, data=self.params, headers=self.headers)

if 'CMR-Search-After' in response.headers:
if 'CMR-Search-After' in response.headers:
session.headers.update({'CMR-Search-After': response.headers['CMR-Search-After']})

query_duration = perf_counter() - q_start
Expand Down
3 changes: 2 additions & 1 deletion SearchAPI/CMR/Translate/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def get_field_paths():
'thumbnailUrl': attr_path('THUMBNAIL_URL'),
'track': attr_path('PATH_NUMBER'),
'pgeVersion': "./PGEVersionClass/PGEVersion",

'additionalUrls': "./OnlineAccessURLs",

# BURST FIELDS
'absoluteBurstID': attr_path('BURST_ID_ABSOLUTE'),
'relativeBurstID': attr_path('BURST_ID_RELATIVE'),
Expand Down
3 changes: 2 additions & 1 deletion SearchAPI/CMR/Translate/parse_cmr_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ def float_or_none(a):
result['downloadUrl'] = urls[0]
result['fileName'] = result['granuleName'] + '.' + urls[0].split('.')[-1]


if result.get('product_file_id', '').startswith('OPERA'):
result['additionalUrls'] = [url for url in get_all_vals('./OnlineAccessURLs/OnlineAccessURL/URL') if not url.endswith('.md5') and not url.startswith('s3://')]
return result


Expand Down

0 comments on commit 4afb936

Please sign in to comment.