更新merge_tif
This commit is contained in:
parent
ba54dd107c
commit
cb66af1436
@ -102,7 +102,8 @@ class MergeTif:
|
|||||||
"""合并指定产品的所有网格"""
|
"""合并指定产品的所有网格"""
|
||||||
product_name = product_info['name']
|
product_name = product_info['name']
|
||||||
product_path = product_info['path']
|
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}")
|
self.logger.info(f"开始合并{product_name}")
|
||||||
|
|
||||||
@ -112,6 +113,13 @@ class MergeTif:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
for grid_id, points in grid_points.items():
|
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(
|
grid_tif = os.path.join(
|
||||||
self.output_dir,
|
self.output_dir,
|
||||||
f"grid_{grid_id[0]}_{grid_id[1]}",
|
f"grid_{grid_id[0]}_{grid_id[1]}",
|
||||||
@ -119,30 +127,30 @@ class MergeTif:
|
|||||||
product_path,
|
product_path,
|
||||||
filename
|
filename
|
||||||
)
|
)
|
||||||
|
if os.path.exists(grid_tif_original) and os.path.exists(grid_tif):
|
||||||
if not 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(
|
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
|
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:
|
if input_tif1 is None:
|
||||||
input_tif1 = grid_tif
|
input_tif1 = to_merge_tif
|
||||||
self.logger.info(f"设置第一个输入{product_name}: {input_tif1}")
|
self.logger.info(f"设置第一个输入{product_name}: {input_tif1}")
|
||||||
else:
|
else:
|
||||||
input_tif2 = grid_tif
|
input_tif2 = to_merge_tif
|
||||||
# 生成带时间戳的临时输出文件名
|
# 生成带时间戳的临时输出文件名
|
||||||
temp_output = os.path.join(
|
temp_output = os.path.join(
|
||||||
self.output_dir,
|
self.output_dir,
|
||||||
|
@ -58,8 +58,8 @@ class ODMProcessMonitor:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
# 检查正射影像
|
# 检查正射影像
|
||||||
if not self._check_orthophoto(project_dir):
|
# if not self._check_orthophoto(project_dir):
|
||||||
return False
|
# return False
|
||||||
|
|
||||||
# TODO: 添加点云和实景三维的质量检查
|
# TODO: 添加点云和实景三维的质量检查
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user