diff --git a/src/rtc/rtc_s1.py b/src/rtc/rtc_s1.py index 7be98e6..78f6384 100755 --- a/src/rtc/rtc_s1.py +++ b/src/rtc/rtc_s1.py @@ -615,6 +615,8 @@ def run_parallel(cfg: RunConfig, logfile_path, flag_logger_full_format): logger.info(f'Processing burst: {burst_id} ({burst_index+1}/' f'{n_bursts})') + burst_output_file_list = [] + pol_list = list(burst_pol_dict.keys()) burst = burst_pol_dict[pol_list[0]] geogrid = cfg.geogrids[burst_id] @@ -683,7 +685,7 @@ def run_parallel(cfg: RunConfig, logfile_path, flag_logger_full_format): if flag_bursts_secondary_files_are_temporary: temp_files_list.append(nlooks_file) else: - output_file_list.append(nlooks_file) + burst_output_file_list.append(nlooks_file) else: nlooks_file = None @@ -700,7 +702,7 @@ def run_parallel(cfg: RunConfig, logfile_path, flag_logger_full_format): if flag_bursts_secondary_files_are_temporary: temp_files_list.append(rtc_anf_file) else: - output_file_list.append(rtc_anf_file) + burst_output_file_list.append(rtc_anf_file) else: rtc_anf_file = None @@ -720,7 +722,7 @@ def run_parallel(cfg: RunConfig, logfile_path, flag_logger_full_format): if flag_bursts_secondary_files_are_temporary: temp_files_list.append(rtc_anf_gamma0_to_sigma0_file) else: - output_file_list.append(rtc_anf_gamma0_to_sigma0_file) + burst_output_file_list.append(rtc_anf_gamma0_to_sigma0_file) else: rtc_anf_gamma0_to_sigma0_file = None @@ -746,7 +748,7 @@ def run_parallel(cfg: RunConfig, logfile_path, flag_logger_full_format): temp_files_list.append(layover_shadow_mask_file) layover_shadow_mask_file = None else: - output_file_list.append(layover_shadow_mask_file) + burst_output_file_list.append(layover_shadow_mask_file) logger.info(f'file saved: {layover_shadow_mask_file}') # Take the layover shadow mask from HDF5 file if not exists @@ -796,7 +798,7 @@ def run_parallel(cfg: RunConfig, logfile_path, flag_logger_full_format): temp_files_list.append(geo_burst_vrt_filename) if not flag_bursts_files_are_temporary: - output_file_list += output_burst_imagery_list + burst_output_file_list += output_burst_imagery_list else: temp_files_list += output_burst_imagery_list @@ -834,14 +836,14 @@ def run_parallel(cfg: RunConfig, logfile_path, flag_logger_full_format): if flag_bursts_secondary_files_are_temporary: temp_files_list.append(current_file) else: - output_file_list.append(current_file) + burst_output_file_list.append(current_file) # Browse image (burst) using static layers if (flag_save_browse and product_type == STATIC_LAYERS_PRODUCT_TYPE): browse_image_filename = \ os.path.join(output_dir_bursts, f'{burst_product_id}.png') - output_file_list.append(browse_image_filename) + burst_output_file_list.append(browse_image_filename) # Create burst HDF5 if (save_hdf5_metadata and save_bursts): @@ -850,7 +852,7 @@ def run_parallel(cfg: RunConfig, logfile_path, flag_logger_full_format): output_hdf5_file_burst = os.path.join( hdf5_file_output_dir, f'{burst_product_id}.{hdf5_file_extension}') - output_file_list.append(output_hdf5_file_burst) + burst_output_file_list.append(output_hdf5_file_burst) # Create mosaic HDF5 if (save_hdf5_metadata and save_mosaics @@ -864,7 +866,7 @@ def run_parallel(cfg: RunConfig, logfile_path, flag_logger_full_format): product_type != STATIC_LAYERS_PRODUCT_TYPE): browse_image_filename = \ os.path.join(output_dir_bursts, f'{burst_product_id}.png') - output_file_list.append(browse_image_filename) + burst_output_file_list.append(browse_image_filename) # Save mosaic metadata for later use if (save_mosaics and burst_index == 0): @@ -875,6 +877,8 @@ def run_parallel(cfg: RunConfig, logfile_path, flag_logger_full_format): all_metadata_dict_to_geotiff_metadata_dict( mosaic_metadata_dict) + output_file_list += burst_output_file_list + t_burst_end = time.time() logger.info( f'elapsed time (burst): {t_burst_end - t_burst_start}') diff --git a/src/rtc/rtc_s1_single_job.py b/src/rtc/rtc_s1_single_job.py index 261a03e..9e69503 100755 --- a/src/rtc/rtc_s1_single_job.py +++ b/src/rtc/rtc_s1_single_job.py @@ -1443,6 +1443,8 @@ def run_single_job(cfg: RunConfig): logger.info(f'Processing burst: {burst_id} ({burst_index+1}/' f'{n_bursts})') + burst_output_file_list = [] + geogrid = cfg.geogrids[burst_id] pol_list = list(burst_pol_dict.keys()) burst = burst_pol_dict[pol_list[0]] @@ -1586,7 +1588,7 @@ def run_single_job(cfg: RunConfig): if flag_bursts_secondary_files_are_temporary: temp_files_list.append(nlooks_file) else: - output_file_list.append(nlooks_file) + burst_output_file_list.append(nlooks_file) else: nlooks_file = None @@ -1598,7 +1600,7 @@ def run_single_job(cfg: RunConfig): if flag_bursts_secondary_files_are_temporary: temp_files_list.append(rtc_anf_file) else: - output_file_list.append(rtc_anf_file) + burst_output_file_list.append(rtc_anf_file) else: rtc_anf_file = None @@ -1612,7 +1614,7 @@ def run_single_job(cfg: RunConfig): if flag_bursts_secondary_files_are_temporary: temp_files_list.append(rtc_anf_gamma0_to_sigma0_file) else: - output_file_list.append(rtc_anf_gamma0_to_sigma0_file) + burst_output_file_list.append(rtc_anf_gamma0_to_sigma0_file) else: rtc_anf_gamma0_to_sigma0_file = None @@ -1715,7 +1717,7 @@ def run_single_job(cfg: RunConfig): if flag_layover_shadow_mask_is_temporary: temp_files_list.append(layover_shadow_mask_file) else: - output_file_list.append(layover_shadow_mask_file) + burst_output_file_list.append(layover_shadow_mask_file) logger.info(f'file saved: {layover_shadow_mask_file}') if save_mask: output_metadata_dict[LAYER_NAME_LAYOVER_SHADOW_MASK][1].append( @@ -1858,7 +1860,7 @@ def run_single_job(cfg: RunConfig): output_burst_imagery_list, output_raster_format, logger) - output_file_list += output_burst_imagery_list + burst_output_file_list += output_burst_imagery_list if save_nlooks: if flag_process: @@ -1913,7 +1915,7 @@ def run_single_job(cfg: RunConfig): # files are temporary temp_files_list += radar_grid_file_dict_filenames else: - output_file_list += radar_grid_file_dict_filenames + burst_output_file_list += radar_grid_file_dict_filenames # Save browse image (burst) using static layers if (flag_save_browse and @@ -1925,7 +1927,7 @@ def run_single_job(cfg: RunConfig): browse_image_burst_height, browse_image_burst_width, temp_files_list, burst_scratch_path, logger) - output_file_list.append(browse_image_filename) + burst_output_file_list.append(browse_image_filename) # Create burst HDF5 if (flag_process and save_hdf5_metadata and save_bursts): @@ -1943,7 +1945,7 @@ def run_single_job(cfg: RunConfig): layover_shadow_mask_file, radar_grid_file_dict, save_imagery=save_imagery_as_hdf5, save_secondary_layers=save_secondary_layers_as_hdf5) - output_file_list.append(output_hdf5_file_burst) + burst_output_file_list.append(output_hdf5_file_burst) # Save browse image (burst) if (flag_process and flag_save_browse and @@ -1955,7 +1957,7 @@ def run_single_job(cfg: RunConfig): pol_list, browse_image_burst_height, browse_image_burst_width, temp_files_list, burst_scratch_path, logger) - output_file_list.append(browse_image_filename) + burst_output_file_list.append(browse_image_filename) # Append metadata to burst GeoTIFFs if (flag_process and (not flag_bursts_files_are_temporary or @@ -1965,7 +1967,7 @@ def run_single_job(cfg: RunConfig): is_mosaic=False) geotiff_metadata_dict = all_metadata_dict_to_geotiff_metadata_dict( metadata_dict) - for current_file in output_file_list: + for current_file in burst_output_file_list: if not current_file.endswith('.tif'): continue append_metadata_to_geotiff_file(current_file, @@ -1988,6 +1990,8 @@ def run_single_job(cfg: RunConfig): all_metadata_dict_to_geotiff_metadata_dict( mosaic_metadata_dict) + output_file_list += burst_output_file_list + t_burst_end = time.time() logger.info( f'elapsed time (burst): {t_burst_end - t_burst_start}')