Remove Wunderground settlement reference from chart

This commit is contained in:
2569718930@qq.com
2026-04-05 07:24:09 +08:00
parent a5b5711863
commit b93a917f88
+8 -20
View File
@@ -288,8 +288,10 @@ export function getTemperatureChartData(
observationCode === "cwa" || observationCode === "cwa" ||
observationCode === "noaa" || observationCode === "noaa" ||
observationCode === "wunderground"; observationCode === "wunderground";
const useSettlementObservationSource =
settlementSource && observationCode !== "wunderground";
const officialObservationSource = const officialObservationSource =
settlementSource useSettlementObservationSource
? detail.settlement_today_obs?.length ? detail.settlement_today_obs?.length
? detail.settlement_today_obs ? detail.settlement_today_obs
: detail.current?.obs_time && detail.current?.temp != null : detail.current?.obs_time && detail.current?.temp != null
@@ -299,36 +301,28 @@ export function getTemperatureChartData(
const metarObservationSource = detail.metar_today_obs?.length const metarObservationSource = detail.metar_today_obs?.length
? detail.metar_today_obs ? detail.metar_today_obs
: detail.trend?.recent || []; : detail.trend?.recent || [];
const allowMetarFallback = const allowMetarFallback = settlementSource && observationCode !== "hko";
settlementSource &&
observationCode !== "hko" &&
observationCode !== "wunderground";
const shouldUseMetarFallback = const shouldUseMetarFallback =
allowMetarFallback && allowMetarFallback &&
officialObservationSource.length > 0 && officialObservationSource.length > 0 &&
officialObservationSource.length < 3 && officialObservationSource.length < 3 &&
metarObservationSource.length >= 3; metarObservationSource.length >= 3;
const observationSource = settlementSource const observationSource = useSettlementObservationSource
? shouldUseMetarFallback ? shouldUseMetarFallback
? metarObservationSource ? metarObservationSource
: officialObservationSource : officialObservationSource
: metarObservationSource; : metarObservationSource;
const airportMetarSource = const airportMetarSource: Array<{ time?: string; temp?: number | null }> = [];
settlementSource && observationCode === "wunderground"
? metarObservationSource
: [];
const metarFallbackTag = (() => { const metarFallbackTag = (() => {
const icao = String(detail.risk?.icao || "").trim().toUpperCase(); const icao = String(detail.risk?.icao || "").trim().toUpperCase();
if (!icao) return "METAR"; if (!icao) return "METAR";
return `${icao} METAR`; return `${icao} METAR`;
})(); })();
const observationDisplayTag = const observationDisplayTag =
settlementSource && shouldUseMetarFallback useSettlementObservationSource && shouldUseMetarFallback
? metarFallbackTag ? metarFallbackTag
: observationCode === "noaa" : observationCode === "noaa"
? `NOAA ${getNoaaStationCode(detail)}` ? `NOAA ${getNoaaStationCode(detail)}`
: observationCode === "wunderground"
? "Wunderground"
: observationTag; : observationTag;
const metarPoints = new Array(times.length).fill(null); const metarPoints = new Array(times.length).fill(null);
@@ -617,12 +611,6 @@ export function getTemperatureChartData(
? `This city settles on NOAA ${noaaCode} using the finalized highest rounded whole-degree Celsius Temp reading; the plotted line is a settlement reference.` ? `This city settles on NOAA ${noaaCode} using the finalized highest rounded whole-degree Celsius Temp reading; the plotted line is a settlement reference.`
: `该城市按 NOAA ${noaaCode} 最终完成质控后的最高整度摄氏 Temp 读数结算;图中曲线仅作为结算参考线。`, : `该城市按 NOAA ${noaaCode} 最终完成质控后的最高整度摄氏 Temp 读数结算;图中曲线仅作为结算参考线。`,
); );
} else if (observationCode === "wunderground") {
legendParts.push(
isEnglish(locale)
? "This city settles on the configured Wunderground station; the plotted observation points follow that settlement source."
: "该城市按配置的 Wunderground 站点结算;图中实测点位按该结算源展示。",
);
} }
if (tafMarkers.length) { if (tafMarkers.length) {
const primaryTafMarker = currentTafMarker || nextTafMarker; const primaryTafMarker = currentTafMarker || nextTafMarker;
@@ -663,7 +651,7 @@ export function getTemperatureChartData(
temps, temps,
}, },
observationLabel: observationLabel:
(observationCode === "noaa" || observationCode === "wunderground") && observationCode === "noaa" &&
!shouldUseMetarFallback !shouldUseMetarFallback
? isEnglish(locale) ? isEnglish(locale)
? `${observationDisplayTag} Settlement Reference` ? `${observationDisplayTag} Settlement Reference`