Generalize NOAA settlement handling across dashboard and docs
This commit is contained in:
@@ -549,10 +549,18 @@ export function FutureForecastModal() {
|
||||
"--score-position": scorePosition,
|
||||
} as CSSProperties & { "--score-position": string };
|
||||
const weatherSummary = getWeatherSummary(detail, locale);
|
||||
const isTaipeiNoaa =
|
||||
store.selectedCity === "taipei" &&
|
||||
(detail.current?.settlement_source === "noaa" ||
|
||||
detail.current?.settlement_source_label === "NOAA");
|
||||
const isNoaaSettlement =
|
||||
detail.current?.settlement_source === "noaa" ||
|
||||
detail.current?.settlement_source_label === "NOAA";
|
||||
const noaaStationCode = String(
|
||||
detail.current?.station_code || detail.risk?.icao || "NOAA",
|
||||
)
|
||||
.trim()
|
||||
.toUpperCase();
|
||||
const noaaStationName =
|
||||
String(detail.current?.station_name || "").trim() ||
|
||||
String(detail.risk?.airport || "").trim() ||
|
||||
noaaStationCode;
|
||||
const marketMidpoint = formatMarketPercent(
|
||||
marketScan?.market_price ?? marketScan?.yes_token?.implied_probability,
|
||||
);
|
||||
@@ -810,9 +818,9 @@ export function FutureForecastModal() {
|
||||
: "香港天文台 (HKO)"
|
||||
: settlementSourceCode === "noaa"
|
||||
? locale === "en-US"
|
||||
? "NOAA RCTP (Taiwan Taoyuan International Airport)"
|
||||
: "NOAA RCTP(台湾桃园国际机场)"
|
||||
: settlementSourceCode === "cwa"
|
||||
? `NOAA ${noaaStationCode} (${noaaStationName})`
|
||||
: `NOAA ${noaaStationCode}(${noaaStationName})`
|
||||
: settlementSourceCode === "cwa"
|
||||
? locale === "en-US"
|
||||
? "Central Weather Administration (CWA)"
|
||||
: "交通部中央气象署 (CWA)"
|
||||
@@ -948,7 +956,7 @@ export function FutureForecastModal() {
|
||||
</button>
|
||||
</div>
|
||||
<div className="modal-body future-modal-body">
|
||||
{isTaipeiNoaa && (
|
||||
{isNoaaSettlement && (
|
||||
<div
|
||||
style={{
|
||||
marginBottom: "16px",
|
||||
@@ -962,8 +970,8 @@ export function FutureForecastModal() {
|
||||
}}
|
||||
>
|
||||
{locale === "en-US"
|
||||
? "Taipei now settles against NOAA RCTP (Taiwan Taoyuan International Airport). The market uses the highest rounded whole-degree Celsius reading in the Temp column after the day is finalized."
|
||||
: "台北当前按 NOAA RCTP(台湾桃园国际机场)结算。市场最终采用该日 Temp 列完成质控后的最高整度摄氏值,不按小数温度结算。"}
|
||||
? `${detail.display_name} now settles against NOAA ${noaaStationCode} (${noaaStationName}). The market uses the highest rounded whole-degree Celsius reading in the Temp column after the day is finalized.`
|
||||
: `${detail.display_name} 当前按 NOAA ${noaaStationCode}(${noaaStationName})结算。市场最终采用该日 Temp 列完成质控后的最高整度摄氏值,不按小数温度结算。`}
|
||||
</div>
|
||||
)}
|
||||
{isToday ? (
|
||||
|
||||
@@ -12,7 +12,16 @@ function HistoryChart() {
|
||||
const store = useDashboardStore();
|
||||
const { locale } = useI18n();
|
||||
const { data } = useHistoryData();
|
||||
const isTaipei = store.selectedCity === "taipei";
|
||||
const isNoaaSettlement =
|
||||
store.selectedDetail?.current?.settlement_source === "noaa" ||
|
||||
store.selectedDetail?.current?.settlement_source_label === "NOAA";
|
||||
const noaaStationCode = String(
|
||||
store.selectedDetail?.current?.station_code ||
|
||||
store.selectedDetail?.risk?.icao ||
|
||||
"NOAA",
|
||||
)
|
||||
.trim()
|
||||
.toUpperCase();
|
||||
const summary = useMemo(
|
||||
() => getHistorySummary(data, store.selectedDetail?.local_date),
|
||||
[data, store.selectedDetail?.local_date],
|
||||
@@ -34,10 +43,10 @@ function HistoryChart() {
|
||||
borderColor: "#f87171",
|
||||
borderWidth: 2,
|
||||
data: summary.actuals,
|
||||
label: isTaipei
|
||||
label: isNoaaSettlement
|
||||
? locale === "en-US"
|
||||
? "NOAA Settled High (RCTP)"
|
||||
: "NOAA 结算最高温 (RCTP)"
|
||||
? `NOAA Settled High (${noaaStationCode})`
|
||||
: `NOAA 结算最高温 (${noaaStationCode})`
|
||||
: locale === "en-US"
|
||||
? "Observed High"
|
||||
: "实测最高温",
|
||||
@@ -142,7 +151,7 @@ function HistoryChart() {
|
||||
},
|
||||
type: "line",
|
||||
} satisfies ChartConfiguration<"line">;
|
||||
}, [hasBestBaseline, hasMgm, isTaipei, summary, locale]);
|
||||
}, [hasBestBaseline, hasMgm, isNoaaSettlement, noaaStationCode, summary, locale]);
|
||||
|
||||
if (!summary.recentData.length) return null;
|
||||
|
||||
@@ -159,7 +168,20 @@ export function HistoryModal() {
|
||||
const { data, error, isLoading, isOpen } = useHistoryData();
|
||||
const isPro = store.proAccess.subscriptionActive;
|
||||
const isProLoading = store.proAccess.loading;
|
||||
const isTaipei = store.selectedCity === "taipei";
|
||||
const isNoaaSettlement =
|
||||
store.selectedDetail?.current?.settlement_source === "noaa" ||
|
||||
store.selectedDetail?.current?.settlement_source_label === "NOAA";
|
||||
const noaaStationCode = String(
|
||||
store.selectedDetail?.current?.station_code ||
|
||||
store.selectedDetail?.risk?.icao ||
|
||||
"NOAA",
|
||||
)
|
||||
.trim()
|
||||
.toUpperCase();
|
||||
const noaaStationName =
|
||||
String(store.selectedDetail?.current?.station_name || "").trim() ||
|
||||
String(store.selectedDetail?.risk?.airport || "").trim() ||
|
||||
noaaStationCode;
|
||||
const summary = useMemo(
|
||||
() => getHistorySummary(data, store.selectedDetail?.local_date),
|
||||
[data, store.selectedDetail?.local_date],
|
||||
@@ -221,7 +243,7 @@ export function HistoryModal() {
|
||||
</button>
|
||||
</div>
|
||||
<div className="modal-body">
|
||||
{isTaipei && (
|
||||
{isNoaaSettlement && (
|
||||
<div
|
||||
style={{
|
||||
marginBottom: "16px",
|
||||
@@ -235,8 +257,8 @@ export function HistoryModal() {
|
||||
}}
|
||||
>
|
||||
{t("lang") === "en-US"
|
||||
? "Taipei historical actuals are aligned to NOAA RCTP settlement rules: use the highest rounded whole-degree Celsius reading after the date is finalized."
|
||||
: "台北历史对账已按 NOAA RCTP 结算口径对齐:采用该日最终完成质控后的最高整度摄氏值。"}
|
||||
? `${store.selectedDetail?.display_name || store.selectedCity || "This city"} historical actuals are aligned to NOAA ${noaaStationCode} (${noaaStationName}) settlement rules: use the highest rounded whole-degree Celsius reading after the date is finalized.`
|
||||
: `${store.selectedDetail?.display_name || store.selectedCity || "该城市"}历史对账已按 NOAA ${noaaStationCode}(${noaaStationName})结算口径对齐:采用该日最终完成质控后的最高整度摄氏值。`}
|
||||
</div>
|
||||
)}
|
||||
<div className="history-stats">
|
||||
|
||||
Reference in New Issue
Block a user