From 29a5aaa9abecbdbd8ead89bb260d365cdceee5e0 Mon Sep 17 00:00:00 2001 From: duxin Date: Tue, 7 Jul 2026 17:21:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Goodman=20=E5=85=A8=E5=B1=80=E8=A3=81?= =?UTF-8?q?=E5=89=AA=E5=8F=8D=E5=B0=84=E7=8E=87=20=E2=89=A50=EF=BC=8C?= =?UTF-8?q?=E6=B6=88=E9=99=A4=E9=9D=9E=E6=B0=B4=E4=BD=93=E5=83=8F=E7=B4=A0?= =?UTF-8?q?=E7=9A=84=E8=B4=9F=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题: 光谱查看时发现起始波段和部分后续波段反射率为负值。 物理上反射率不应为负。 根因: 之前的 np.maximum(R[water], 0) 仅裁剪了水体像素。 非水体像素保留原始值,而大气校正在短波边缘波段 (375-400nm) 和长波末端 (950-1000nm) 因低 SNR 常过校正 产生负反射率。 修复: 在每个处理路径末尾添加全局 np.maximum(R, 0, out=R): - 行段跳跃模式: 水体校正后 + 全局裁剪 - 全图+掩膜模式: 水体校正后 + 全局裁剪 (新增) - 无掩膜模式: 全局裁剪 (原有,不变) 确保输出文件所有像素反射率 ≥ 0 --- src/core/glint_removal/Goodman.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/glint_removal/Goodman.py b/src/core/glint_removal/Goodman.py index 2687947..6c2e9f4 100644 --- a/src/core/glint_removal/Goodman.py +++ b/src/core/glint_removal/Goodman.py @@ -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)