Skip to content

Commit

Permalink
Merge pull request #758 from asfadmin/test
Browse files Browse the repository at this point in the history
Leading Zero on Coordinate Strings, Fallback ARIA Versioning
  • Loading branch information
SpicyGarlicAlbacoreRoll authored Jun 14, 2024
2 parents d9d436b + bffd477 commit 4b84cd3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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

0 comments on commit 4b84cd3

Please sign in to comment.