Met Office group project · 2024

Weather Forecasting

My team used hourly ERA5 records from 12 locations to forecast temperature six hours ahead and estimate missing readings.

Compare the models

Scroll or swipe sideways · Arrow keys to scrub · Space to pause or resume

Forecast window

Illustration using synthetic temperatures

Hour 22 → 28
8°12°16°20°24°0 h12 h24 h36 h47 hPast readingsNext 6 hours
Observed temperature
Demo forecast— °C MAE
Rolling baseline— °C MAE

Six ways to forecast

Mean absolute error on the test set (°C) · lower is better

Trained models

LSTM recurrent network
1.32
Multilayer perceptron
1.74
Random forest
1.78

Baselines

Rolling baseline
1.59
Previous day
3.45
Historical average
4.09

Dotted line · rolling baseline

Preparing the data

We prepared hourly temperature, rainfall and wind records from ERA5 and encoded dates as cycles so the models could pick up daily and seasonal patterns.

Training the forecasting models

We trained a TensorFlow LSTM on windows of past readings and compared it with a multilayer perceptron and a random forest. We split the data in time order and kept future observations out of the inputs.

Setting the baselines

We compared the models with an average for the same time in other years, the previous day’s weather, and a rolling forecast that held conditions steady for six hours.

When the temperature is missing

We trained a separate multilayer perceptron to estimate the temperature at the same hour from wind, rainfall, location and time. One model covered all 12 locations, and the test set included readings sampled from each.

As the same years sweep across all three charts, teal predictions appear over the observed readings. Watch where the model follows the seasonal swings but misses the hottest or coldest readings. Each city uses its own temperature scale.

0.924 R² across all 12 locations

Churchill had a larger error in degrees, but a smaller error relative to its temperature range than Cape Town (5.43% vs 6.72%).

Read the group report

Predicted vs actual temperature

Scroll or swipe sideways · Arrow keys to scrub · Space to pause or resume

ObservedPredicted

Churchill

Original

Marseille

Original

Cape Town

Original