From 16f088fbcba1a3107a94c36d0f3966f904ee6fd2 Mon Sep 17 00:00:00 2001 From: Forrest Williams Date: Tue, 16 Apr 2024 09:37:03 -0500 Subject: [PATCH 1/5] add hdf-eos5 metadata --- src/mintpy/prep_hyp3.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mintpy/prep_hyp3.py b/src/mintpy/prep_hyp3.py index dbd1fc874..6ff12d1eb 100644 --- a/src/mintpy/prep_hyp3.py +++ b/src/mintpy/prep_hyp3.py @@ -109,9 +109,13 @@ def add_hyp3_metadata(fname, meta, is_ifg=True): # HDF-EOS5 metadata if hyp3_meta['ReferenceGranule'].startswith('S1'): meta['beam_mode'] = 'IW' + + meta['startUTC'] = date1.strftime('%Y-%m-%d %H:%M:%S.%f') + '+00:00' + meta['stopUTC'] = date2.strftime('%Y-%m-%d %H:%M:%S.%f') + '+00:00' + meta['relativeOrbit'] = ((int(hyp3_meta['ReferenceOrbitNumber']) - 73) % 175) + 1 meta['unwrap_method'] = hyp3_meta['Unwrappingtype'] - return(meta) + return meta ######################################################################### From c2f09f32a33c9d742dca5f8191a421d37794932f Mon Sep 17 00:00:00 2001 From: Forrest Williams Date: Thu, 18 Apr 2024 09:25:04 -0500 Subject: [PATCH 2/5] remove timezone --- src/mintpy/prep_hyp3.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mintpy/prep_hyp3.py b/src/mintpy/prep_hyp3.py index 6ff12d1eb..6f7664c71 100644 --- a/src/mintpy/prep_hyp3.py +++ b/src/mintpy/prep_hyp3.py @@ -110,8 +110,8 @@ def add_hyp3_metadata(fname, meta, is_ifg=True): if hyp3_meta['ReferenceGranule'].startswith('S1'): meta['beam_mode'] = 'IW' - meta['startUTC'] = date1.strftime('%Y-%m-%d %H:%M:%S.%f') + '+00:00' - meta['stopUTC'] = date2.strftime('%Y-%m-%d %H:%M:%S.%f') + '+00:00' + meta['startUTC'] = date1.strftime('%Y-%m-%d %H:%M:%S.%f') + meta['stopUTC'] = date2.strftime('%Y-%m-%d %H:%M:%S.%f') meta['relativeOrbit'] = ((int(hyp3_meta['ReferenceOrbitNumber']) - 73) % 175) + 1 meta['unwrap_method'] = hyp3_meta['Unwrappingtype'] From 4f8a8ffd1a209864629529e80df8c7d512c49ebd Mon Sep 17 00:00:00 2001 From: Zhang Yunjun Date: Wed, 24 Apr 2024 00:53:46 +0800 Subject: [PATCH 3/5] Update prep_hyp3.py + update relative_orbit calc for S1A/B + update start/stopUTC calc --- src/mintpy/prep_hyp3.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/mintpy/prep_hyp3.py b/src/mintpy/prep_hyp3.py index 6f7664c71..b0b765396 100644 --- a/src/mintpy/prep_hyp3.py +++ b/src/mintpy/prep_hyp3.py @@ -107,12 +107,24 @@ def add_hyp3_metadata(fname, meta, is_ifg=True): meta['P_BASELINE_BOTTOM_HDR'] = hyp3_meta['Baseline'] # HDF-EOS5 metadata - if hyp3_meta['ReferenceGranule'].startswith('S1'): + ref_granule = hyp3_meta['ReferenceGranule'] + if ref_granule.startswith('S1'): + # beam_mode / relative_orbit meta['beam_mode'] = 'IW' - meta['startUTC'] = date1.strftime('%Y-%m-%d %H:%M:%S.%f') - meta['stopUTC'] = date2.strftime('%Y-%m-%d %H:%M:%S.%f') - meta['relativeOrbit'] = ((int(hyp3_meta['ReferenceOrbitNumber']) - 73) % 175) + 1 + if ref_granule.startswith('S1A'): + meta['relative_orbit'] = ((int(hyp3_meta['ReferenceOrbitNumber']) - 73) % 175) + 1 + elif ref_granule.startswith('S1B'): + meta['relative_orbit'] = ((int(hyp3_meta['ReferenceOrbitNumber']) - 202) % 175) + 1 + else: + raise ValueError('Un-recognized Sentinel-1 satellite from {ref_granule}!') + + # first/last_frame [from start/stopUTC] + t0, t1 = ref_granule.split('_')[-5:-3] + meta['startUTC'] = dt.datetime.strptime(t0, '%Y%m%dT%H%M%S').strftime('%Y-%m-%d %H:%M:%S.%f') + meta['stopUTC'] = dt.datetime.strptime(t1, '%Y%m%dT%H%M%S').strftime('%Y-%m-%d %H:%M:%S.%f') + + # unwrap_method meta['unwrap_method'] = hyp3_meta['Unwrappingtype'] return meta From 778d3a45e8e09dbd233e4b5c4391aa8fa7d68427 Mon Sep 17 00:00:00 2001 From: Zhang Yunjun Date: Wed, 24 Apr 2024 00:56:10 +0800 Subject: [PATCH 4/5] tests/configs: remove the manual setup of relative_orbit --- tests/configs/RidgecrestSenDT71.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/configs/RidgecrestSenDT71.txt b/tests/configs/RidgecrestSenDT71.txt index cb966c44d..1b5344a69 100644 --- a/tests/configs/RidgecrestSenDT71.txt +++ b/tests/configs/RidgecrestSenDT71.txt @@ -23,6 +23,3 @@ mintpy.save.hdfEos5 = yes mintpy.save.hdfEos5.subset = yes mintpy.plot = no mintpy.plot.maxMemory = 2 - -##————————————————————————————— HDF-EOS5 Attributes -—————————————————————————## -relative_orbit = 71 From d5e3b8f86f01abde585844ceb7af834ca37cf9ba Mon Sep 17 00:00:00 2001 From: Zhang Yunjun Date: Thu, 25 Apr 2024 18:17:45 +0800 Subject: [PATCH 5/5] prep_hyp3: extract beam_swath --- src/mintpy/prep_hyp3.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/mintpy/prep_hyp3.py b/src/mintpy/prep_hyp3.py index b0b765396..2de4066d7 100644 --- a/src/mintpy/prep_hyp3.py +++ b/src/mintpy/prep_hyp3.py @@ -37,14 +37,20 @@ def add_hyp3_metadata(fname, meta, is_ifg=True): key, value = line.strip().replace(' ','').split(':')[:2] hyp3_meta[key] = value - # get date1/2 objects + # get product type and the correponding insar processor if job_id.split('_')[2].startswith('IW'): # burst-wide product using ISCE2 + prod_type = 'isce2_burst' + else: + # scene-wide product using Gamma + prod_type = 'gamma_scene' + + # get date1/2 objects + if prod_type == 'isce2_burst': date1_str, date2_str = job_id.split('_')[3:5] date1 = dt.datetime.strptime(f'{date1_str}','%Y%m%d') date2 = dt.datetime.strptime(f'{date2_str}','%Y%m%d') else: - # scene-wide product using Gamma date1_str, date2_str = job_id.split('_')[1:3] date1 = dt.datetime.strptime(date1_str,'%Y%m%dT%H%M%S') date2 = dt.datetime.strptime(date2_str,'%Y%m%dT%H%M%S') @@ -109,9 +115,16 @@ def add_hyp3_metadata(fname, meta, is_ifg=True): # HDF-EOS5 metadata ref_granule = hyp3_meta['ReferenceGranule'] if ref_granule.startswith('S1'): - # beam_mode / relative_orbit + # beam_mode meta['beam_mode'] = 'IW' + # beam_swath + if prod_type == 'isce2_burst': + meta['beam_swath'] = job_id.split('_')[2][2:] + else: + meta['beam_swath'] = '123' + + # relative_orbit if ref_granule.startswith('S1A'): meta['relative_orbit'] = ((int(hyp3_meta['ReferenceOrbitNumber']) - 73) % 175) + 1 elif ref_granule.startswith('S1B'): @@ -120,6 +133,8 @@ def add_hyp3_metadata(fname, meta, is_ifg=True): raise ValueError('Un-recognized Sentinel-1 satellite from {ref_granule}!') # first/last_frame [from start/stopUTC] + # NOTE by Yunjun, Apr 2024: ascending node time is needed to calculate the first/last frame + # based on the start/end UTC time. t0, t1 = ref_granule.split('_')[-5:-3] meta['startUTC'] = dt.datetime.strptime(t0, '%Y%m%dT%H%M%S').strftime('%Y-%m-%d %H:%M:%S.%f') meta['stopUTC'] = dt.datetime.strptime(t1, '%Y%m%dT%H%M%S').strftime('%Y-%m-%d %H:%M:%S.%f')