feat(step8→step9): 源头透传坐标元数据,打通空间坐标全程流
This commit is contained in:
@ -795,6 +795,9 @@ class WaterQualityInversionPipeline:
|
||||
(self.logger.info if hasattr(self, 'logger') else print)(msg)
|
||||
return
|
||||
|
||||
# ── 源头透传:提取元数据列(左列),与数据行一一对应 ────────────
|
||||
meta_df = df.iloc[:, :wavelength_col_idx].copy()
|
||||
|
||||
wavelengths = np.array([float(c) for c in col_names[wavelength_col_idx:]], dtype=np.float64)
|
||||
data_matrix = df.iloc[:, wavelength_col_idx:].values.astype(np.float64)
|
||||
if data_matrix.ndim == 1:
|
||||
@ -814,12 +817,15 @@ class WaterQualityInversionPipeline:
|
||||
wl_arr = wavelengths
|
||||
a_arr = sample_result['a_lambda']
|
||||
bb_arr = sample_result['bb_lambda']
|
||||
# 取出第 i 个样本的元数据行(如 X, Y, Lon, Lat 等),与光谱行一一对齐
|
||||
meta_row = meta_df.iloc[i].to_dict() if i < len(meta_df) else {}
|
||||
for j, wl in enumerate(wl_arr):
|
||||
rows_out.append({
|
||||
'sample_id': f"sample_{i}",
|
||||
'Wavelength': wl,
|
||||
'a_lambda': a_arr[j],
|
||||
'bb_lambda': bb_arr[j],
|
||||
**meta_row,
|
||||
})
|
||||
|
||||
result_df = pd.DataFrame(rows_out)
|
||||
|
||||
Reference in New Issue
Block a user