From 03d0b9da16664c3e5fa238a5298bea6457a5c832 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 6 Jul 2023 23:26:36 +0000 Subject: [PATCH 01/16] update coverage image --- images/coverage.svg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/images/coverage.svg b/images/coverage.svg index 9f708fe5..dd6df127 100644 --- a/images/coverage.svg +++ b/images/coverage.svg @@ -15,7 +15,7 @@ coverage coverage - 60% - 60% + 61% + 61% From a872cbc03771e9e97bce859e541d33ae37d95e53 Mon Sep 17 00:00:00 2001 From: jiangzhu Date: Fri, 7 Jul 2023 11:41:58 -0800 Subject: [PATCH 02/16] use native dem (30m) for the calculation, resample the product with pixel_size determined by looks --- src/hyp3_isce2/insar_tops_burst.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/hyp3_isce2/insar_tops_burst.py b/src/hyp3_isce2/insar_tops_burst.py index bde0321c..6e05f329 100644 --- a/src/hyp3_isce2/insar_tops_burst.py +++ b/src/hyp3_isce2/insar_tops_burst.py @@ -154,7 +154,8 @@ def make_parameter_file( azimuth_looks: int, range_looks: int, dem_name: str = 'GLO_30', - dem_resolution: int = 30 + dem_resolution: int = 30, + pixel_size: float = 30. ) -> None: """Create a parameter file for the output product @@ -167,6 +168,7 @@ def make_parameter_file( range_looks: Number of range looks dem_name: Name of the DEM that is use dem_resolution: Resolution of the DEM + pixel_size: pixel spacing of output product returns: None @@ -242,6 +244,7 @@ def make_parameter_file( 'Azimuth bandpass filter: no\n', f'DEM source: {dem_name}\n', f'DEM resolution (m): {dem_resolution}\n', + f'Pixel Size (m): {pixel_size}\n', f'Unwrapping type: {unwrapper_type}\n', 'Speckle filter: yes\n' ] @@ -252,7 +255,7 @@ def make_parameter_file( outfile.write(output_string) -def translate_outputs(isce_output_dir: Path, product_name: str): +def translate_outputs(isce_output_dir: Path, product_name: str, pixel_size: float = 30.): """Translate ISCE outputs to a standard GTiff format with a UTM projection Args: @@ -347,11 +350,19 @@ def translate_outputs(isce_output_dir: Path, product_name: str): file, dstSRS=f'epsg:{epsg}', creationOptions=['TILED=YES', 'COMPRESS=LZW', 'NUM_THREADS=ALL_CPUS'], + xRes=pixel_size, + yRes=pixel_size, + targetAlignedPixels=True ) make_browse_image(f'{product_name}/{product_name}_unw_phase.tif', f'{product_name}/{product_name}_unw_phase.png') +def get_pixel_size(choice): + choices = {'20x4': 80.0, '10x2': 40.0, '5x1': 20.0} + return choices[choice] + + def main(): """HyP3 entrypoint for the burst TOPS workflow""" parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) @@ -371,6 +382,8 @@ def main(): args = parser.parse_args() + pixel_size = get_pixel_size(args.looks) + args.granules = [item for sublist in args.granules for item in sublist] if len(args.granules) != 2: parser.error('Must provide exactly two granules') @@ -398,7 +411,7 @@ def main(): product_dir = Path(product_name) product_dir.mkdir(parents=True, exist_ok=True) - translate_outputs(isce_output_dir, product_name) + translate_outputs(isce_output_dir, product_name, pixel_size=pixel_size) make_readme( product_dir=product_dir, @@ -414,7 +427,8 @@ def main(): secondary_scene=secondary_scene, azimuth_looks=azimuth_looks, range_looks=range_looks, - swath_number=swath_number + swath_number=swath_number, + pixel_size=pixel_size ) output_zip = make_archive(base_name=product_name, format='zip', base_dir=product_name) From 588c091082f49b55c949de048031df1399825f10 Mon Sep 17 00:00:00 2001 From: jiangzhu Date: Fri, 7 Jul 2023 12:17:48 -0800 Subject: [PATCH 03/16] update the CAHNGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9f92ad6..7e695bd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/) and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.5.1] +### Changed +* Pixel size of output products is set to be the same resolution as Geocoding DEM ## [0.5.0] ### Changed From d28638311e11a66eb06b23ded1a28b281e21a1d0 Mon Sep 17 00:00:00 2001 From: jiangzhu Date: Fri, 7 Jul 2023 12:59:43 -0800 Subject: [PATCH 04/16] do not include pixel_size in the txt file --- src/hyp3_isce2/insar_tops_burst.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/hyp3_isce2/insar_tops_burst.py b/src/hyp3_isce2/insar_tops_burst.py index 6e05f329..e1d9bcc2 100644 --- a/src/hyp3_isce2/insar_tops_burst.py +++ b/src/hyp3_isce2/insar_tops_burst.py @@ -155,7 +155,6 @@ def make_parameter_file( range_looks: int, dem_name: str = 'GLO_30', dem_resolution: int = 30, - pixel_size: float = 30. ) -> None: """Create a parameter file for the output product @@ -244,7 +243,6 @@ def make_parameter_file( 'Azimuth bandpass filter: no\n', f'DEM source: {dem_name}\n', f'DEM resolution (m): {dem_resolution}\n', - f'Pixel Size (m): {pixel_size}\n', f'Unwrapping type: {unwrapper_type}\n', 'Speckle filter: yes\n' ] @@ -382,8 +380,6 @@ def main(): args = parser.parse_args() - pixel_size = get_pixel_size(args.looks) - args.granules = [item for sublist in args.granules for item in sublist] if len(args.granules) != 2: parser.error('Must provide exactly two granules') @@ -411,6 +407,7 @@ def main(): product_dir = Path(product_name) product_dir.mkdir(parents=True, exist_ok=True) + pixel_size = get_pixel_size(args.looks) translate_outputs(isce_output_dir, product_name, pixel_size=pixel_size) make_readme( From 22532309381c2648101cfab8446b65ed27efc33b Mon Sep 17 00:00:00 2001 From: jiangzhu Date: Mon, 10 Jul 2023 11:15:27 -0800 Subject: [PATCH 05/16] do not provide dst_resolution argument for stich process, let stich use the native tiled dem files --- src/hyp3_isce2/dem.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/hyp3_isce2/dem.py b/src/hyp3_isce2/dem.py index 3b2f5cbe..f7fc56b7 100644 --- a/src/hyp3_isce2/dem.py +++ b/src/hyp3_isce2/dem.py @@ -23,8 +23,6 @@ from lxml import etree from shapely.geometry import box -DEM_RESOLUTION = 0.0002777777777777777775 - def tag_dem_xml_as_ellipsoidal(dem_path: Path) -> str: xml_path = str(dem_path) + '.xml' @@ -85,8 +83,6 @@ def download_dem_for_isce2( dst_ellipsoidal_height=True, dst_area_or_point='Point', n_threads_downloading=5, - # ensures square resolution - dst_resolution=DEM_RESOLUTION, ) dem_array[np.isnan(dem_array)] = 0. From fcf39ebd16f6aef5fb43f23f7ed0be04b776d188 Mon Sep 17 00:00:00 2001 From: jiangzhu Date: Mon, 10 Jul 2023 11:19:16 -0800 Subject: [PATCH 06/16] update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e695bd3..e802273d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/) and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.5.1] +## [0.6.0] ### Changed * Pixel size of output products is set to be the same resolution as Geocoding DEM From 5f309e3198a6bcfde3c4ec0ffeccfc7a6dc2e71a Mon Sep 17 00:00:00 2001 From: jiangzhu Date: Mon, 10 Jul 2023 11:26:44 -0800 Subject: [PATCH 07/16] modify test_dem.py to delete a constant which is not used anymore --- tests/test_dem.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_dem.py b/tests/test_dem.py index 699660ee..e8efb2b2 100644 --- a/tests/test_dem.py +++ b/tests/test_dem.py @@ -52,7 +52,6 @@ def test_download_dem_for_isce2(tmp_path): dst_ellipsoidal_height=True, dst_area_or_point='Point', n_threads_downloading=5, - dst_resolution=dem.DEM_RESOLUTION, ) root = etree.parse(str(dem_path) + '.xml').getroot() From 37909c4b124a5e077fc7ebdfa80f2b7beb602b95 Mon Sep 17 00:00:00 2001 From: jiangzhu Date: Mon, 10 Jul 2023 11:31:23 -0800 Subject: [PATCH 08/16] do not output pixel spacing in the product txt file --- src/hyp3_isce2/insar_tops_burst.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/hyp3_isce2/insar_tops_burst.py b/src/hyp3_isce2/insar_tops_burst.py index e1d9bcc2..cdf28ab9 100644 --- a/src/hyp3_isce2/insar_tops_burst.py +++ b/src/hyp3_isce2/insar_tops_burst.py @@ -167,7 +167,6 @@ def make_parameter_file( range_looks: Number of range looks dem_name: Name of the DEM that is use dem_resolution: Resolution of the DEM - pixel_size: pixel spacing of output product returns: None @@ -425,7 +424,6 @@ def main(): azimuth_looks=azimuth_looks, range_looks=range_looks, swath_number=swath_number, - pixel_size=pixel_size ) output_zip = make_archive(base_name=product_name, format='zip', base_dir=product_name) From da376332d981545b29ec17694d901c3a4343a1d6 Mon Sep 17 00:00:00 2001 From: cirrusasf <62269400+cirrusasf@users.noreply.github.com> Date: Mon, 10 Jul 2023 15:28:35 -0800 Subject: [PATCH 09/16] Update CHANGELOG.md Co-authored-by: Andrew Johnston --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e802273d..a8544beb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [0.6.0] ### Changed -* Pixel size of output products is set to be the same resolution as Geocoding DEM +* Pixel sizes of output GeoTIFFs now better reflect their resolution: 80m for 20x4 looks, 40m for 10x2 looks, and 20m for 5x1 looks. ## [0.5.0] ### Changed From f66b0aa177f0bf8b755731e5305f7f9ad8686221 Mon Sep 17 00:00:00 2001 From: hjkristenson Date: Tue, 11 Jul 2023 14:57:52 -0800 Subject: [PATCH 10/16] add draft text about water masking to product readme --- .../templates/insar_burst/readme.md.txt.j2 | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 b/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 index ea4d2052..828cdfaa 100644 --- a/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 +++ b/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 @@ -139,7 +139,8 @@ The files generated in this process include: 5. Parameter Documentation (Text File) 6. Look Vector Maps (GeoTIFFs) 7. DEM used to process the data (GeoTIFF) -8. README.md.txt (Text File) +8. Water Mask (GeoTIFF) +9. README.md.txt (Text File) *See below for detailed descriptions of each of the product files.* @@ -196,6 +197,10 @@ unexpected/invalid phase unwrapping results over land. Masking areas of water be used to mitigate this issue, but ISCE2 does not currently support this functionality. Thus, use caution when interpreting unwrapped phase results close to surface water. +There is the option to apply a water mask *after* phase unwrapping. While it doesn't correct for phase unwrapping +errors over water, it can make the interferograms less visually distracting. This product +{{ "has" if water_mask_applied else "has not" }} had a water mask applied. + No atmospheric correction has been applied to this interferogram. While SAR signals can penetrate clouds, atmospheric conditions can delay the transmission of the signal, resulting in phase differences between acquisition that can look like surface deformation signals. Use caution when interpreting single interferograms. In some cases, @@ -258,6 +263,27 @@ Defence and Space, and edited to flatten water bodies, provide consistent flow o shore/coastlines and special features. For an overview of the dataset, visit https://spacedata.copernicus.eu/collections/copernicus-digital-elevation-model. +---------------- +## 8. Water Mask + +The water mask identifies coastal waters and major inland waterbodies. These areas are assigned a pixel value of 0. +All remaining pixels (land, islands in large lakes, small inland waterbodies, and landfast Antarctic ice) have +a value of 1. The water mask is stored as an 8-bit unsigned integer GeoTIFF file and +[TODO: determine if we are keeping "is always included in the product package", or if it's only included if the masking option is invoked]. + +The water mask is generated using the Global Self-consistent, Hierarchical, High-resolution Geography Database (GSHHG) +dataset (https://www.ngdc.noaa.gov/mgg/shorelines). To generate the global mask, we combined the full-resolution +L1 and L5 datasets, and removed the L2 dataset minus the L3 dataset. The L1 dataset is the boundary between land +and ocean, excluding Antarctica, and the L5 dataset is the boundary between Antarctic ice and ocean. The L2 +dataset is the boundary between lakes and land, and the L3 dataset is the boundary between islands and the +lakes they are within. The GSHHG dataset was last updated in 2017, so there may be discrepancies where +shorelines have changed. + +ISCE2 currently only supports applying a water mask to an interferogram *after* phase unwrapping. Note that +applying the mask after phase unwrapping does not prevent unwrapping errors caused by the inclusion of water pixels +as valid data during the phase unwrapping process. When phase unwrapping occurs over large expanses of water, it can +lead to unexpected deformation signals or phase jumps in the unwrapped outputs, and the current masking approach +does not correct for these impacts. ************* # Burst InSAR Processing # From 8d6e1f4e4efe5f5bb7addfb4ab95ec59292c2d65 Mon Sep 17 00:00:00 2001 From: jiangzhu Date: Tue, 11 Jul 2023 16:28:47 -0800 Subject: [PATCH 11/16] modify the code, add water_mask in readme, update the CAHNGELOG.md --- CHANGELOG.md | 3 +++ src/hyp3_isce2/insar_tops_burst.py | 6 +++--- .../metadata/templates/insar_burst/readme.md.txt.j2 | 11 ++++++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9f92ad6..9b48a3d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/) and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.6.1] +### Added +* `apply_water_mask` optional argument to apply water mask in the output geotiff files ## [0.5.0] ### Changed diff --git a/src/hyp3_isce2/insar_tops_burst.py b/src/hyp3_isce2/insar_tops_burst.py index bd9a977a..9cf1abd6 100644 --- a/src/hyp3_isce2/insar_tops_burst.py +++ b/src/hyp3_isce2/insar_tops_burst.py @@ -351,8 +351,6 @@ def translate_outputs(isce_output_dir: Path, product_name: str): creationOptions=['TILED=YES', 'COMPRESS=LZW', 'NUM_THREADS=ALL_CPUS'], ) - make_browse_image(f'{product_name}/{product_name}_unw_phase.tif', f'{product_name}/{product_name}_unw_phase.png') - def main(): """HyP3 entrypoint for the burst TOPS workflow""" @@ -410,7 +408,7 @@ def main(): if args.apply_water_mask: unwrapped_phase = f'{product_name}/{product_name}_unw_phase.tif' - wrapped_phase = f'{product_name}/{product_name}_wrapped_phase.tif' + wrapped_phase = f'{product_name}/{product_name}_wrapped_phase.tif' water_mask = f'{product_name}/{product_name}_water_mask.tif' create_water_mask(wrapped_phase, water_mask) for geotiff in [wrapped_phase, unwrapped_phase]: @@ -425,6 +423,8 @@ def main(): ) subprocess.check_call(cmd.split(' ')) + make_browse_image(f'{product_name}/{product_name}_unw_phase.tif', f'{product_name}/{product_name}_unw_phase.png') + make_readme( product_dir=product_dir, product_name=product_name, diff --git a/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 b/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 index ea4d2052..7a83f5cb 100644 --- a/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 +++ b/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 @@ -139,7 +139,9 @@ The files generated in this process include: 5. Parameter Documentation (Text File) 6. Look Vector Maps (GeoTIFFs) 7. DEM used to process the data (GeoTIFF) -8. README.md.txt (Text File) +8. Water Mask (GeoTIFF, optional) +9. README.md.txt (Text File) + *See below for detailed descriptions of each of the product files.* @@ -258,6 +260,13 @@ Defence and Space, and edited to flatten water bodies, provide consistent flow o shore/coastlines and special features. For an overview of the dataset, visit https://spacedata.copernicus.eu/collections/copernicus-digital-elevation-model. +## 8. Water Mask + +This is the water mask geotiff applied to mask out the water pixels in the output. The water pixels in the final product +is presented as nodata. This layer is available when optional apply_water_mask is True. +The water mask is assembled from GSHHG v2.3.7 Levels 1, 2, 3, and 5 at full resolution. +To learn more, visit https://www.soest.hawaii.edu/pwessel/gshhg/. Shoreline data is unbuffered and pixel values of 1 +indicate land touches the pixel and 0 indicates there is no land in the pixel. ************* # Burst InSAR Processing # From 8d26b4ea60c541a7058b814160b77d5d0f4b37cd Mon Sep 17 00:00:00 2001 From: jiangzhu Date: Tue, 11 Jul 2023 16:48:19 -0800 Subject: [PATCH 12/16] modify the code style --- tests/test_water_mask.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_water_mask.py b/tests/test_water_mask.py index 17fa23f5..b684f04e 100644 --- a/tests/test_water_mask.py +++ b/tests/test_water_mask.py @@ -91,4 +91,4 @@ def test_create_water_mask_with_water_and_land(tmp_path, test_data_dir): [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ]) assert np.array_equal(data, expected) - del ds \ No newline at end of file + del ds From 3c3923f8f04a6d164e02a787885728b9d0c53f9b Mon Sep 17 00:00:00 2001 From: jiangzhu Date: Wed, 12 Jul 2023 08:21:22 -0800 Subject: [PATCH 13/16] modify readme.md.txt.j2 --- src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 b/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 index 44a05fcb..828cdfaa 100644 --- a/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 +++ b/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 @@ -284,7 +284,6 @@ applying the mask after phase unwrapping does not prevent unwrapping errors caus as valid data during the phase unwrapping process. When phase unwrapping occurs over large expanses of water, it can lead to unexpected deformation signals or phase jumps in the unwrapped outputs, and the current masking approach does not correct for these impacts. ->>>>>>> origin/water-mask ************* # Burst InSAR Processing # From 17a20c4371e8da2d8fd646e9dba69db0d1d41111 Mon Sep 17 00:00:00 2001 From: hjkristenson Date: Wed, 12 Jul 2023 10:03:07 -0800 Subject: [PATCH 14/16] edit readme to reflect new water masking behavior --- .../metadata/templates/insar_burst/readme.md.txt.j2 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 b/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 index 828cdfaa..2ae7be1e 100644 --- a/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 +++ b/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 @@ -268,8 +268,12 @@ https://spacedata.copernicus.eu/collections/copernicus-digital-elevation-model. The water mask identifies coastal waters and major inland waterbodies. These areas are assigned a pixel value of 0. All remaining pixels (land, islands in large lakes, small inland waterbodies, and landfast Antarctic ice) have -a value of 1. The water mask is stored as an 8-bit unsigned integer GeoTIFF file and -[TODO: determine if we are keeping "is always included in the product package", or if it's only included if the masking option is invoked]. +a value of 1. The water mask is stored as an 8-bit unsigned integer GeoTIFF file and is always included in the product +package. + +Users can choose to apply the water mask to output products, which affects the wrapped interferogram, +the unwrapped interferogram, and the browse images. It returns NoData values over the areas covered by the water mask +in these output images. This product {{ "has" if water_mask_applied else "has not" }} had the water mask applied. The water mask is generated using the Global Self-consistent, Hierarchical, High-resolution Geography Database (GSHHG) dataset (https://www.ngdc.noaa.gov/mgg/shorelines). To generate the global mask, we combined the full-resolution From f5c7373406aa74543668e98152ef72ec6ace0b23 Mon Sep 17 00:00:00 2001 From: jiangzhu Date: Wed, 12 Jul 2023 10:37:35 -0800 Subject: [PATCH 15/16] include watermask file no matter if apply_water_mask is True or False --- src/hyp3_isce2/insar_tops_burst.py | 18 +++++++++++------- .../templates/insar_burst/readme.md.txt.j2 | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/hyp3_isce2/insar_tops_burst.py b/src/hyp3_isce2/insar_tops_burst.py index 9cf1abd6..33b93b39 100644 --- a/src/hyp3_isce2/insar_tops_burst.py +++ b/src/hyp3_isce2/insar_tops_burst.py @@ -119,7 +119,8 @@ def make_readme( reference_scene: str, secondary_scene: str, range_looks: int, - azimuth_looks: int) -> None: + azimuth_looks: int, + apply_water_mask: bool) -> None: wrapped_phase_path = product_dir / f'{product_name}_wrapped_phase.tif' info = gdal.Info(str(wrapped_phase_path), format='json') @@ -140,6 +141,7 @@ def make_readme( 'secondary_granule_date': datetime.strptime(secondary_granule_datetime_str, '%Y%m%dT%H%M%S'), 'dem_name': 'GLO-30', 'dem_pixel_spacing': '30 m', + 'apply_water_mask': apply_water_mask } content = hyp3_isce2.metadata.util.render_template('insar_burst/readme.md.txt.j2', payload) @@ -406,11 +408,12 @@ def main(): translate_outputs(isce_output_dir, product_name) + unwrapped_phase = f'{product_name}/{product_name}_unw_phase.tif' + wrapped_phase = f'{product_name}/{product_name}_wrapped_phase.tif' + water_mask = f'{product_name}/{product_name}_water_mask.tif' + create_water_mask(wrapped_phase, water_mask) + if args.apply_water_mask: - unwrapped_phase = f'{product_name}/{product_name}_unw_phase.tif' - wrapped_phase = f'{product_name}/{product_name}_wrapped_phase.tif' - water_mask = f'{product_name}/{product_name}_water_mask.tif' - create_water_mask(wrapped_phase, water_mask) for geotiff in [wrapped_phase, unwrapped_phase]: cmd = ( 'gdal_calc.py ' @@ -423,7 +426,7 @@ def main(): ) subprocess.check_call(cmd.split(' ')) - make_browse_image(f'{product_name}/{product_name}_unw_phase.tif', f'{product_name}/{product_name}_unw_phase.png') + make_browse_image(unwrapped_phase, f'{product_name}/{product_name}_unw_phase.png') make_readme( product_dir=product_dir, @@ -431,7 +434,8 @@ def main(): reference_scene=reference_scene, secondary_scene=secondary_scene, range_looks=range_looks, - azimuth_looks=azimuth_looks + azimuth_looks=azimuth_looks, + apply_water_mask=args.apply_water_mask ) make_parameter_file( Path(f'{product_name}/{product_name}.txt'), diff --git a/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 b/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 index 828cdfaa..c46aa4dc 100644 --- a/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 +++ b/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 @@ -199,7 +199,7 @@ interpreting unwrapped phase results close to surface water. There is the option to apply a water mask *after* phase unwrapping. While it doesn't correct for phase unwrapping errors over water, it can make the interferograms less visually distracting. This product -{{ "has" if water_mask_applied else "has not" }} had a water mask applied. +{{ "has" if apply_water_mask else "has not" }} had a water mask applied. No atmospheric correction has been applied to this interferogram. While SAR signals can penetrate clouds, atmospheric conditions can delay the transmission of the signal, resulting in phase differences between acquisition From 0f2c58c573b79856d0e99afb103f6e6b5f7d542f Mon Sep 17 00:00:00 2001 From: hjkristenson Date: Wed, 12 Jul 2023 10:49:57 -0800 Subject: [PATCH 16/16] pull in readme updates and change all water mask variable references --- src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 b/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 index 5ff79e29..a240d1e9 100644 --- a/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 +++ b/src/hyp3_isce2/metadata/templates/insar_burst/readme.md.txt.j2 @@ -273,7 +273,7 @@ package. Users can choose to apply the water mask to output products, which affects the wrapped interferogram, the unwrapped interferogram, and the browse images. It returns NoData values over the areas covered by the water mask -in these output images. This product {{ "has" if water_mask_applied else "has not" }} had the water mask applied. +in these output images. This product {{ "has" if apply_water_mask else "has not" }} had the water mask applied. The water mask is generated using the Global Self-consistent, Hierarchical, High-resolution Geography Database (GSHHG) dataset (https://www.ngdc.noaa.gov/mgg/shorelines). To generate the global mask, we combined the full-resolution