Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shortname Search Keyword, CMR Token Fallback #745

Merged
merged 2 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading