New heat bands for UTCI and Air -using latest research values
This commit is contained in:
fraxle
2026-07-09 11:41:31 +01:00
parent e2f8f8cc53
commit eea78c2bc4
5 changed files with 38 additions and 24 deletions
+9
View File
@@ -387,6 +387,15 @@ em { color: #7a5c2a; font-style: italic; }
color: #3a2a12;
}
.stress-table td ul {
margin: 0;
padding-left: 1.1rem;
}
.stress-table td ul li {
margin: 0.15rem 0;
}
.swatch {
display: inline-block;
width: 12px; height: 12px;
+5 -5
View File
@@ -1644,8 +1644,8 @@ export function UTCIForecast() {
<div class="insight-panel insight-panel--glance">
<div class="insight-panel-title">At a glance${glanceDate ? ` · ${glanceDate}` : ''}</div>
${(() => {
const heatEvents = eventGlanceItems.filter(e => /heat spike|heat warning|extreme heat/i.test(e.label)).map(e => ({ ...e, alert: true }));
const otherEvents = eventGlanceItems.filter(e => !/heat spike|heat warning|extreme heat/i.test(e.label));
const heatEvents = eventGlanceItems.filter(e => /heat caution|heat warning|extreme heat/i.test(e.label)).map(e => ({ ...e, alert: true }));
const otherEvents = eventGlanceItems.filter(e => !/heat caution|heat warning|extreme heat/i.test(e.label));
const renderRow = ({ icon, label, value, alert }, keyPrefix = '') => html`
<div class=${`insight-row${alert ? ' insight-row--alert' : ''}`} key=${`${keyPrefix}${label}`}>
<span class="insight-icon">${icon}</span>
@@ -1760,9 +1760,9 @@ export function UTCIForecast() {
{ t: 1, label: 'Cold' },
{ t: 11, label: 'Cool' },
{ t: 21, label: 'Comfortable', bold: true },
{ t: 31, label: 'Hot' },
{ t: 41, label: 'Very hot' },
{ t: 51, label: 'Danger' },
{ t: 29, label: 'Caution' },
{ t: 36, label: 'Extreme' },
{ t: 47, label: 'Danger' },
].map((b, i) => {
const rgb = airTempRgb(b.t) || [200, 200, 200];
const mid = `rgb(${rgb[0]},${rgb[1]},${rgb[2]})`;
+14 -8
View File
@@ -109,28 +109,34 @@ export function checkSunset(rows, location) {
};
}
// Thresholds are for plain shade/air temperature, not UTCI felt temperature,
// so they sit well below the UTCI Caution/Extreme/Danger bands
// (utils.js UTCI_BANDS). 27°C is the midpoint of the Met Office's official UK
// heatwave threshold (25°C in cooler regions to 28°C in the SE); 32°C and
// 38°C scale up from there, with 38°C sitting just under the UK's all-time
// record shade temperature of 40.3°C.
export function checkHeatSpike(rows) {
const maxTemp = Math.max(...rows.map(r => r.Ta).filter(isFinite));
if (maxTemp < 30) return null;
const severity = maxTemp >= 36 ? 'extreme' : maxTemp >= 33 ? 'severe' : 'notable';
if (maxTemp < 27) return null;
const severity = maxTemp >= 38 ? 'danger' : maxTemp >= 32 ? 'extreme-caution' : 'caution';
// Only flag the hours that are actually at/above the heat threshold.
const affected = rows.filter(r => isFinite(r.Ta) && r.Ta >= 30);
const affected = rows.filter(r => isFinite(r.Ta) && r.Ta >= 27);
const isoRange = affected.length
? [affected[0].iso, affected[affected.length - 1].iso]
: undefined;
const msgs = {
notable: `Air temperature reaching ${maxTemp.toFixed(1)}°C — above seasonal norms. Stay hydrated and avoid prolonged sun exposure.`,
severe: `Heat warning: Air temp ${maxTemp.toFixed(1)}°C expected today. Risk of heat exhaustion for vulnerable people — keep cool and hydrated.`,
extreme: `Extreme heat alert: Air temp ${maxTemp.toFixed(1)}°C forecast. Risk of heat stroke — avoid outdoor activity during peak hours.`,
'caution': `Air temperature reaching ${maxTemp.toFixed(1)}°C. Avoid strenuous activity outdoors, drink plenty of fluids, and wear light clothing.`,
'extreme-caution': `Heat warning: Air temp ${maxTemp.toFixed(1)}°C expected today. Take frequent breaks indoors in the air conditioning, avoid strenuous activity, drink plenty of fluids, and wear light clothing.`,
'danger': `Extreme heat alert: Air temp ${maxTemp.toFixed(1)}°C forecast. Limit time spent outdoors and stay indoors with the air conditioning on as much as possible. Avoid strenuous activity, drink plenty of fluids, and wear light clothing.`,
};
return {
id: 'heat-spike',
emoji: '🔥',
title: severity === 'extreme' ? 'Extreme Heat Alert' : severity === 'severe' ? 'Heat Warning' : 'Heat Spike Today',
title: severity === 'danger' ? 'Extreme Heat Danger Alert' : severity === 'extreme-caution' ? 'Extreme Heat Warning' : 'Heat Caution Today',
message: msgs[severity],
color: severity === 'extreme' ? '#3a0000' : severity === 'severe' ? '#4a1000' : '#5a2000',
color: severity === 'danger' ? '#3a0000' : severity === 'extreme-caution' ? '#4a1000' : '#5a2000',
textColor: '#ffd0b0',
type: 'weather',
nightOnly: false,
+3 -4
View File
@@ -42,10 +42,9 @@ export const UTCI_BANDS = [
{ max: 15, label: 'Chilly', bg: '#b8e8d8', fg: '#1a1200' },
{ max: 19, label: 'Cool', bg: '#c5e8c0', fg: '#1a1200' },
{ max: 24, label: 'Comfortable', bg: '#90d090', fg: '#157a15', fontWeight: 700 },
{ max: 29, label: 'Warm', bg: '#f8e554', fg: '#1a1200' },
{ max: 34, label: 'Hot', bg: '#f5aa54', fg: '#1a1200' },
{ max: 39, label: 'Very hot', bg: '#f5884a', fg: '#1a1200' },
{ max: 44, label: 'Extremely hot', bg: '#dd5454', fg: '#000000' },
{ max: 27, label: 'Warm', bg: '#f8e554', fg: '#1a1200' },
{ max: 32, label: 'Caution', bg: '#f5aa54', fg: '#1a1200' },
{ max: 41, label: 'Extreme', bg: '#f5884a', fg: '#000000' },
{ label: 'Danger', bg: '#880000', fg: '#ffffff', fontWeight: 700, darkenAmt: 0.18, textShadow: '-1px -1px 0 #3a0000, 1px -1px 0 #3a0000, -1px 1px 0 #3a0000, 1px 1px 0 #3a0000', solid: true },
];
+5 -5
View File
@@ -90,11 +90,11 @@
<tr><td><span class="swatch" style="background:#7eb0e0"></span>13 to 0 °C</td><td>Freezing</td><td>Strong cold stress; warm layers essential</td></tr>
<tr><td><span class="swatch" style="background:#bcd9ec"></span>0 to 9 °C</td><td>Cold</td><td>Moderate cold stress; coat and gloves advised</td></tr>
<tr><td><span class="swatch" style="background:#c8dcc0"></span>9 to 18 °C</td><td>Chilled</td><td>Slight cold stress; comfortable with a light jacket</td></tr>
<tr><td><span class="swatch" style="background:#4a8a3a"></span>18 to 26 °C</td><td>Comfortable</td><td>No thermal stress; ideal outdoor conditions</td></tr>
<tr><td><span class="swatch" style="background:#f5c842"></span>26 to 32 °C</td><td>Mod heat</td><td>Moderate heat stress; stay hydrated</td></tr>
<tr><td><span class="swatch" style="background:#f5821f"></span>32 to 38 °C</td><td>Strong heat</td><td>Strong heat stress; limit strenuous activity</td></tr>
<tr><td><span class="swatch" style="background:#e03030"></span>38 to 46 °C</td><td>V. strong heat</td><td>Very strong heat stress; seek shade and cool fluids</td></tr>
<tr><td><span class="swatch" style="background:#8b1a1a"></span>Above 46 °C</td><td>Extreme heat</td><td>Extreme heat stress; dangerous for outdoor exposure</td></tr>
<tr><td><span class="swatch" style="background:#4a8a3a"></span>18 to 24 °C</td><td>Comfortable</td><td>No thermal stress; ideal outdoor conditions</td></tr>
<tr><td><span class="swatch" style="background:#f8e554"></span>24 to 27 °C</td><td>Warm</td><td>Mild heat stress; still comfortable for most activity</td></tr>
<tr><td><span class="swatch" style="background:#f5aa54"></span>27 to 32 °C</td><td>Caution</td><td><ul><li>Avoid strenuous activity or exercise outdoors</li><li>Drink plenty of fluids</li><li>Wear light clothing</li></ul></td></tr>
<tr><td><span class="swatch" style="background:#f5884a"></span>32 to 41 °C</td><td>Extreme</td><td><ul><li>Take frequent breaks and spend time indoors in the air conditioning</li><li>Avoid strenuous activity or exercise outdoors</li><li>Drink plenty of fluids</li><li>Wear light clothing</li></ul></td></tr>
<tr><td><span class="swatch" style="background:#880000"></span>Above 41 °C</td><td>Danger</td><td><ul><li>Limit time spent outdoors</li><li>Stay indoors with the air conditioning on as much as possible</li><li>Avoid strenuous activity or exercise outdoors</li><li>Drink plenty of fluids</li><li>Wear light clothing</li></ul></td></tr>
</tbody>
</table>