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

Leading Zero on Coordinate Strings, Fallback ARIA Versioning #758

Merged
merged 9 commits into from
Jun 14, 2024
3 changes: 3 additions & 0 deletions SearchAPI/CMR/Input.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ def parse_coord_string(v):
raise ValueError(f'Invalid coordinate: {c}') from e
if len(v) % 2 != 0:
raise ValueError(f'Invalid coordinate list, odd number of values provided: {v}')
for i in range(len(v)):
if float(v[i]) < 1.0 and float(v[i]) > 0.0 :
v[i] = '0' + v[i]
return ','.join(v)

# Parse and validate a bbox coordinate string
Expand Down
7 changes: 6 additions & 1 deletion SearchAPI/CMR/Translate/parse_cmr_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from defusedxml.lxml import fromstring
import datetime
from .fields import get_field_paths, attr_path

import re

def parse_cmr_response(r, req_fields):
"""
Expand Down Expand Up @@ -237,9 +237,14 @@ def get_s3_urls():

if 'STATIC' in result['processingLevel']:
result['validityStartDate'] = get_val('./Temporal/SingleDateTime')
elif result.get('product_file_id', '').startswith('S1-GUNW') and result.get('ariaVersion') is None:
version_unformatted = result.get('granuleName').split('v')[-1]
result['ariaVersion'] = re.sub(r'[^0-9\.]', '', version_unformatted.replace("_", '.'))

if result.get('platform', '') == 'NISAR':
result['additionalUrls'] = get_http_urls()
result['s3Urls'] = get_s3_urls()

return result


Expand Down
Loading