Skip to content

Commit

Permalink
Merge pull request #746 from asfadmin/test
Browse files Browse the repository at this point in the history
`shortName`, `cmr_token` form data fallback
  • Loading branch information
SpicyGarlicAlbacoreRoll authored Mar 22, 2024
2 parents 63c2c27 + e520313 commit 452918a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
14 changes: 10 additions & 4 deletions SearchAPI/CMR/Output/geojson.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,19 @@ def getItem(self, p):
except TypeError:
pass

if p.get('absoluteOrbit') is not None and len(p.get('absoluteOrbit')):
p['absoluteOrbit'] = p['absoluteOrbit'][0]

coordinates = []

if p.get('shape') is not None:
coordinates = [[float(c['lon']), float(c['lat'])] for c in p.get('shape')]

result = {
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [
[[float(c['lon']), float(c['lat'])] for c in p['shape']]
]
'coordinates': coordinates
},
'properties': {
'beamModeType': p['beamModeType'],
Expand All @@ -82,7 +88,7 @@ def getItem(self, p):
'insarStackId': p['insarGrouping'],
'md5sum': p['md5sum'],
'offNadirAngle': p['offNadirAngle'],
'orbit': p['absoluteOrbit'][0],
'orbit': p['absoluteOrbit'],
'pathNumber': p['relativeOrbit'],
'platform': p['platform'],
'pointingAngle': p['pointingAngle'],
Expand Down
2 changes: 1 addition & 1 deletion SearchAPI/CMR/Query.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def chunk_list(source_list, n):
if chunk_type in params:
params[chunk_type] = chunk_list(list(set(params[chunk_type])), 500) # distinct and split

list_param_names = ['platform', 'collections'] # these parameters will dodge the subquery system
list_param_names = ['platform', 'collections', 'shortname'] # these parameters will dodge the subquery system

for k, v in params.items():
if k in list_param_names:
Expand Down
3 changes: 3 additions & 0 deletions SearchAPI/CMR/SubQuery.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ def __init__(self, req_fields, params, extra_params):
self.headers = {}

token = request.args.get("cmr_token")
if token is None:
token = request.form.get('cmr_token')

if token != None:
self.headers['Authorization'] = f'Bearer {token}'

Expand Down
3 changes: 2 additions & 1 deletion SearchAPI/CMR/Translate/input_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def input_map():
'absoluteburstid': ['attribute[]', 'int,BURST_ID_ABSOLUTE,{0}', parse_int_list],
'fullburstid': ['attribute[]', 'string,BURST_ID_FULL,{0}', parse_string_list],
'operaburstid': ['attribute[]', 'string,OPERA_BURST_ID,{0}', parse_string_list],
'dataset': [None, '{0}', parse_string_list]
'dataset': [None, '{0}', parse_string_list],
'shortname': ['shortName', '{0}', parse_string_list]
}

return parameter_map

0 comments on commit 452918a

Please sign in to comment.