Use DEB values in multi-day forecasts
This commit is contained in:
@@ -926,9 +926,12 @@ function renderDecision(detail) {
|
|||||||
function renderForecast(detail) {
|
function renderForecast(detail) {
|
||||||
const symbol = detail?.temp_symbol || "°C";
|
const symbol = detail?.temp_symbol || "°C";
|
||||||
const daily = Array.isArray(detail?.forecast?.daily) ? detail.forecast.daily : [];
|
const daily = Array.isArray(detail?.forecast?.daily) ? detail.forecast.daily : [];
|
||||||
|
const dailyDeb = detail?.multi_model_daily || {};
|
||||||
els.forecastRow.innerHTML = "";
|
els.forecastRow.innerHTML = "";
|
||||||
for (let i = 0; i < Math.min(daily.length, 6); i += 1) {
|
for (let i = 0; i < Math.min(daily.length, 6); i += 1) {
|
||||||
const day = daily[i];
|
const day = daily[i];
|
||||||
|
const debValue = dailyDeb?.[day?.date]?.deb?.prediction;
|
||||||
|
const displayTemp = debValue ?? day?.max_temp;
|
||||||
const card = document.createElement("div");
|
const card = document.createElement("div");
|
||||||
card.className = `forecast-card ${i === 0 ? "today" : ""}`;
|
card.className = `forecast-card ${i === 0 ? "today" : ""}`;
|
||||||
|
|
||||||
@@ -939,7 +942,7 @@ function renderForecast(detail) {
|
|||||||
|
|
||||||
const v = document.createElement("div");
|
const v = document.createElement("div");
|
||||||
v.className = "f-temp";
|
v.className = "f-temp";
|
||||||
v.textContent = formatTemp(day?.max_temp, symbol);
|
v.textContent = formatTemp(displayTemp, symbol);
|
||||||
card.appendChild(v);
|
card.appendChild(v);
|
||||||
|
|
||||||
els.forecastRow.appendChild(card);
|
els.forecastRow.appendChild(card);
|
||||||
@@ -1023,6 +1026,10 @@ function normalizeAggregateDetail(payload) {
|
|||||||
forecast: {
|
forecast: {
|
||||||
daily: Array.isArray(timeseries.forecast_daily) ? timeseries.forecast_daily : []
|
daily: Array.isArray(timeseries.forecast_daily) ? timeseries.forecast_daily : []
|
||||||
},
|
},
|
||||||
|
multi_model_daily:
|
||||||
|
timeseries.multi_model_daily && typeof timeseries.multi_model_daily === "object"
|
||||||
|
? timeseries.multi_model_daily
|
||||||
|
: {},
|
||||||
hourly: timeseries.hourly || { times: [], temps: [] },
|
hourly: timeseries.hourly || { times: [], temps: [] },
|
||||||
metar_today_obs: timeseries.metar_today_obs || [],
|
metar_today_obs: timeseries.metar_today_obs || [],
|
||||||
settlement_today_obs: timeseries.settlement_today_obs || [],
|
settlement_today_obs: timeseries.settlement_today_obs || [],
|
||||||
|
|||||||
@@ -711,6 +711,10 @@ export function ForecastTable() {
|
|||||||
if (!data) return null;
|
if (!data) return null;
|
||||||
|
|
||||||
const daily = data.forecast?.daily || [];
|
const daily = data.forecast?.daily || [];
|
||||||
|
const resolveForecastTemp = (date: string, fallback: number | null | undefined) => {
|
||||||
|
const debPrediction = data.multi_model_daily?.[date]?.deb?.prediction;
|
||||||
|
return debPrediction ?? fallback ?? null;
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<section className="forecast-section">
|
<section className="forecast-section">
|
||||||
<h3>{t("forecast.title")}</h3>
|
<h3>{t("forecast.title")}</h3>
|
||||||
@@ -744,7 +748,7 @@ export function ForecastTable() {
|
|||||||
: day.date.substring(5).replace("-", "/")}
|
: day.date.substring(5).replace("-", "/")}
|
||||||
</div>
|
</div>
|
||||||
<div className="f-temp">
|
<div className="f-temp">
|
||||||
{day.max_temp}
|
{resolveForecastTemp(day.date, day.max_temp)}
|
||||||
{data.temp_symbol}
|
{data.temp_symbol}
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user