feat: model comparison picto timeline

This commit is contained in:
terraputix
2026-02-16 11:46:53 +01:00
parent 84eefd538b
commit bed6e3aa53
5 changed files with 190 additions and 19 deletions
+8 -2
View File
@@ -222,6 +222,8 @@ export interface ModelCompareResult {
utcOffsetSeconds: number;
timezone: string;
markAreas: MarkArea[];
sunrise: number[];
sunset: number[];
units: Record<string, string>;
/** Flat record compatible with the existing chart utilities (keys like "temperature_2m_icon_seamless") */
hourlyFlat: Record<string, number[]>;
@@ -408,12 +410,14 @@ export async function fetchModelComparison(
// Extract sunrise/sunset from the first response's daily block
let markAreas: MarkArea[] = [];
let sunrise: number[] = [];
let sunset: number[] = [];
const dailyBlock = firstResponse.daily();
if (dailyBlock) {
const sunriseVar = dailyBlock.variables(0)!;
const sunsetVar = dailyBlock.variables(1)!;
const sunrise = getInt64Values(sunriseVar);
const sunset = getInt64Values(sunsetVar);
sunrise = getInt64Values(sunriseVar);
sunset = getInt64Values(sunsetVar);
markAreas = buildDaylightMarkAreas(sunrise, sunset);
}
@@ -471,6 +475,8 @@ export async function fetchModelComparison(
utcOffsetSeconds,
timezone,
markAreas,
sunrise,
sunset,
units,
hourlyFlat,
hourlyUnitsFlat