From 66c434937fa1f8ac2376af11f51175fb719755e5 Mon Sep 17 00:00:00 2001 From: jacquelynsmale Date: Fri, 28 Jun 2024 09:40:49 -0800 Subject: [PATCH 1/7] update the parsing --- src/hyp3_isce2/merge_tops_bursts.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/hyp3_isce2/merge_tops_bursts.py b/src/hyp3_isce2/merge_tops_bursts.py index ae71429c..6201661b 100644 --- a/src/hyp3_isce2/merge_tops_bursts.py +++ b/src/hyp3_isce2/merge_tops_bursts.py @@ -128,9 +128,8 @@ def get_burst_metadata(product_paths: Iterable[Path]) -> Iterable[BurstProduct]: burst_indexes = [result.properties['burst']['burstIndex'] for result in results] polarization = [result.properties['polarization'] for result in results] start_utc = [ - datetime.datetime.strptime(result.properties['startTime'], '%Y-%m-%dT%H:%M:%S.%fZ') for result in results + datetime.datetime.strptime(result.properties['startTime'], '%Y-%m-%dT%H:%M:%SZ') for result in results ] - relative_orbits = [result.properties['pathNumber'] for result in results] n_lines = [int(meta['Radarnlines']) for meta in metas] n_samples = [int(meta['Radarnsamples']) for meta in metas] range_looks = [int(meta['Rangelooks']) for meta in metas] From dae0c46462d917cf117c8973d2a52014b2eedfa9 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 20:57:45 +0000 Subject: [PATCH 2/7] update coverage image --- images/coverage.svg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/images/coverage.svg b/images/coverage.svg index 6c15cace..1618ede7 100644 --- a/images/coverage.svg +++ b/images/coverage.svg @@ -9,13 +9,13 @@ - + coverage coverage - 75% - 75% + 74% + 74% From 1b2cce85c40d016c4779758f06a650a258bfba7b Mon Sep 17 00:00:00 2001 From: Forrest Williams Date: Mon, 1 Jul 2024 16:00:50 -0500 Subject: [PATCH 3/7] update changelog --- CHANGELOG.md | 1 + src/hyp3_isce2/merge_tops_bursts.py | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4142bf5c..471a071c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [1.1.2] ### Fixed * Renamed `hyp3_isce2.logging` to `hyp3_isce2.logger` to avoid shadowing built-in. +* Parsing of product start times in `merge_tops_bursts`. ## [1.1.1] ### Fixed diff --git a/src/hyp3_isce2/merge_tops_bursts.py b/src/hyp3_isce2/merge_tops_bursts.py index 6201661b..38fa1623 100644 --- a/src/hyp3_isce2/merge_tops_bursts.py +++ b/src/hyp3_isce2/merge_tops_bursts.py @@ -130,6 +130,7 @@ def get_burst_metadata(product_paths: Iterable[Path]) -> Iterable[BurstProduct]: start_utc = [ datetime.datetime.strptime(result.properties['startTime'], '%Y-%m-%dT%H:%M:%SZ') for result in results ] + relative_orbits = [result.properties['pathNumber'] for result in results] n_lines = [int(meta['Radarnlines']) for meta in metas] n_samples = [int(meta['Radarnsamples']) for meta in metas] range_looks = [int(meta['Rangelooks']) for meta in metas] From c4499565786a855671b92de95c3bdb32ccceaaaf Mon Sep 17 00:00:00 2001 From: Forrest Williams Date: Tue, 2 Jul 2024 08:00:29 -0500 Subject: [PATCH 4/7] switch to using umm start time to get exact start time --- CHANGELOG.md | 2 +- src/hyp3_isce2/merge_tops_bursts.py | 6 +++--- tests/test_merge_tops_bursts.py | 7 +++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 471a071c..62cc6c79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [1.1.2] ### Fixed * Renamed `hyp3_isce2.logging` to `hyp3_isce2.logger` to avoid shadowing built-in. -* Parsing of product start times in `merge_tops_bursts`. +* Source of product start times in `merge_tops_bursts` to use the `asf_search` umm record. ## [1.1.1] ### Fixed diff --git a/src/hyp3_isce2/merge_tops_bursts.py b/src/hyp3_isce2/merge_tops_bursts.py index 38fa1623..f3ef8457 100644 --- a/src/hyp3_isce2/merge_tops_bursts.py +++ b/src/hyp3_isce2/merge_tops_bursts.py @@ -127,9 +127,9 @@ def get_burst_metadata(product_paths: Iterable[Path]) -> Iterable[BurstProduct]: burst_ids = [result.properties['burst']['relativeBurstID'] for result in results] burst_indexes = [result.properties['burst']['burstIndex'] for result in results] polarization = [result.properties['polarization'] for result in results] - start_utc = [ - datetime.datetime.strptime(result.properties['startTime'], '%Y-%m-%dT%H:%M:%SZ') for result in results - ] + + start_utc_strs = [result.umm['TemporalExtent']['RangeDateTime']['BeginningDateTime'] for result in results] + start_utc = [datetime.datetime.strptime(utc, '%Y-%m-%dT%H:%M:%S.%fZ') for utc in start_utc_strs] relative_orbits = [result.properties['pathNumber'] for result in results] n_lines = [int(meta['Radarnlines']) for meta in metas] n_samples = [int(meta['Radarnsamples']) for meta in metas] diff --git a/tests/test_merge_tops_bursts.py b/tests/test_merge_tops_bursts.py index 54ff6bb0..29b8fa75 100644 --- a/tests/test_merge_tops_bursts.py +++ b/tests/test_merge_tops_bursts.py @@ -27,13 +27,16 @@ def mock_asf_search_results( path_number: int, ) -> asf_search.ASFSearchResults: product = asf_search.ASFProduct() - product.umm = {'InputGranules': [slc_name]} + product.umm = { + 'InputGranules': [slc_name], + 'TemporalExtent': {'RangeDateTime': {'BeginningDateTime': '2020-06-04T02:23:13.963847Z'}}, + } product.properties.update( { 'burst': {'subswath': subswath, 'burstIndex': burst_index, 'relativeBurstID': burst_id}, 'polarization': polarization, 'url': f'https://foo.com/{slc_name}/baz.zip', - 'startTime': '2020-06-04T02:23:13.963847Z', + # 'startTime': '2020-06-04T02:23:13.963847Z', 'pathNumber': path_number, } ) From 894c93b1881b7dc4443fc59d3a337c2a48043ae5 Mon Sep 17 00:00:00 2001 From: Forrest Williams Date: Tue, 2 Jul 2024 08:00:51 -0500 Subject: [PATCH 5/7] add --overwrite to watermask call to simplify local testing --- src/hyp3_isce2/water_mask.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hyp3_isce2/water_mask.py b/src/hyp3_isce2/water_mask.py index 489869e6..06681287 100644 --- a/src/hyp3_isce2/water_mask.py +++ b/src/hyp3_isce2/water_mask.py @@ -125,6 +125,7 @@ def create_water_mask(input_image: str, output_image: str, gdal_format='ISCE', t merged_warped_path, f'--outfile={output_image}', '--calc="numpy.abs((A.astype(numpy.int16) + 1) - 2)"', # Change 1's to 0's and 0's to 1's. - f'--format={gdal_format}' + f'--format={gdal_format}', + '--overwrite', ] subprocess.run(flip_values_command, check=True) From 838d47ec655fdc95b68ea5ad630f24ffa642a759 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 2 Jul 2024 13:02:51 +0000 Subject: [PATCH 6/7] update coverage image --- images/coverage.svg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/images/coverage.svg b/images/coverage.svg index 1618ede7..6c15cace 100644 --- a/images/coverage.svg +++ b/images/coverage.svg @@ -9,13 +9,13 @@ - + coverage coverage - 74% - 74% + 75% + 75% From 2925b394532400c469284ae9a6a3ec32fec49659 Mon Sep 17 00:00:00 2001 From: Forrest Williams Date: Tue, 2 Jul 2024 08:06:53 -0500 Subject: [PATCH 7/7] remove obsolete code --- tests/test_merge_tops_bursts.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_merge_tops_bursts.py b/tests/test_merge_tops_bursts.py index 29b8fa75..c2b8bfec 100644 --- a/tests/test_merge_tops_bursts.py +++ b/tests/test_merge_tops_bursts.py @@ -36,7 +36,6 @@ def mock_asf_search_results( 'burst': {'subswath': subswath, 'burstIndex': burst_index, 'relativeBurstID': burst_id}, 'polarization': polarization, 'url': f'https://foo.com/{slc_name}/baz.zip', - # 'startTime': '2020-06-04T02:23:13.963847Z', 'pathNumber': path_number, } )