Clarify METAR anchor labeling in weather forecasts

This commit is contained in:
2569718930@qq.com
2026-04-17 00:19:47 +08:00
parent 910a4aa0a0
commit 8db933a47c
4 changed files with 230 additions and 28 deletions
+18 -6
View File
@@ -106,7 +106,12 @@ function getObservationSourceTag(detail: CityDetail): string {
if (code === "hko") return "HKO";
if (code === "cwa") return "CWA";
if (code === "noaa") return "NOAA";
if (code === "wunderground") return "WUNDERGROUND";
if (code === "wunderground") {
const icao = String(detail.risk?.icao || detail.current?.station_code || "")
.trim()
.toUpperCase();
return icao ? `${icao} METAR` : "METAR";
}
if (code === "mgm") return "MGM";
return "METAR";
}
@@ -819,7 +824,7 @@ export function getTemperatureChartData(
: observationCode === "wunderground" && usingMetarObservationSource
? metarFallbackTag
: observationCode === "wunderground"
? `WU ${String(detail.risk?.icao || "").trim().toUpperCase() || "STATION"}`
? metarFallbackTag
: useSettlementObservationSource && shouldUseMetarFallback
? metarFallbackTag
: observationCode === "noaa"
@@ -3190,8 +3195,7 @@ export function getCityProfileStats(detail: CityDetail, locale: Locale = "zh-CN"
const isOfficialSource =
sourceCode === "hko" ||
sourceCode === "cwa" ||
sourceCode === "noaa" ||
sourceCode === "wunderground";
sourceCode === "noaa";
const sourceDisplay = (() => {
if (sourceCode === "hko") {
@@ -3211,6 +3215,15 @@ export function getCityProfileStats(detail: CityDetail, locale: Locale = "zh-CN"
? `${noaaName}${noaaCode ? ` (${noaaCode})` : ""}`
: `${noaaName}${noaaCode ? `${noaaCode}` : ""}`;
}
if (sourceCode === "wunderground") {
const icao = String(detail.risk?.icao || detail.current?.station_code || "")
.trim()
.toUpperCase();
const stationName = String(
detail.current?.station_name || detail.risk?.airport || "",
).trim();
return `${stationName || icao || "Airport"}${icao ? ` (${icao} METAR)` : " METAR"}`;
}
const stationName = String(
detail.current?.station_name || detail.risk?.airport || "",
).trim();
@@ -3343,8 +3356,7 @@ export function getSettlementRiskNarrative(
const stationTerm =
sourceCode === "hko" ||
sourceCode === "cwa" ||
sourceCode === "noaa" ||
sourceCode === "wunderground"
sourceCode === "noaa"
? isEnglish(locale)
? "settlement reference station"
: "结算参考站"