diff --git a/src/data_collection/amos_station_sources.py b/src/data_collection/amos_station_sources.py index b2b6d3bc..b4862793 100644 --- a/src/data_collection/amos_station_sources.py +++ b/src/data_collection/amos_station_sources.py @@ -384,12 +384,13 @@ class AmosStationSourceMixin: return None if text and re.search(rf"\({icao}\)|\b(?:METAR|TAF)\s+{icao}\b", text, re.I): + logger.info("AMOS page matched icao={} length={}", icao, len(text)) record_source_call("amos", "page", "success", (time.perf_counter() - started) * 1000.0) return text - logger.debug("AMOS page did not expose requested airport {}", icao) + logger.warning("AMOS page did not expose requested airport {} (tried {} urls)", icao, len(urls)) return None except Exception as exc: - logger.debug("AMOS page fetch failed icao={}: {}", icao, exc) + logger.warning("AMOS page fetch failed icao={}: {}", icao, exc) record_source_call("amos", "page", "error", (time.perf_counter() - started) * 1000.0) return None @@ -419,8 +420,11 @@ class AmosStationSourceMixin: try: html = self._amos_get_page(icao) if not html: + logger.warning("AMOS fetch_amos_official_current: no HTML for {}", icao) return None + logger.info("AMOS fetch_amos_official_current: got HTML for {} ({} chars), parsing METAR/runway", icao, len(html)) + # Parse METAR line icao_pattern = re.escape(icao) metar_match = re.search(rf"METAR\s+{icao_pattern}\s.*?=", html, re.DOTALL) diff --git a/src/data_collection/weather_sources.py b/src/data_collection/weather_sources.py index c412435e..81341e7a 100644 --- a/src/data_collection/weather_sources.py +++ b/src/data_collection/weather_sources.py @@ -879,13 +879,19 @@ class WeatherDataCollector(OpenMeteoCacheMixin, SettlementSourceMixin, MetarSour if city_lower not in ("seoul", "busan"): return try: + logger.info("AMOS: fetching for city={}", city_lower) amos_data = self.fetch_amos_official_current( city_lower, use_fahrenheit=use_fahrenheit ) if amos_data: + logger.info("AMOS: got data for city={} temp_c={} source={} runway_pairs={}", + city_lower, amos_data.get("temp_c"), amos_data.get("temp_source"), + len(amos_data.get("runway_obs", {}).get("runway_pairs", []) or [])) results["amos"] = amos_data + else: + logger.warning("AMOS: no data returned for city={}", city_lower) except Exception as exc: - logger.debug("AMOS attach failed city={}: {}", city_lower, exc) + logger.warning("AMOS attach failed city={}: {}", city_lower, exc) def _attach_russia_official_nearby( self, results: Dict, city_lower: str, use_fahrenheit: bool diff --git a/web/analysis_service.py b/web/analysis_service.py index 0d48af17..3a71cef8 100644 --- a/web/analysis_service.py +++ b/web/analysis_service.py @@ -1733,6 +1733,9 @@ def _analyze( mg_cur = mgm.get("current", {}) if mgm else {} sc_cur = settlement_current.get("current", {}) if settlement_current else {} amos_data = raw.get("amos") or {} + if amos_data: + logger.info("AMOS _analyze: found amos data for city={} temp_c={} source={}", + city, amos_data.get("temp_c"), amos_data.get("source")) use_settlement_current = settlement_source in {"hko", "cwa", "noaa", "wunderground"} and bool(sc_cur) live_mc = mc if metar_current_is_today else {} primary_current = sc_cur if use_settlement_current else live_mc