fix: 自动格式转换 .shp→.dat 水域掩膜,解决插值函数报错

This commit is contained in:
DXC
2026-05-09 14:35:58 +08:00
parent 82af2d75d3
commit 9d39e61161

View File

@ -1679,10 +1679,16 @@ class WaterQualityInversionPipeline:
return self.deglint_img_path return self.deglint_img_path
# 确定使用的水域掩膜 # 确定使用的水域掩膜
# 优先级1. 用户提供的water_mask参数 2. 步骤1生成的dat格式掩膜 3. None处理全图
final_water_mask = water_mask final_water_mask = water_mask
# 【新增智能转换逻辑】:如果 GUI 传入的是 .shp且第一步已经生成了 .dat 掩膜,强制替换为栅格 .dat
if final_water_mask is not None and str(final_water_mask).lower().endswith('.shp'):
if self.water_mask_path is not None and Path(self.water_mask_path).exists():
print(f"检测到输入掩膜为 .shp 矢量文件自动替换为步骤1生成的栅格掩膜: {self.water_mask_path}")
final_water_mask = self.water_mask_path
# 优先级处理
if final_water_mask is None: if final_water_mask is None:
# 尝试使用步骤1生成的dat格式掩膜
if self.water_mask_path is not None: if self.water_mask_path is not None:
final_water_mask = self.water_mask_path final_water_mask = self.water_mask_path
print(f"使用步骤1生成的水域掩膜: {final_water_mask}") print(f"使用步骤1生成的水域掩膜: {final_water_mask}")