From 207194f67bbfc8571239372b16228a6124de22bd Mon Sep 17 00:00:00 2001 From: Scott Staniewicz Date: Mon, 2 Dec 2024 21:43:17 -0500 Subject: [PATCH] 'Use `nearest` resampling for merging temporal coherence (#508) Closes #144 The `lanczos` filter was leading to pixels above 1 in the merged temporal coherence image, despite the max being 1.0 per burst. This is also likely the reason for negative coherences, though we can reopen if any new instances are spotted (hasn't been seen in a year) --- src/dolphin/workflows/stitching_bursts.py | 34 +++++++++++++---------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/dolphin/workflows/stitching_bursts.py b/src/dolphin/workflows/stitching_bursts.py index eff0bdfb..f93aef3c 100644 --- a/src/dolphin/workflows/stitching_bursts.py +++ b/src/dolphin/workflows/stitching_bursts.py @@ -132,6 +132,7 @@ def run( temp_coh_file_list, outfile=stitched_temp_coh_file, driver="GTiff", + resample_alg="nearest", out_bounds=out_bounds, out_bounds_epsg=output_options.bounds_epsg, ) @@ -157,28 +158,33 @@ def run( amp_dispersion_list, outfile=stitched_amp_disp_file, driver="GTiff", + resample_alg="nearest", out_bounds=out_bounds, out_bounds_epsg=output_options.bounds_epsg, ) repack_raster(stitched_temp_coh_file, keep_bits=10) stitched_shp_count_file = stitched_ifg_dir / "shp_counts.tif" - stitching.merge_images( - shp_count_file_list, - outfile=stitched_shp_count_file, - driver="GTiff", - out_bounds=out_bounds, - out_bounds_epsg=output_options.bounds_epsg, - ) + if not stitched_shp_count_file.exists(): + stitching.merge_images( + shp_count_file_list, + outfile=stitched_shp_count_file, + driver="GTiff", + resample_alg="nearest", + out_bounds=out_bounds, + out_bounds_epsg=output_options.bounds_epsg, + ) stitched_similarity_file = stitched_ifg_dir / "similarity.tif" - stitching.merge_images( - similarity_file_list, - outfile=stitched_similarity_file, - driver="GTiff", - out_bounds=out_bounds, - out_bounds_epsg=output_options.bounds_epsg, - ) + if not stitched_similarity_file.exists(): + stitching.merge_images( + similarity_file_list, + outfile=stitched_similarity_file, + driver="GTiff", + resample_alg="nearest", + out_bounds=out_bounds, + out_bounds_epsg=output_options.bounds_epsg, + ) if output_options.add_overviews: logger.info("Creating overviews for stitched images")