CoWIN 6087 历史持久化 + 跑道曲线聚合 + 模型区间修复 + HKO 曲线对调 + 毛玻璃加载层
- weather_sources: CoWIN 1min 观测写入 official_intraday_observations_store - country_networks: cowin_obs 源从 DB 回读 1min 历史,不复用 VHHH METAR - analysis_service: 跑道实测 36h 历史按跑道分组,透传至前端 - scan_terminal_city_row: model_cluster_sources fallback 修复 + runway_plate_history - 前端: CoWIN 6087 升级为主轴实线,HKO 退为虚线,VHHH METAR 轻虚线 - 前端: Loading 升级为毛玻璃全卡蒙层
This commit is contained in:
@@ -1201,12 +1201,29 @@ def build_country_network_snapshot(city: str, raw: Dict[str, Any]) -> Dict[str,
|
||||
"stale_row_count": stale_count,
|
||||
"unknown_timing_count": unknown_count,
|
||||
}
|
||||
airport_primary_today_obs = ((raw.get("metar") or {}).get("today_obs") or [])
|
||||
if airport_primary.get("source_code") == "cowin_obs":
|
||||
try:
|
||||
from src.database.runtime_state import OfficialIntradayObservationRepository
|
||||
repo = OfficialIntradayObservationRepository()
|
||||
local_now = datetime.now(timezone.utc) + timedelta(seconds=city_offset or 0)
|
||||
local_date_str = local_now.strftime("%Y-%m-%d")
|
||||
points = repo.load_points(
|
||||
source_code="cowin_obs",
|
||||
station_code=airport_primary.get("station_code") or "6087",
|
||||
target_date=local_date_str,
|
||||
)
|
||||
if points:
|
||||
airport_primary_today_obs = [{"time": p["time"], "temp": p["temp"]} for p in points]
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return {
|
||||
"provider_code": provider.provider_code,
|
||||
"provider_label": provider.provider_label,
|
||||
"settlement_station": metadata,
|
||||
"airport_primary_current": airport_primary,
|
||||
"airport_primary_today_obs": ((raw.get("metar") or {}).get("today_obs") or []),
|
||||
"airport_primary_today_obs": airport_primary_today_obs,
|
||||
"official_nearby": official_nearby,
|
||||
"official_network_source": status.get("provider_code"),
|
||||
"official_network_status": status,
|
||||
|
||||
@@ -1141,14 +1141,26 @@ class WeatherDataCollector(OpenMeteoCacheMixin, SettlementSourceMixin, MetarSour
|
||||
results["nearby_source"] = "cowin_obs"
|
||||
try:
|
||||
row = rows[0] if rows else {}
|
||||
temp_c = row.get("temp")
|
||||
if use_fahrenheit and temp_c is not None:
|
||||
temp_c = round((temp_c - 32.0) * 5.0 / 9.0, 1)
|
||||
|
||||
DBManager().append_airport_obs(
|
||||
icao=str(row.get("icao") or "COWIN6087"),
|
||||
city=city_lower,
|
||||
temp_c=row.get("temp"),
|
||||
temp_c=temp_c,
|
||||
obs_time=str(row.get("obs_time") or datetime.now().isoformat()),
|
||||
)
|
||||
|
||||
self._update_official_today_obs(
|
||||
source_code="cowin_obs",
|
||||
station_code=str(row.get("istNo") or "6087"),
|
||||
obs_iso=str(row.get("obs_time") or datetime.now(timezone.utc).isoformat()),
|
||||
current_temp=temp_c,
|
||||
utc_offset_seconds=28800,
|
||||
)
|
||||
except Exception:
|
||||
logger.exception("airport_obs_log append failed for cowin_obs city={}", city_lower)
|
||||
logger.exception("airport_obs_log append/update failed for cowin_obs city={}", city_lower)
|
||||
|
||||
def _attach_cwa_settlement_nearby(
|
||||
self, results: Dict, city_lower: str, use_fahrenheit: bool
|
||||
|
||||
Reference in New Issue
Block a user