From da3bb72f899c869da77654704d80e664890dba4a Mon Sep 17 00:00:00 2001 From: William Horn Date: Thu, 28 Sep 2023 08:21:45 -0800 Subject: [PATCH] fix: ers, jers, and radarsat-1 use FRAME_NUMBER --- .gitignore | 2 +- SearchAPI/CMR/Translate/parse_cmr_response.py | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 6ec93fb1..78f71418 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,4 @@ jsonlite_cache/* venv/* .DS_Store .vscode - +.env diff --git a/SearchAPI/CMR/Translate/parse_cmr_response.py b/SearchAPI/CMR/Translate/parse_cmr_response.py index 0e78ba28..93ec78b6 100644 --- a/SearchAPI/CMR/Translate/parse_cmr_response.py +++ b/SearchAPI/CMR/Translate/parse_cmr_response.py @@ -68,10 +68,16 @@ def remove_field(f): remove_field('platform') if 'frameNumber' in req_fields: - asf_frame_platforms = ['Sentinel-1A', 'Sentinel-1B', 'ALOS', 'SENTINEL-1A', 'SENTINEL-1B'] - result['frameNumber'] = get_val(attr_path('FRAME_NUMBER')) \ + asf_frame_platforms = [ + 'Sentinel-1A', 'Sentinel-1B', 'ALOS', 'SENTINEL-1A', 'SENTINEL-1B', + 'ERS-1', 'ERS-2', 'JERS-1', 'RADARSAT-1' + ] + + frame_type = 'FRAME_NUMBER' \ if result['platform'] in asf_frame_platforms \ - else get_val(attr_path('CENTER_ESA_FRAME')) + else 'CENTER_ESA_FRAME' + + result['frameNumber'] = get_val(attr_path(frame_type)) remove_field('frameNumber') if 'browse' in req_fields: @@ -126,13 +132,13 @@ def float_or_none(a): if 'canInsar' in req_fields: if result['platform'] in ['ALOS', 'RADARSAT-1', 'JERS-1', 'ERS-1', 'ERS-2']: result['insarGrouping'] = get_val(field_paths['insarGrouping']) - + insarBaseline = get_val(field_paths['insarBaseline']) if insarBaseline is not None: insarBaseline = float(insarBaseline) result['baseline'] = { 'insarBaseline': insarBaseline - } + } remove_field('insarGrouping') if result['insarGrouping'] not in [None, 0, '0', 'NA', 'NULL']: result['canInsar'] = True @@ -148,7 +154,7 @@ def float_or_none(a): result['canInsar'] = False remove_field('canInsar') - + # These fields are always None or NA and should be fully deprecated/removed in the future deprecated_fields = [ 'beamSwath',