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
+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,