Skip to content

Commit

Permalink
Merge pull request #745 from asfadmin/nisar-fixes
Browse files Browse the repository at this point in the history
Shortname Search Keyword, CMR Token Fallback
  • Loading branch information
SpicyGarlicAlbacoreRoll authored Mar 22, 2024
2 parents 5563a7e + d01ea13 commit 35f45fc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 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
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 35f45fc

Please sign in to comment.