fix(Step3): 修复Step3波段范围信号误植多类;新增动态波段范围限制;优化去耀斑算法调用
This commit is contained in:
@ -1661,19 +1661,22 @@ class WaterQualityInversionPipeline:
|
||||
geotransform, projection, width, height, n_bands = self._get_image_geo_info(img_path)
|
||||
print(f"影像尺寸: {width} x {height} x {n_bands}")
|
||||
|
||||
# 处理水域掩膜:如果是shp文件路径,需要栅格化
|
||||
# 创建一个临时数组用于获取尺寸信息(仅用于掩膜处理)
|
||||
temp_shape = (height, width)
|
||||
|
||||
# 加载影像数据(Kutser算法需要numpy数组)
|
||||
image_array, geotransform, projection = self._load_image_as_array(img_path)
|
||||
print(f"影像尺寸: {image_array.shape}")
|
||||
|
||||
# 处理水域掩膜
|
||||
mask_for_algorithm = self._prepare_water_mask_for_algorithm(
|
||||
final_water_mask, temp_shape, geotransform, projection, img_path
|
||||
final_water_mask, image_array.shape, geotransform, projection, img_path
|
||||
)
|
||||
|
||||
# 应用Kutser算法:直接传递文件路径,让算法类使用GDAL逐波段处理
|
||||
|
||||
# 应用Kutser算法:传递numpy数组
|
||||
# 注意:kutser_shp_path参数已废弃,使用water_mask代替
|
||||
kutser = Kutser(img_path, shp_path=None, # 直接传递文件路径
|
||||
kutser = Kutser(image_array, shp_path=None,
|
||||
oxy_band=oxy_band, lower_oxy=lower_oxy,
|
||||
upper_oxy=upper_oxy, NIR_band=nir_band,
|
||||
water_mask=mask_for_algorithm, output_path=output_path) # 传递output_path,算法类会保存
|
||||
water_mask=mask_for_algorithm, output_path=output_path)
|
||||
corrected_bands = kutser.get_corrected_bands()
|
||||
|
||||
# 检查算法类是否已保存文件(可能保存为.bsq格式)
|
||||
@ -1765,18 +1768,21 @@ class WaterQualityInversionPipeline:
|
||||
geotransform, projection, width, height, n_bands = self._get_image_geo_info(img_path)
|
||||
print(f"影像尺寸: {width} x {height} x {n_bands}")
|
||||
|
||||
# 处理水域掩膜:如果是shp文件路径,需要栅格化
|
||||
# 创建一个临时数组用于获取尺寸信息(仅用于掩膜处理)
|
||||
temp_shape = (height, width)
|
||||
|
||||
# 加载影像数据(Hedley算法需要numpy数组)
|
||||
image_array, geotransform, projection = self._load_image_as_array(img_path)
|
||||
print(f"影像尺寸: {image_array.shape}")
|
||||
|
||||
# 处理水域掩膜
|
||||
mask_for_algorithm = self._prepare_water_mask_for_algorithm(
|
||||
final_water_mask, temp_shape, geotransform, projection, img_path
|
||||
final_water_mask, image_array.shape, geotransform, projection, img_path
|
||||
)
|
||||
|
||||
# 应用Hedley算法:直接传递文件路径,让算法类使用GDAL逐波段处理
|
||||
|
||||
# 应用Hedley算法:传递numpy数组
|
||||
# 注意:hedley_shp_path参数已废弃,使用water_mask代替
|
||||
hedley = Hedley(img_path, shp_path=None, # 直接传递文件路径
|
||||
hedley = Hedley(image_array, shp_path=None,
|
||||
NIR_band=hedley_nir_band, water_mask=mask_for_algorithm,
|
||||
output_path=output_path) # 传递output_path,算法类会保存
|
||||
output_path=output_path)
|
||||
corrected_bands = hedley.get_corrected_bands()
|
||||
|
||||
# 检查算法类是否已保存文件(可能保存为.bsq格式)
|
||||
|
||||
Reference in New Issue
Block a user