fix: read_csv_data 含量列动态识别 — 排除所有坐标列名
问题: CSV 格式 [proj_x, proj_y, longitude, latitude, BGA_Am09KBBI],
旧逻辑 coord_cols={proj_x,proj_y} 只排除识别的坐标列,
longitude 被错误提取为含量列 → Kriging 用坐标值插值
修复: 扩展排除集合包含全部已知坐标列名:
proj_x/proj_y, longitude/latitude, x/y, lon/lat,
x_coord/y_coord, pixel_x/pixel_y, geometry, uncertainty
兜底取最后一列
This commit is contained in:
@ -900,15 +900,17 @@ class ContentMapper:
|
||||
print(f" ⚠ 未识别到标准坐标列名,按位置回退: "
|
||||
f"X={lon_col}, Y={lat_col}")
|
||||
|
||||
# 含量列:跳过坐标列后的第一列
|
||||
coord_cols = {lon_col, lat_col}
|
||||
# 动态识别含量列(跳过已知的坐标列和特殊列)
|
||||
_exclude_cols = {'proj_x', 'proj_y', 'longitude', 'latitude',
|
||||
'x', 'y', 'lon', 'lat', 'geometry', 'uncertainty',
|
||||
'x_coord', 'y_coord', 'pixel_x', 'pixel_y'}
|
||||
content_col = None
|
||||
for c in df.columns:
|
||||
if c not in coord_cols and not c.startswith('pixel_'):
|
||||
content_col = c
|
||||
for col in df.columns:
|
||||
if col.lower() not in _exclude_cols and not col.startswith('pixel_'):
|
||||
content_col = col
|
||||
break
|
||||
if content_col is None:
|
||||
content_col = df.columns[2]
|
||||
content_col = df.columns[-1]
|
||||
|
||||
print(f"检测到列名:X({lon_col}),Y({lat_col}),含量({content_col})")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user