@
机场快照改进:首尔/釜山展示各跑道对温度,东京补齐 JMA 实时温度 快照数据源从仅依赖 airport_obs_log 改为优先取 city_weather 中的 AMOS/JMA 实时数据: - 首尔/釜山:展示每条跑道对温度(如 15L/33R: 14.6°C / 15R/33L: 15.2°C) - 东京:取 JMA official_nearby 实时温度,obs_log 为空时回退到 current.temp Tested: ruff check 通过 @
This commit is contained in:
+41
-13
@@ -803,16 +803,25 @@ def _build_airport_snapshot_message(snapshots: list[dict[str, Any]], local_time:
|
||||
city = s.get("city", "")
|
||||
temp = s.get("temp_c")
|
||||
deb = s.get("deb_prediction")
|
||||
runway_pairs = s.get("runway_pairs") or []
|
||||
runway_temps = s.get("runway_temps") or []
|
||||
lines.append("")
|
||||
header = f"{flag.get(city, '')} {name.get(city, city)}"
|
||||
parts = []
|
||||
if temp is not None:
|
||||
parts.append(f"当前 {temp:.1f}°C")
|
||||
|
||||
# Show individual runway pair temps for Seoul/Busan
|
||||
if runway_pairs and runway_temps and len(runway_pairs) == len(runway_temps):
|
||||
runway_lines = []
|
||||
for (r1, r2), (t, d) in zip(runway_pairs, runway_temps):
|
||||
dew_str = f" / 露点 {d:.1f}°C" if d is not None else ""
|
||||
runway_lines.append(f"{r1}/{r2}: {t:.1f}°C{dew_str}")
|
||||
line = header + "\n" + "\n".join(runway_lines)
|
||||
elif temp is not None:
|
||||
line = header + f"\n当前 {temp:.1f}°C"
|
||||
else:
|
||||
line = header
|
||||
|
||||
if deb is not None:
|
||||
parts.append(f"DEB 预测最高 {deb:.1f}°C")
|
||||
line = header
|
||||
if parts:
|
||||
line += "\n" + " · ".join(parts)
|
||||
line += f"\nDEB 预测最高 {deb:.1f}°C"
|
||||
if s.get("wind_kt") is not None:
|
||||
line += f" | 风 {s['wind_kt']:.0f}kt"
|
||||
if s.get("pressure_hpa") is not None:
|
||||
@@ -860,15 +869,32 @@ def _run_high_freq_airport_cycle(
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Extract airport-level data from city_weather for snapshot
|
||||
amos = city_weather.get("amos") or {}
|
||||
runway_data = (amos.get("runway_obs") or {}) if amos else {}
|
||||
runway_pairs = runway_data.get("runway_pairs") or []
|
||||
runway_temps = runway_data.get("temperatures") or []
|
||||
jma_nearby = (city_weather.get("jma_official_nearby") or [None])[0] or {}
|
||||
current_temp = (
|
||||
amos.get("temp_c")
|
||||
or jma_nearby.get("temp")
|
||||
or latest_obs.get("temp_c")
|
||||
or (city_weather.get("current") or {}).get("temp")
|
||||
)
|
||||
wind_kt = amos.get("wind_kt") or latest_obs.get("wind_kt")
|
||||
pressure_hpa = amos.get("pressure_hpa") or latest_obs.get("pressure_hpa")
|
||||
|
||||
# Check high-locked
|
||||
if _check_high_locked(city):
|
||||
if snapshot_due:
|
||||
snapshots.append({
|
||||
"city": city,
|
||||
"temp_c": latest_obs.get("temp_c"),
|
||||
"wind_kt": latest_obs.get("wind_kt"),
|
||||
"pressure_hpa": latest_obs.get("pressure_hpa"),
|
||||
"temp_c": current_temp,
|
||||
"wind_kt": wind_kt,
|
||||
"pressure_hpa": pressure_hpa,
|
||||
"deb_prediction": deb_pred,
|
||||
"runway_pairs": runway_pairs,
|
||||
"runway_temps": runway_temps,
|
||||
})
|
||||
continue
|
||||
|
||||
@@ -878,10 +904,12 @@ def _run_high_freq_airport_cycle(
|
||||
if snapshot_due:
|
||||
snapshots.append({
|
||||
"city": city,
|
||||
"temp_c": latest_obs.get("temp_c"),
|
||||
"wind_kt": latest_obs.get("wind_kt"),
|
||||
"pressure_hpa": latest_obs.get("pressure_hpa"),
|
||||
"temp_c": current_temp,
|
||||
"wind_kt": wind_kt,
|
||||
"pressure_hpa": pressure_hpa,
|
||||
"deb_prediction": deb_pred,
|
||||
"runway_pairs": runway_pairs,
|
||||
"runway_temps": runway_temps,
|
||||
})
|
||||
|
||||
if not rule.get("triggered"):
|
||||
|
||||
Reference in New Issue
Block a user