MODULE 01 // ELECTRICAL HEARTBEAT
Britain has an electrical heartbeat
Every day the grid traces nearly the same shape: a deep overnight trough, a steep morning ramp as the country wakes, and an evening peak when people come home. Winter lifts the whole curve; summer flattens it. None of this mentions temperature yet — it is pure behaviour and physics, the raw material the experiment will work from.
FIG.01 — mean National Demand by time of day (local), all year and by season.
The working week leaves its own mark. Weekday mornings start hard; weekends sleep in. That gap has nothing to do with the weather — and separating this behavioural rhythm from the genuine weather signal is the core challenge of everything that follows.
FIG.02 — weekday vs weekend demand across the day.
MAP — mean demand by hour × month (MW). Winter evenings glow; summer nights fall dark.
● REC TELEMETRY LOG · 04 JUL 1990
The 2,800 MW cup of tea
The largest demand surge in British history wasn't industrial — it was a kettle. When the England v West Germany World Cup semi-final went to penalties, the nation waited, then rose as one to boil the kettle: a 2,800 MW spike in minutes, roughly 1.1 million kettles at once. "TV pickup" is so predictable that grid engineers pre-position reserves for it. Behaviour, written straight into the load — exactly the signal this project reads.
MODULE 02 // FREQUENCY DOMAIN
There are hidden frequencies
Treat a decade of half-hourly demand as one long waveform and take its Fourier transform, and the rhythms resolve into sharp spikes. Each spike is a cycle the country repeats: a dominant 24-hour beat, a weekly cycle from the working week, and — the one that matters here — a large annual swing. That yearly component is, in large part, the heating season written into the grid.
FIG.03 — power spectrum of demand (log period axis). Peaks = cycles the grid repeats.
TELEMETRY LOG · ELIDIR FAWR, WALES
The mountain that answers in 16 seconds
To absorb surges like TV pickup, the grid keeps a battery the size of a mountain. Dinorwig — "Electric Mountain" — hides six turbines inside a Welsh peak and can throw 1,728 MW onto the grid from a standstill in about 16 seconds, the fastest-responding plant in Britain. The whole system runs on a knife-edge at 50 Hz; that tight balance is why demand tracks reality so faithfully.
MODULE 03 // TEMPERATURE RESPONSE
The shape of the relationship
Before hiding the thermometer, it's worth seeing the relationship the whole project exploits. Plot each day's average demand against its average temperature and a clear signature appears: demand climbs steeply as it gets colder, then flattens once the weather turns mild. Britain heats with electricity but rarely cools with it — so the curve has a kink, not a symmetric V. The fitted breakpoint is where heating demand switches on.
Daily demand vs daily mean temperature, with a fitted heating/cooling breakpoint.
MODULE 04 // EXPERIMENT DESIGN
Hide the thermometer
Here is the rule that makes this an experiment rather than a correlation plot: the model never sees the temperature. It is trained to infer daily temperature from electricity behaviour and the calendar alone. Even solar and wind generation are withheld — they are effectively sunshine and wind measurements, and letting them in would be cheating.
MODEL A · electricity only
Demand level, range, overnight minimum, evening peak, and their recent history. No calendar at all.
MODEL B · + calendar
Everything in A, plus month, day-of-year, weekday, holidays and daylight hours — astronomy, not measured weather.
Comparing them answers a sharp question: how much weather signal lives in electricity behaviour itself, versus simply knowing what time of year it is?
None of this works without trustworthy data. The pipeline validates every load — reconstructing British Summer Time's 46- and 50-period days, flagging gaps, and dropping duplicates and impossible readings — and reports what it did:
The national temperature is a population-weighted blend of ten cities. Some track national demand more tightly than others — a mix of regional climate and where the load sits:
Correlation of each city's daily temperature with national demand (more negative = tracks demand more tightly).
MODULE 05 // INFERENCE
Can the grid predict temperature?
Tested on years the model never trained on, here is how close the grid's guess comes to the real thermometer. Switch what the model is allowed to see:
FIG.04 — observed vs grid-inferred daily temperature, holdout years. Drag to zoom.
FIG.05 — predicted vs actual.
FIG.06 — mean error by model. Lower is better.
MODULE 06 // VALIDATION & UNCERTAINTY
Does it hold up, and how sure is it?
A single train/test split can get lucky. So the model is re-tested with walk-forward validation: train on every year up to some point, predict the next year it has never seen, then step forward and repeat. If the error stays low and steady across all those years, the result is real — not an artefact of one convenient split.
Error on each year the model never trained on (walk-forward). Lower is better.
A responsible estimate also carries its uncertainty. Calibrating on the model's own out-of-sample misses gives a prediction interval — a band the true temperature should fall inside most of the time. Here it is around the inferred line, with the coverage it actually achieved on the holdout stated honestly.
Grid-inferred temperature with its 90% prediction interval (holdout years).
MODULE 07 // EXPLAINABILITY
Why does it decide what it decides?
A model is only trustworthy if you can see its reasoning. SHAP values open the box: they measure how much each signal pushed a given day's estimate up or down, in degrees. Averaged over every test day, they reveal what the model leans on most.
Average impact of each input on the inferred temperature (mean |SHAP|, °C).
And for any single day you can watch those forces play out — which signals argued for "cold", which for "mild", starting from the all-days average. Pick a day:
Per-day contributions: amber pushes warmer, cyan pushes colder.
MODULE 08 // COLD-SPELL DETECTION
Can the grid detect a cold snap?
Forget exact degrees for a moment. Can the grid simply tell that a day is unusually cold? Framed as a yes/no test on the coldest days, the result looks like this.
–recall
–precision
TELEMETRY LOG · 19 JUL 2022 · 40.3 °C
Why the grid feels cold but not heat
When Britain broke 40 °C for the first time in 2022, demand barely flinched — because the country heats with electricity but almost never cools with it. A cold snap sends demand surging as heaters and lights switch on; a heatwave does little, since air-conditioning is rare in UK homes. That asymmetry is visible in this project's own numbers: the grid reads cold far more sharply than heat.
MODULE 09 // FAILURE ANALYSIS
When the grid lies
The model's biggest mistakes are the most revealing part of the study. On these days electricity behaviour broke its own rules — and the usual culprits are not weather at all, but the calendar behaving strangely: Christmas, New Year, bank holidays, when the country stops acting like itself. (Christmas Day is reliably one of the lowest-demand days of the entire year.)
| Date | Day | Observed | Inferred | Off by | Context |
|---|
FIG.07 — prediction error distribution through the year.
MODULE 10 // DEMAND FORECAST
Where is demand heading?
Everything so far looked backwards — reconstructing the past. This looks forward: a transparent seasonal-trend model (long-term trend + annual cycle + working week + holidays) forecasts national demand for the next two months. The error band comes from a walk-forward backtest: how the model did on days it hadn't seen, rather than in-sample residuals.
Recent demand and the 60-day forecast with its backtested 90% interval.
SCOPE & LIMITS
- This forecasts demand, not weather. It reads the calendar — season, weekday, holidays, trend — but not an upcoming cold snap.
- A production forecaster would feed in a numerical weather forecast; this is a strong, interpretable baseline, not that.
- The band widens in reality during unusual weather; the stated coverage is the historical backtest average.
MODULE 11 // DATA MODEL
Under the hood: a SQL warehouse
The daily figures don't have to live in pandas. The same transformations are also expressed as a small star schema in SQL (DuckDB) — one conformed date dimension, two daily fact tables — built straight off the tidy CSVs. It's the difference between a script and a queryable model.
A transformation layer is only trustworthy if it agrees with the source of truth, so it's reconciled: the SQL daily aggregation is checked against the pandas one, day for day.
SELECT season, ROUND(AVG(nd_mean),0) AS mean_demand_mw, COUNT(*) AS days
FROM v_daily GROUP BY season ORDER BY mean_demand_mw DESC;
A live query against the star schema: mean demand by season.
MODULE 12 // TRY IT YOURSELF
Guess the weather from the grid
Give the grid a day and watch it infer the temperature. This is a deliberately simplified explorer — just average demand, the month, and whether it's a weekend — so you can feel the relationship directly, live in your browser. The full model uses far more signal and is more accurate; the gap is noted below.
MODULE 13 // CONCLUSION
What did we actually learn?
Britain's electricity demand does carry a real temperature signal — as a supplement to the calendar, not a replacement for it.
The relationship is asymmetric (the grid reads cold better than heat) and it is correlation, not measurement — demand responds to temperature, daylight, behaviour and the calendar all at once, and those are deeply entangled. A grid is not a thermometer. But it remembers the weather more than you might expect.
SYSTEM NOTES · LIMITATIONS
- Weather is ERA5 reanalysis (a model blend), a documented stand-in for Met Office station data.
- Recent NESO weeks are provisional and revised in arrears.
- Demand fell over the decade; the models must not read that trend as a season clock.
- Calendar features can encode season directly — which is why Model A and B are kept separate.