AMOS 跑道温度范围:城市决策卡头部展示"跑道实况 14.6~15.2℃"
后端: - amos_station_sources.py 新增 runway_temp_range (跑道温度 min,max) - 取所有有效跑道温度的最小值和最大值 前端: - CityCardHeader 新增 observedLabel prop(标签自定义) - 有 AMOS 数据时显示"跑道实况"替代"当前温度" - 温度展示格式:14.6~15.2℃(跑道温度范围) - 无 AMOS 时回退原有 METAR 温度显示
This commit is contained in:
@@ -388,8 +388,11 @@ export function AiPinnedCityCard({
|
||||
decisionExpectedHighNumber != null
|
||||
? formatTemperatureValue(decisionExpectedHighNumber, tempSymbol, { digits: 1 })
|
||||
: "--";
|
||||
const currentTempText =
|
||||
currentTempNumber != null
|
||||
const amosRange = detail?.amos?.runway_temp_range;
|
||||
const observedLabel = amosRange ? (isEn ? "Runway" : "跑道实况") : undefined;
|
||||
const currentTempText = amosRange
|
||||
? `${amosRange[0].toFixed(1)}~${amosRange[1].toFixed(1)}${tempSymbol}`
|
||||
: currentTempNumber != null
|
||||
? formatTemperatureValue(currentTempNumber, tempSymbol, { digits: 1 })
|
||||
: "--";
|
||||
const debText =
|
||||
@@ -597,6 +600,7 @@ export function AiPinnedCityCard({
|
||||
collapseId={collapseId}
|
||||
collapsed={collapsed}
|
||||
currentTempText={currentTempText}
|
||||
observedLabel={observedLabel}
|
||||
dataFreshnessRows={dataFreshnessRows}
|
||||
debText={debText}
|
||||
detailLocalTime={detail?.local_time}
|
||||
|
||||
@@ -18,6 +18,7 @@ export function CityCardHeader({
|
||||
collapseId,
|
||||
collapsed,
|
||||
currentTempText,
|
||||
observedLabel,
|
||||
dataFreshnessRows,
|
||||
debText,
|
||||
detailLocalTime,
|
||||
@@ -40,6 +41,7 @@ export function CityCardHeader({
|
||||
collapseId: string;
|
||||
collapsed: boolean;
|
||||
currentTempText: string;
|
||||
observedLabel?: string;
|
||||
dataFreshnessRows: DataFreshnessRow[];
|
||||
debText: string;
|
||||
detailLocalTime?: string | null;
|
||||
@@ -76,7 +78,7 @@ export function CityCardHeader({
|
||||
<div className="scan-ai-city-hero-side">
|
||||
<div className="scan-ai-city-metrics">
|
||||
<span>
|
||||
<small>{isEn ? "Observed" : "当前温度"}</small>
|
||||
<small>{observedLabel || (isEn ? "Observed" : "当前温度")}</small>
|
||||
<b>{currentTempText}</b>
|
||||
</span>
|
||||
<span className="primary">
|
||||
|
||||
@@ -923,6 +923,7 @@ export interface AmosData {
|
||||
wind_kt?: number | null;
|
||||
temp_source?: string | null;
|
||||
runway_temps?: Array<[number | null, number | null]> | null;
|
||||
runway_temp_range?: [number, number] | null;
|
||||
source?: string | null;
|
||||
source_label?: string | null;
|
||||
icao?: string | null;
|
||||
|
||||
@@ -490,6 +490,7 @@ class AmosStationSourceMixin:
|
||||
"wind_kt": wind_kt,
|
||||
"temp_source": temp_source,
|
||||
"runway_temps": runway_temps,
|
||||
"runway_temp_range": None,
|
||||
"source": "amos",
|
||||
"source_label": f"AMOS {airport_meta['label_en']} ({icao})",
|
||||
"source_code": "amos",
|
||||
@@ -508,6 +509,13 @@ class AmosStationSourceMixin:
|
||||
"observation_time": datetime.now().strftime("%Y-%m-%dT%H:%M:%S"),
|
||||
}
|
||||
|
||||
# Compute runway temp range for compact display ("14.6~15.2")
|
||||
valid = [t[0] for t in runway_temps if t[0] is not None and -50 < float(t[0]) < 60]
|
||||
if len(valid) >= 2:
|
||||
result["runway_temp_range"] = (round(min(valid), 1), round(max(valid), 1))
|
||||
elif len(valid) == 1:
|
||||
result["runway_temp_range"] = (round(valid[0], 1), round(valid[0], 1))
|
||||
|
||||
record_source_call(
|
||||
"amos", "current", "success",
|
||||
(time.perf_counter() - started) * 1000.0,
|
||||
|
||||
Reference in New Issue
Block a user