模型区间数据修复:scan row 优先 daily models,fallback 到 multi forecasts + hourly

- 后端 _build_quick_row: model_cluster_sources 先从 multi_model_daily 取 daily models
- 前端 chart: modelValues 优先 row.model_cluster_sources,缺失时从 hourly.multiModelDaily 补
This commit is contained in:
2569718930@qq.com
2026-05-26 11:51:27 +08:00
parent bf1ee43ffe
commit dd585ac83b
2 changed files with 19 additions and 5 deletions
@@ -1486,7 +1486,12 @@ export function LiveTemperatureThresholdChart({
const displayRunwayTemp = liveTemp ?? currentRunwayTemp;
const wundergroundDailyHigh = validNumber(hourly?.airportCurrent?.max_so_far ?? hourly?.airportPrimary?.max_so_far) ?? null;
const modelValues = Object.values(row?.model_cluster_sources || {})
const localDateStr = row?.local_date || new Date().toISOString().slice(0, 10);
const modelSources = (row?.model_cluster_sources && Object.keys(row.model_cluster_sources).length > 0)
? row.model_cluster_sources
: (hourly?.multiModelDaily?.[localDateStr]?.models || null);
const modelValues = Object.values(modelSources || {})
.map(validNumber)
.filter((v): v is number => v !== null);
const modelMin = modelValues.length ? Math.min(...modelValues) : (row?.cluster_core_low ?? null);
+13 -4
View File
@@ -183,6 +183,11 @@ def _build_quick_row(
tz_offset = _safe_int(city_meta.get("tz"), 0)
market_region = _market_region_from_tz_offset(tz_offset)
multi_model_daily = data.get("multi_model_daily") or {}
daily_entry = multi_model_daily.get(local_date) if isinstance(multi_model_daily, dict) else {}
if not isinstance(daily_entry, dict):
daily_entry = {}
id_parts = [city, local_date or "today"]
if data.get("temp_symbol") == "°F":
id_parts.append("F")
@@ -201,10 +206,14 @@ def _build_quick_row(
"current_temp": curr.get("temp"),
"current_max_so_far": curr.get("max_so_far"),
"deb_prediction": deb.get("prediction"),
"model_cluster_sources": {
str(k): v for k, v in multi.get("forecasts", {}).items()
if v is not None
},
"model_cluster_sources": (
daily_entry.get("models")
if isinstance(daily_entry.get("models"), dict)
else {
str(k): v for k, v in multi.get("forecasts", {}).items()
if v is not None
}
),
"distribution_preview": distribution[:6] if distribution else [],
"trading_region": market_region["key"],
"trading_region_label": market_region["label_en"],