修复Step3去耀斑模块三大问题:SUGAR分支变量名冲突、Kutser参数默认值错误、波段索引类型统一转为int

This commit is contained in:
DXC
2026-05-09 09:58:50 +08:00
parent 4d23a65a21
commit 56de4b6fc4
2 changed files with 19 additions and 21 deletions

View File

@ -1887,16 +1887,16 @@ class WaterQualityInversionPipeline:
elif method == "sugar":
# 强行转换暗号,兼容中文和各种格式
raw_method = str(sugar_glint_mask_method).lower()
if 'cdf' in raw_method or '累积' in raw_method:
sugar_glint_mask_method = 'cdf'
elif 'otsu' in raw_method or '大津' in raw_method:
sugar_glint_mask_method = 'otsu'
sugar_glint_mask_method_raw = str(sugar_glint_mask_method).lower()
if 'cdf' in sugar_glint_mask_method_raw or '累积' in sugar_glint_mask_method:
sugar_glint_mask_method_fixed = 'cdf'
elif 'otsu' in sugar_glint_mask_method_raw or '大津' in sugar_glint_mask_method:
sugar_glint_mask_method_fixed = 'otsu'
else:
# 默认回退到 cdf 确保不崩溃
sugar_glint_mask_method = 'cdf'
sugar_glint_mask_method_fixed = 'cdf'
print(f"使用方法: SUGAR (迭代次数={sugar_iter}, 掩膜方法={sugar_glint_mask_method})")
print(f"使用方法: SUGAR (迭代次数={sugar_iter}, 掩膜方法={sugar_glint_mask_method_fixed})")
# 确定输出路径
output_path = str(self.deglint_dir / "deglint_sugar.bsq")
@ -1930,7 +1930,7 @@ class WaterQualityInversionPipeline:
corrected_images = correction_iterative(
image_array, iter=None, bounds=sugar_bounds,
estimate_background=sugar_estimate_background,
glint_mask_method=sugar_glint_mask_method,
glint_mask_method=sugar_glint_mask_method_fixed,
termination_thresh=sugar_termination_thresh,
water_mask=mask_for_algorithm,
output_path=None # 不传递output_path使用pipeline保存
@ -1940,7 +1940,7 @@ class WaterQualityInversionPipeline:
corrected_images = correction_iterative(
image_array, iter=sugar_iter, bounds=sugar_bounds,
estimate_background=sugar_estimate_background,
glint_mask_method=sugar_glint_mask_method,
glint_mask_method=sugar_glint_mask_method_fixed,
water_mask=mask_for_algorithm,
output_path=None # 不传递output_path使用pipeline保存
)

View File

@ -99,24 +99,22 @@ class Step3Panel(QWidget):
self.oxy_band = QSpinBox()
self.oxy_band.setRange(0, 200)
self.oxy_band.setValue(8)
self.oxy_band.setValue(38)
kutser_layout.addRow("氧吸收波段索引:", self.oxy_band)
self.lower_oxy = QDoubleSpinBox()
self.lower_oxy.setDecimals(2)
self.lower_oxy.setRange(0, 1000)
self.lower_oxy.setValue(756.54)
kutser_layout.addRow("下氧吸收波长(nm):", self.lower_oxy)
self.lower_oxy = QSpinBox()
self.lower_oxy.setRange(0, 200)
self.lower_oxy.setValue(36)
kutser_layout.addRow("下氧吸收波段索引:", self.lower_oxy)
self.upper_oxy = QDoubleSpinBox()
self.upper_oxy.setDecimals(2)
self.upper_oxy.setRange(0, 1000)
self.upper_oxy.setValue(766.54)
kutser_layout.addRow("上氧吸收波长(nm):", self.upper_oxy)
self.upper_oxy = QSpinBox()
self.upper_oxy.setRange(0, 200)
self.upper_oxy.setValue(49)
kutser_layout.addRow("上氧吸收波段索引:", self.upper_oxy)
self.nir_band = QSpinBox()
self.nir_band.setRange(0, 200)
self.nir_band.setValue(65)
self.nir_band.setValue(47)
kutser_layout.addRow("NIR波段索引:", self.nir_band)
self.kutser_group.setLayout(kutser_layout)