feat: Extract weather trend analysis into a new shared module and add initial web application and data collection components.

This commit is contained in:
2569718930@qq.com
2026-03-04 19:47:19 +08:00
parent 00bd2539fa
commit 9e5fc418de
4 changed files with 38 additions and 6 deletions
+6 -1
View File
@@ -105,7 +105,7 @@ def _analyze(city: str, force_refresh: bool = False) -> Dict[str, Any]:
raw = _weather.fetch_all_sources(city, lat=lat, lon=lon)
om = raw.get("open-meteo", {})
metar = raw.get("metar", {})
mgm = raw.get("mgm", {})
mgm = raw.get("mgm") or {}
ens_raw = raw.get("ensemble", {})
mm = raw.get("multi_model", {})
risk = CITY_RISK_PROFILES.get(city, {})
@@ -412,6 +412,11 @@ def _analyze(city: str, force_refresh: bool = False) -> Dict[str, Any]:
if i < len(maxtemps) and maxtemps[i] is not None:
day_m["Open-Meteo"] = _sf(maxtemps[i])
# Add MGM per-day forecast
mgm_daily = mgm.get("daily_forecasts", {})
if d_str in mgm_daily:
day_m["MGM"] = _sf(mgm_daily[d_str])
d_val, d_winfo = None, ""
if day_m:
try: