fix: 自动格式转换 .shp→.dat 水域掩膜,解决插值函数报错
This commit is contained in:
@ -1679,10 +1679,16 @@ class WaterQualityInversionPipeline:
|
||||
return self.deglint_img_path
|
||||
|
||||
# 确定使用的水域掩膜
|
||||
# 优先级:1. 用户提供的water_mask参数 2. 步骤1生成的dat格式掩膜 3. None(处理全图)
|
||||
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:
|
||||
# 尝试使用步骤1生成的dat格式掩膜
|
||||
if self.water_mask_path is not None:
|
||||
final_water_mask = self.water_mask_path
|
||||
print(f"使用步骤1生成的水域掩膜: {final_water_mask}")
|
||||
|
||||
Reference in New Issue
Block a user