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.
My team used hourly ERA5 records from 12 locations to forecast temperature six hours ahead and estimate missing readings.
Compare the modelsScroll or swipe sideways · Arrow keys to scrub · Space to pause or resume
Illustration using synthetic temperatures
Mean absolute error on the test set (°C) · lower is better
Dotted line · rolling baseline
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.
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.
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.
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