diff --git a/post_pro/merge_tif.py b/post_pro/merge_tif.py index e1e8b79..de6081f 100644 --- a/post_pro/merge_tif.py +++ b/post_pro/merge_tif.py @@ -102,7 +102,8 @@ class MergeTif: """合并指定产品的所有网格""" product_name = product_info['name'] product_path = product_info['path'] - filename = product_info['filename'] + filename_original = product_info['filename'] + filename = filename_original.replace(".original", "") self.logger.info(f"开始合并{product_name}") @@ -112,6 +113,13 @@ class MergeTif: try: for grid_id, points in grid_points.items(): + grid_tif_original = os.path.join( + self.output_dir, + f"grid_{grid_id[0]}_{grid_id[1]}", + "project", + product_path, + filename_original + ) grid_tif = os.path.join( self.output_dir, f"grid_{grid_id[0]}_{grid_id[1]}", @@ -119,30 +127,30 @@ class MergeTif: product_path, filename ) - - if not os.path.exists(grid_tif): + if os.path.exists(grid_tif_original) and os.path.exists(grid_tif): + self.logger.info( + f"网格 ({grid_id[0]},{grid_id[1]}) 的{product_name}存在: {grid_tif_original, grid_tif}") + # 如果文件大于600MB,则不使用original文件 + file_size_mb_original = os.path.getsize( + grid_tif_original) / (1024 * 1024) # 转换为MB + if file_size_mb_original > 600: + to_merge_tif = grid_tif + else: + to_merge_tif = grid_tif_original + elif os.path.exists(grid_tif_original) and not os.path.exists(grid_tif): + to_merge_tif = grid_tif_original + elif not os.path.exists(grid_tif_original) and os.path.exists(grid_tif): + to_merge_tif = grid_tif + else: self.logger.warning( - f"网格 ({grid_id[0]},{grid_id[1]}) 的{product_name}不存在: {grid_tif}") + f"网格 ({grid_id[0]},{grid_id[1]}) 的{product_name}不存在: {grid_tif_original, grid_tif}") continue - # 如果文件大于600MB,则不使用original文件 - file_size_mb = os.path.getsize( - grid_tif) / (1024 * 1024) # 转换为MB - if file_size_mb > 600: - filename = filename.replace(".original", "") - grid_tif = os.path.join( - self.output_dir, - f"grid_{grid_id[0]}_{grid_id[1]}", - "project", - product_path, - filename - ) - if input_tif1 is None: - input_tif1 = grid_tif + input_tif1 = to_merge_tif self.logger.info(f"设置第一个输入{product_name}: {input_tif1}") else: - input_tif2 = grid_tif + input_tif2 = to_merge_tif # 生成带时间戳的临时输出文件名 temp_output = os.path.join( self.output_dir, diff --git a/utils/odm_monitor.py b/utils/odm_monitor.py index 4782423..5b98a12 100644 --- a/utils/odm_monitor.py +++ b/utils/odm_monitor.py @@ -58,8 +58,8 @@ class ODMProcessMonitor: return False # 检查正射影像 - if not self._check_orthophoto(project_dir): - return False + # if not self._check_orthophoto(project_dir): + # return False # TODO: 添加点云和实景三维的质量检查