feat: add AMSC runway observations

This commit is contained in:
2569718930@qq.com
2026-05-15 01:41:49 +08:00
parent c4b1844a67
commit 4cc579ccb3
15 changed files with 823 additions and 14 deletions
@@ -1,6 +1,8 @@
import type { CityDetail } from "@/lib/dashboard-types";
export type MonitorTemperatureSource =
| "amsc_awos_runway_max"
| "amsc_awos_runway"
| "amos_runway_median"
| "amos_runway"
| "amos"
@@ -36,6 +38,13 @@ export function getAmosRunwayTemperature(detail?: CityDetail | null) {
const values = runwayTemps
.map((pair) => finiteNumber(pair?.[0]))
.filter((value): value is number => value != null);
if (detail?.amos?.source === "amsc_awos") {
if (!values.length) return null;
return {
source: values.length > 1 ? "amsc_awos_runway_max" : "amsc_awos_runway",
value: Math.max(...values),
} satisfies MonitorTemperature;
}
const value = median(values);
if (value == null) return null;
return {