fix: get_spectral.py CSV列索引错误 - 跳过测量点ID列正确读取纬度(41.66°)和经度(124.22°)
input.csv列顺序: 时间,测量点,纬度,经度,水质参数... 原代码错误地将测量点ID(col0)当作纬度,纬度(col1)当作经度 修复后: lat=col1(纬度), lon=col2(经度) 修复前导致所有14815个采样点坐标转换后超出影像范围,光谱提取为0 修复后: 14815个采样点全部成功提取有效光谱(314~717)
This commit is contained in:
@ -474,8 +474,8 @@ def get_spectral_in_coor(imgpath, coorpath, outpath, radius=0, flare_path=None,
|
|||||||
print(f" 行{i + 1}: {coor_data[i, :min(5, coor_data.shape[1])]}") # 只显示前5列
|
print(f" 行{i + 1}: {coor_data[i, :min(5, coor_data.shape[1])]}") # 只显示前5列
|
||||||
|
|
||||||
# 提取原始坐标
|
# 提取原始坐标
|
||||||
lat_array = coor_data[:, 0] # 第1列是纬度
|
lat_array = coor_data[:, 1] # 第2列是纬度(跳过测量点ID列)
|
||||||
lon_array = coor_data[:, 1] # 第2列是经度
|
lon_array = coor_data[:, 2] # 第3列是经度
|
||||||
|
|
||||||
print(f"\n=== 原始坐标信息 ===")
|
print(f"\n=== 原始坐标信息 ===")
|
||||||
print(f"原始坐标范围: 经度 {np.min(lon_array):.6f} ~ {np.max(lon_array):.6f}, 纬度 {np.min(lat_array):.6f} ~ {np.max(lat_array):.6f}")
|
print(f"原始坐标范围: 经度 {np.min(lon_array):.6f} ~ {np.max(lon_array):.6f}, 纬度 {np.min(lat_array):.6f} ~ {np.max(lat_array):.6f}")
|
||||||
|
|||||||
Reference in New Issue
Block a user