移除 NMC(中国国家气象中心)数据源:无实际使用价值
This commit is contained in:
+1
-22
@@ -27,7 +27,6 @@ from src.analysis.settlement_rounding import apply_city_settlement
|
||||
from src.data_collection.country_networks import build_country_network_snapshot
|
||||
from src.data_collection.city_registry import ALIASES, CITY_REGISTRY
|
||||
from src.data_collection.city_time import get_city_utc_offset_seconds
|
||||
from src.data_collection.nmc_sources import NMC_CITY_REFERENCES
|
||||
from src.database.runtime_state import IntradayPathSnapshotRepository
|
||||
from web.services.city_payloads import (
|
||||
build_city_detail_payload as _city_payload_detail,
|
||||
@@ -126,18 +125,7 @@ def _format_observation_time_local(value: Any, utc_offset: int) -> str:
|
||||
|
||||
|
||||
def _fetch_nmc_current_fallback(city: str, *, use_fahrenheit: bool) -> Dict[str, Any]:
|
||||
city_key = str(city or "").strip().lower()
|
||||
if city_key not in NMC_CITY_REFERENCES:
|
||||
return {}
|
||||
try:
|
||||
payload = _weather.fetch_nmc_region_current(
|
||||
city_key,
|
||||
use_fahrenheit=use_fahrenheit,
|
||||
)
|
||||
return payload if isinstance(payload, dict) else {}
|
||||
except Exception as exc:
|
||||
logger.debug("NMC current fallback failed city={}: {}", city_key, exc)
|
||||
return {}
|
||||
return {}
|
||||
|
||||
|
||||
def _is_plausible_city_temp(city: str, value: Any, unit: str = "°C") -> bool:
|
||||
@@ -263,13 +251,6 @@ _OBSERVATION_SOURCE_PROFILES: Dict[str, Dict[str, Any]] = {
|
||||
"expected_grace_sec": 900,
|
||||
"stale_after_sec": 3600,
|
||||
},
|
||||
"nmc": {
|
||||
"label": "NMC",
|
||||
"native_update_interval_sec": 3600,
|
||||
"fresh_window_sec": 3600,
|
||||
"expected_grace_sec": 1800,
|
||||
"stale_after_sec": 7200,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -293,8 +274,6 @@ def _canonical_observation_source_code(value: Any) -> str:
|
||||
return "mgm"
|
||||
if "noaa" in raw:
|
||||
return "noaa"
|
||||
if "nmc" in raw:
|
||||
return "nmc"
|
||||
if "wunderground" in raw or raw == "wu":
|
||||
return "wunderground"
|
||||
return raw
|
||||
|
||||
@@ -425,7 +425,6 @@ def _cache_summary() -> Dict[str, Any]:
|
||||
open_meteo_multi_model_entries = len(getattr(_weather, "_multi_model_cache", {}) or {})
|
||||
metar_entries = len(getattr(_weather, "_metar_cache", {}) or {})
|
||||
taf_entries = len(getattr(_weather, "_taf_cache", {}) or {})
|
||||
nmc_entries = len(getattr(_weather, "_nmc_cache", {}) or {})
|
||||
settlement_entries = len(getattr(_weather, "_settlement_cache", {}) or {})
|
||||
|
||||
gauge_set("polyweather_api_cache_entries", len(_cache))
|
||||
@@ -434,7 +433,6 @@ def _cache_summary() -> Dict[str, Any]:
|
||||
gauge_set("polyweather_open_meteo_multi_model_cache_entries", open_meteo_multi_model_entries)
|
||||
gauge_set("polyweather_metar_cache_entries", metar_entries)
|
||||
gauge_set("polyweather_taf_cache_entries", taf_entries)
|
||||
gauge_set("polyweather_nmc_cache_entries", nmc_entries)
|
||||
gauge_set("polyweather_settlement_cache_entries", settlement_entries)
|
||||
return {
|
||||
"api_cache_entries": len(_cache),
|
||||
@@ -443,7 +441,6 @@ def _cache_summary() -> Dict[str, Any]:
|
||||
"open_meteo_multi_model_entries": open_meteo_multi_model_entries,
|
||||
"metar_entries": metar_entries,
|
||||
"taf_entries": taf_entries,
|
||||
"nmc_entries": nmc_entries,
|
||||
"settlement_entries": settlement_entries,
|
||||
"analysis": get_analysis_cache_stats(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user