Skip to content

Commit c6caa27

Browse files
author
kim
committed
Merge branch 'test' into devel
2 parents f4399a5 + 2d79abd commit c6caa27

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ jsonlite_cache/*
2222
venv/*
2323
.DS_Store
2424
.vscode
25-
25+
.env

SearchAPI/CMR/Translate/parse_cmr_response.py

+20-8
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,17 @@ def remove_field(f):
6868
remove_field('platform')
6969

7070
if 'frameNumber' in req_fields:
71-
asf_frame_platforms = ['Sentinel-1A', 'Sentinel-1B', 'ALOS', 'SENTINEL-1A', 'SENTINEL-1B']
72-
result['frameNumber'] = get_val(attr_path('FRAME_NUMBER')) \
73-
if result['platform'] in asf_frame_platforms \
74-
else get_val(attr_path('CENTER_ESA_FRAME'))
71+
asf_frame_platforms = [
72+
'Sentinel-1A', 'Sentinel-1B', 'ALOS', 'SENTINEL-1A', 'SENTINEL-1B',
73+
'ERS-1', 'ERS-2', 'JERS-1', 'RADARSAT-1'
74+
]
75+
76+
if result['platform'] in asf_frame_platforms:
77+
frame_type = 'FRAME_NUMBER'
78+
else:
79+
frame_type = 'CENTER_ESA_FRAME'
80+
81+
result['frameNumber'] = get_val(attr_path(frame_type))
7582
remove_field('frameNumber')
7683

7784
if 'browse' in req_fields:
@@ -126,13 +133,13 @@ def float_or_none(a):
126133
if 'canInsar' in req_fields:
127134
if result['platform'] in ['ALOS', 'RADARSAT-1', 'JERS-1', 'ERS-1', 'ERS-2']:
128135
result['insarGrouping'] = get_val(field_paths['insarGrouping'])
129-
136+
130137
insarBaseline = get_val(field_paths['insarBaseline'])
131138
if insarBaseline is not None:
132139
insarBaseline = float(insarBaseline)
133140
result['baseline'] = {
134141
'insarBaseline': insarBaseline
135-
}
142+
}
136143
remove_field('insarGrouping')
137144
if result['insarGrouping'] not in [None, 0, '0', 'NA', 'NULL']:
138145
result['canInsar'] = True
@@ -148,7 +155,7 @@ def float_or_none(a):
148155
result['canInsar'] = False
149156
remove_field('canInsar')
150157

151-
158+
152159
# These fields are always None or NA and should be fully deprecated/removed in the future
153160
deprecated_fields = [
154161
'beamSwath',
@@ -199,7 +206,12 @@ def float_or_none(a):
199206
result['fileName'] = result['granuleName'] + '.' + urls[0].split('.')[-1]
200207

201208
if result.get('product_file_id', '').startswith('OPERA'):
202-
result['additionalUrls'] = [url for url in get_all_vals('./OnlineAccessURLs/OnlineAccessURL/URL') if not url.endswith('.md5') and not url.startswith('s3://')]
209+
result['beamMode'] = get_val(attr_path('BEAM_MODE'))
210+
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]
211+
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]
212+
result['additionalUrls'] = list(set([*accessUrls, *OnlineResources]))
213+
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."
214+
result['browse'] = [url for url in get_all_vals('./AssociatedBrowseImageUrls/ProviderBrowseUrl/URL') if not url.startswith('s3://')]
203215
return result
204216

205217

0 commit comments

Comments
 (0)