diff --git a/dashboard/index.html b/dashboard/index.html index 054a3a8..1e6dfe7 100644 --- a/dashboard/index.html +++ b/dashboard/index.html @@ -237,10 +237,12 @@ body.cold .cheek{opacity:.95} - - - - + + + + + + @@ -497,6 +499,11 @@ function summarize(d, dateStr, fromHour){ s.wet = !s.snowy && (s.rainProb >= 50 || s.precip >= 0.05); s.sunny = codes.filter(c => c <= 2).length >= codes.length / 2; s.foggy = codes.filter(c => c === 45 || c === 48).length >= 2; + // the day's sky = what most of the daytime hours look like (0 clear, 1 partly, 2 cloudy) + const cloudiness = codes.map(c => ({ sun: 0, partly: 1 })[kindOf(c)] ?? 2); + const avg = cloudiness.length ? sum(cloudiness) / cloudiness.length : 1; + s.sky = codes.filter(c => c === 45 || c === 48).length > codes.length / 2 ? "fog" + : avg < 0.5 ? "sun" : avg < 1.4 ? "partly" : "cloud"; return s; } @@ -652,7 +659,7 @@ function render(){ if (plan.o.backpack) plan.chips.push(["Backpack", "#2E7D5B"]); // the "scene" weather kind for the day - const dayKind = s.storm ? "storm" : s.snowy ? "snow" : s.wet ? "rain" : kindOf(D.weather_code[di]) === "rain" ? "cloud" : kindOf(D.weather_code[di]); + const dayKind = s.storm ? "storm" : s.snowy ? "snow" : s.wet ? "rain" : s.sky; dressKid(plan.o, dayKind, QS.get("season") || seasonOf(target), s); document.body.classList.toggle("cold", s.coldFeel < 40); @@ -672,7 +679,7 @@ function render(){ $("pill").textContent = tomorrow ? "High · " + fw : fw; $("pill").style.background = fc; let desc = DESC[bigCode] || ""; if (!isDay && bigCode <= 1) desc = "Clear night"; - if (tomorrow) desc = { storm: "Thunderstorms", snow: "Snowy", rain: "Rainy" }[dayKind] || DESC[D.weather_code[di]] || ""; + if (tomorrow) desc = { storm: "Thunderstorms", snow: "Snowy", rain: "Rainy", sun: "Sunny", partly: "Partly cloudy", cloud: "Cloudy", fog: "Foggy" }[dayKind]; $("desc").textContent = desc; $("hilo").innerHTML = `High ${r(D.temperature_2m_max[di])}°  Low ${r(D.temperature_2m_min[di])}°`;