diff --git a/CHANGELOG.md b/CHANGELOG.md index 4142bf5c..62cc6c79 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. +* 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 ae71429c..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:%S.%fZ') 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/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) diff --git a/tests/test_merge_tops_bursts.py b/tests/test_merge_tops_bursts.py index 54ff6bb0..c2b8bfec 100644 --- a/tests/test_merge_tops_bursts.py +++ b/tests/test_merge_tops_bursts.py @@ -27,13 +27,15 @@ 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', 'pathNumber': path_number, } )