From 3cebea8eb3b93f451b92e4d12eec7d80000ac6be Mon Sep 17 00:00:00 2001 From: kim Date: Fri, 31 May 2024 14:41:28 -0800 Subject: [PATCH] adds fallback version number for aria s1 gunw products older than v3 --- SearchAPI/CMR/Translate/parse_cmr_response.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/SearchAPI/CMR/Translate/parse_cmr_response.py b/SearchAPI/CMR/Translate/parse_cmr_response.py index 83c93e31..ff55f917 100644 --- a/SearchAPI/CMR/Translate/parse_cmr_response.py +++ b/SearchAPI/CMR/Translate/parse_cmr_response.py @@ -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): """ @@ -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['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