新增 AEROWEB (Météo-France) 和 NCM (沙特) 实时气象数据源
AEROWEB: 接入 aviation.meteo.fr,LFPB METAR 2 分钟内可获取, 实测温度替代 AROME 模式预报作为 Paris 电报推送数据源。 登录流程: PHPSESSID + MD5 密码 → ajax/login_valid.php, Session 20 分钟自动续期,XML 解析提取 tempe/td/dd/ff/qnh。 NCM: 沙特气象局 Meteomatics API 代码框架,待凭证激活。 Jeddah settlement_source 从废弃的 wunderground 迁移至 ncm。 同时清理: 日志文件 trading_system.log → polyweather.log, 删除 2026-02-07 的 1.2MB 废弃交易引擎日志。 Constraint: AEROWEB 需 AEROWEB_USERNAME/AEROWEB_PASSWORD 环境变量 Constraint: NCM 需 NCM_API_USERNAME/NCM_API_PASSWORD 环境变量 Confidence: high Tested: AEROWEB 登录→取数→解析端到端验证通过
This commit is contained in:
@@ -20,10 +20,12 @@ from src.data_collection.hko_obs_sources import HkoObsSourceMixin
|
||||
from src.data_collection.madis_sources import MadisSourceMixin
|
||||
from src.data_collection.singapore_mss_sources import SingaporeMssSourceMixin
|
||||
from src.data_collection.ims_sources import ImsSourceMixin
|
||||
from src.data_collection.ncm_sources import NcmSourceMixin
|
||||
from src.data_collection.aeroweb_sources import AerowebSourceMixin
|
||||
from src.database.db_manager import DBManager
|
||||
|
||||
|
||||
class WeatherDataCollector(OpenMeteoCacheMixin, SettlementSourceMixin, MetarSourceMixin, MgmSourceMixin, JmaAmedasSourceMixin, NwsOpenMeteoSourceMixin, AmosStationSourceMixin, AmscAwosSourceMixin, FmiSourceMixin, KnmiSourceMixin, HkoObsSourceMixin, MadisSourceMixin, SingaporeMssSourceMixin, ImsSourceMixin):
|
||||
class WeatherDataCollector(OpenMeteoCacheMixin, SettlementSourceMixin, MetarSourceMixin, MgmSourceMixin, JmaAmedasSourceMixin, NwsOpenMeteoSourceMixin, AmosStationSourceMixin, AmscAwosSourceMixin, FmiSourceMixin, KnmiSourceMixin, HkoObsSourceMixin, MadisSourceMixin, SingaporeMssSourceMixin, ImsSourceMixin, NcmSourceMixin, AerowebSourceMixin):
|
||||
"""
|
||||
Multi-source weather data collector
|
||||
|
||||
@@ -859,7 +861,7 @@ class WeatherDataCollector(OpenMeteoCacheMixin, SettlementSourceMixin, MetarSour
|
||||
if (
|
||||
city_lower not in self.CITY_METAR_CLUSTERS
|
||||
or "mgm_nearby" in results
|
||||
or settlement_source in {"hko", "cwa", "ims"}
|
||||
or settlement_source in {"hko", "cwa", "ims", "ncm", "aeroweb"}
|
||||
):
|
||||
return
|
||||
cluster_icaos = self.CITY_METAR_CLUSTERS[city_lower]
|
||||
@@ -905,6 +907,42 @@ class WeatherDataCollector(OpenMeteoCacheMixin, SettlementSourceMixin, MetarSour
|
||||
except Exception:
|
||||
logger.exception("airport_obs_log append failed for ims city={}", city_lower)
|
||||
|
||||
def _attach_saudi_ncm_data(self, results: Dict, city_lower: str) -> None:
|
||||
if city_lower != "jeddah":
|
||||
return
|
||||
ncm_data = self.fetch_from_ncm()
|
||||
if ncm_data:
|
||||
results["ncm"] = ncm_data
|
||||
try:
|
||||
ncm_current = ncm_data.get("current") or {}
|
||||
DBManager().append_airport_obs(
|
||||
icao="OEJN",
|
||||
city=city_lower,
|
||||
temp_c=ncm_current.get("temp"),
|
||||
wind_kt=ncm_current.get("wind_speed_kt"),
|
||||
obs_time=ncm_data.get("obs_time") or datetime.now().isoformat(),
|
||||
)
|
||||
except Exception:
|
||||
logger.exception("airport_obs_log append failed for ncm city={}", city_lower)
|
||||
|
||||
def _attach_paris_aeroweb_data(self, results: Dict, city_lower: str) -> None:
|
||||
if city_lower != "paris":
|
||||
return
|
||||
aw_data = self.fetch_from_aeroweb()
|
||||
if aw_data:
|
||||
results["aeroweb"] = aw_data
|
||||
try:
|
||||
aw_current = aw_data.get("current") or {}
|
||||
DBManager().append_airport_obs(
|
||||
icao="LFPB",
|
||||
city=city_lower,
|
||||
temp_c=aw_current.get("temp"),
|
||||
wind_kt=aw_current.get("wind_speed_kt"),
|
||||
obs_time=aw_data.get("obs_time") or datetime.now().isoformat(),
|
||||
)
|
||||
except Exception:
|
||||
logger.exception("airport_obs_log append failed for aeroweb city={}", city_lower)
|
||||
|
||||
def _attach_china_official_nearby(
|
||||
self, results: Dict, city_lower: str, use_fahrenheit: bool
|
||||
) -> None:
|
||||
@@ -1384,6 +1422,8 @@ class WeatherDataCollector(OpenMeteoCacheMixin, SettlementSourceMixin, MetarSour
|
||||
self._attach_madis_hfmetar_data(results, city_lower)
|
||||
self._attach_singapore_mss_data(results, city_lower)
|
||||
self._attach_israel_ims_data(results, city_lower)
|
||||
self._attach_saudi_ncm_data(results, city_lower)
|
||||
self._attach_paris_aeroweb_data(results, city_lower)
|
||||
if include_nearby:
|
||||
self._attach_china_official_nearby(results, city_lower, use_fahrenheit)
|
||||
self._attach_japan_official_nearby(results, city_lower, use_fahrenheit)
|
||||
@@ -1433,6 +1473,8 @@ class WeatherDataCollector(OpenMeteoCacheMixin, SettlementSourceMixin, MetarSour
|
||||
self._attach_madis_hfmetar_data(results, city_lower)
|
||||
self._attach_singapore_mss_data(results, city_lower)
|
||||
self._attach_israel_ims_data(results, city_lower)
|
||||
self._attach_saudi_ncm_data(results, city_lower)
|
||||
self._attach_paris_aeroweb_data(results, city_lower)
|
||||
if include_nearby:
|
||||
self._attach_china_official_nearby(results, city_lower, use_fahrenheit)
|
||||
self._attach_japan_official_nearby(results, city_lower, use_fahrenheit)
|
||||
|
||||
Reference in New Issue
Block a user