重写跑道观测推送规则为热度状态机:盯今日最高而非DEB,夜间停推
This commit is contained in:
+17
-31
@@ -878,25 +878,12 @@ def _run_high_freq_airport_cycle(
|
|||||||
|
|
||||||
city_weather: Dict[str, Any] = {}
|
city_weather: Dict[str, Any] = {}
|
||||||
deb_pred: Optional[float] = None
|
deb_pred: Optional[float] = None
|
||||||
market_high: Optional[float] = None
|
|
||||||
try:
|
try:
|
||||||
from web.app import _analyze
|
from web.app import _analyze
|
||||||
from web.services.city_payloads import build_city_market_scan_payload
|
|
||||||
city_weather = _analyze(city)
|
city_weather = _analyze(city)
|
||||||
deb_raw = (city_weather.get("deb") or {}).get("prediction")
|
deb_raw = (city_weather.get("deb") or {}).get("prediction")
|
||||||
if deb_raw is not None:
|
if deb_raw is not None:
|
||||||
deb_pred = float(deb_raw)
|
deb_pred = float(deb_raw)
|
||||||
# 取市场最高温度选项
|
|
||||||
scan = build_city_market_scan_payload(city_weather)
|
|
||||||
ms = (scan.get("market_scan") or {}) if isinstance(scan, dict) else {}
|
|
||||||
if ms.get("available"):
|
|
||||||
related = ms.get("related_buckets") or []
|
|
||||||
for b in related:
|
|
||||||
t = b.get("temp") if isinstance(b, dict) else None
|
|
||||||
if t is not None:
|
|
||||||
t = float(t)
|
|
||||||
if market_high is None or t > market_high:
|
|
||||||
market_high = t
|
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -971,27 +958,26 @@ def _run_high_freq_airport_cycle(
|
|||||||
elif current_obs_time and last_obs_time and current_obs_time == last_obs_time:
|
elif current_obs_time and last_obs_time and current_obs_time == last_obs_time:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# 今日实测最高已达DEB,行情已兑现,跳过
|
# ── 热度状态机 ──
|
||||||
daily_high, _ = _get_airport_daily_high(city_weather)
|
daily_high, _ = _get_airport_daily_high(city_weather)
|
||||||
|
# 1) DEB 已兑现 → 跳过
|
||||||
if daily_high is not None and deb_pred is not None and daily_high >= deb_pred - 0.5:
|
if daily_high is not None and deb_pred is not None and daily_high >= deb_pred - 0.5:
|
||||||
continue
|
continue
|
||||||
|
# 2) 距离今日最高太远 → 跳过
|
||||||
# 跑道城市:任意一条跑道温度满足 DEB 温差规则就推送
|
gap = (daily_high - current_temp) if daily_high is not None and current_temp is not None else None
|
||||||
if runway_temps:
|
if gap is not None and gap > 3.0:
|
||||||
any_in_window = False
|
continue
|
||||||
for (t, _d) in runway_temps:
|
# 3) 夜间降温 → 跳过
|
||||||
if t is not None and deb_pred is not None:
|
try:
|
||||||
d = float(t) - float(deb_pred)
|
h = int(str(city_weather.get("local_time") or "00")[:2])
|
||||||
if -5.0 <= d <= 3.0:
|
except ValueError:
|
||||||
any_in_window = True
|
h = 0
|
||||||
break
|
if h <= 5 or h >= 20:
|
||||||
if not any_in_window:
|
continue
|
||||||
continue
|
# 4) 接近今日最高(≤1°C)→ Rising/Peak Watch,一定推
|
||||||
# 如果跑道最高温已超过市场最高选项,行情已定,跳过
|
# 或在冲高窗口(≤2°C 且仍在升温)→ 推
|
||||||
if market_high is not None:
|
if gap is not None and gap > 2.0 and not _check_rising_trend(airport_icao):
|
||||||
rwy_max = max((t for (t, _d) in runway_temps if t is not None), default=None)
|
continue
|
||||||
if rwy_max is not None and rwy_max > market_high:
|
|
||||||
continue
|
|
||||||
|
|
||||||
# 用观测数据时间而非当前本地时间
|
# 用观测数据时间而非当前本地时间
|
||||||
airport_cur = city_weather.get("airport_current") or {}
|
airport_cur = city_weather.get("airport_current") or {}
|
||||||
|
|||||||
Reference in New Issue
Block a user