fix: Goodman 全局裁剪反射率 ≥0,消除非水体像素的负值

问题: 光谱查看时发现起始波段和部分后续波段反射率为负值。
  物理上反射率不应为负。

根因: 之前的 np.maximum(R[water], 0) 仅裁剪了水体像素。
  非水体像素保留原始值,而大气校正在短波边缘波段
  (375-400nm) 和长波末端 (950-1000nm) 因低 SNR 常过校正
  产生负反射率。

修复: 在每个处理路径末尾添加全局 np.maximum(R, 0, out=R):
  - 行段跳跃模式: 水体校正后 + 全局裁剪
  - 全图+掩膜模式: 水体校正后 + 全局裁剪 (新增)
  - 无掩膜模式: 全局裁剪 (原有,不变)
  确保输出文件所有像素反射率 ≥ 0
This commit is contained in:
duxin
2026-07-07 17:21:52 +08:00
parent 796d36c093
commit 29a5aaa9ab

View File

@ -266,6 +266,9 @@ class Goodman:
+ self.B * diff_640_750[rs, :][w])
np.maximum(Rs[w], 0, out=Rs[w])
del Rs
# 全局裁剪:确保非水体像素也不含负反射率
# (大气校正在边缘波段可能过校正产生负值)
np.maximum(R, 0, out=R)
else:
R = current_band.ReadAsArray().astype(np.float32)
if water is not None:
@ -273,6 +276,8 @@ class Goodman:
R[water] = (R[water] - R_750[water] + self.A
+ self.B * diff_640_750[water])
np.maximum(R[water], 0, out=R[water])
# 全局裁剪:确保非水体像素也不含负反射率
np.maximum(R, 0, out=R)
else:
# ◆ 无掩膜:全图校正(最快 SIMD 路径)
np.subtract(R, R_750, out=R)