Preserve hourly peak observations in temperature charts
This commit is contained in:
@@ -276,8 +276,13 @@ export function getTemperatureChartData(
|
|||||||
if (Number.isNaN(hour)) return;
|
if (Number.isNaN(hour)) return;
|
||||||
const key = `${String(hour).padStart(2, "0")}:00`;
|
const key = `${String(hour).padStart(2, "0")}:00`;
|
||||||
const index = times.indexOf(key);
|
const index = times.indexOf(key);
|
||||||
if (index >= 0 && metarPoints[index] === null) {
|
const temp = item.temp ?? null;
|
||||||
metarPoints[index] = item.temp ?? null;
|
if (index >= 0 && temp != null) {
|
||||||
|
const existing = metarPoints[index];
|
||||||
|
// Multiple reports can land in the same hour bucket. Keep the peak
|
||||||
|
// value so an intrahour high is not hidden by a later weaker report.
|
||||||
|
metarPoints[index] =
|
||||||
|
existing == null ? temp : Math.max(Number(existing), Number(temp));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user