From a173da1b00ec2f906cb6103e2b9957e8090ad28a Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Wed, 13 May 2026 00:54:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E9=80=81=E5=88=A4=E6=96=AD=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E4=BD=BF=E7=94=A8=E6=9C=BA=E5=9C=BA=E7=AB=99=E7=82=B9?= =?UTF-8?q?=E6=B8=A9=E5=BA=A6=EF=BC=8C=E7=BB=9F=E4=B8=80=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E4=B8=8E=E5=B1=95=E7=A4=BA=E6=95=B0=E6=8D=AE=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之前 proximity 检查用 city_weather.current.temp(通用温度/METAR), 但消息展示用 mgm_nearby 机场站点温度,两者不一致导致推送窗口错位。 现在统一从 mgm_nearby/amos 提取机场温度用于判断。 --- src/utils/telegram_push.py | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/utils/telegram_push.py b/src/utils/telegram_push.py index 8d77a387..8de6681d 100644 --- a/src/utils/telegram_push.py +++ b/src/utils/telegram_push.py @@ -873,9 +873,30 @@ def _run_high_freq_airport_cycle( except Exception: pass - current = city_weather.get("current") or {} - current_temp = current.get("temp") - # Paris: use AROME 15-min model temp instead of METAR + # Extract airport-level temperature (same logic as message builder) + amos = city_weather.get("amos") or {} + mgm_nearby = city_weather.get("mgm_nearby") or [] + airport_icao = HIGH_FREQ_AIRPORT_ICAO.get(city, "") + airport_row = None + for row in mgm_nearby: + if str(row.get("istNo") or "") == airport_icao or str(row.get("icao") or "") == airport_icao: + airport_row = row + break + if not airport_row: + airport_row = mgm_nearby[0] if mgm_nearby else {} + station_temp = airport_row.get("temp") if airport_row else None + + # Use AMOS runway temp or station temp + runway_temps = (amos.get("runway_obs") or {}).get("temperatures") or [] + if runway_temps: + valid_temps = [t for (t, _d) in runway_temps if t is not None] + if valid_temps: + station_temp = max(valid_temps) + + current_temp = station_temp + if current_temp is None: + current_temp = (city_weather.get("current") or {}).get("temp") + # Paris: AROME model if city == "paris": arome_temp = _fetch_arome_temp() if arome_temp is not None: @@ -888,7 +909,7 @@ def _run_high_freq_airport_cycle( proximity = deb_pred - current_temp in_window = proximity <= _DEB_PROXIMITY_THRESHOLD_C - # Stop if past peak (skip for Paris: no obs_log for AROME model data) + # Stop if past peak if in_window and city != "paris": try: from src.database.db_manager import DBManager