Foundations to Frontier
Tests
J. Scientific Machine Learning › J7 Inverse Problems and Data Assimilation

Ensemble Kalman filter

The ensemble Kalman filter replaces the Kalman filter's covariance matrix, impossible to store for a weather model, with the spread of a few dozen model runs. Each member is forecast with the full nonlinear model and then nudged towards the observations using covariances estimated from the ensemble. Small ensembles produce spurious long-range correlations and too little spread, which localisation and inflation repair. This page runs a stochastic EnKF on the 40-variable Lorenz-96 model and maps how ensemble size and localisation radius decide between filter divergence and accurate tracking.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Many forecasts instead of one

Instead of one forecast with an error formula, run an ensemble: several forecasts started from slightly different states. Where the members agree the forecast is trustworthy; where they spread out it is uncertain. When observations arrive, every member is pulled towards them, more strongly where the ensemble is uncertain. The ensemble’s own spread thus plays the role of the error covariance, and it evolves with the weather.

Inverse problems and data assimilation lab
━ truth x━ free run x━ EnKF mean x
Analysis RMSE over cycles 41 to 200: EnKF 0.62, free run 10.58 (observation error 2). Very small ensembles lose track; adding members helps until sampling error stops mattering.
Why engineers care

Ensemble Kalman filters run operationally at Environment and Climate Change Canada, NCEP and in ocean and land-surface assimilation.

📝 Quick check (Level 0)
0/3 answered
  1. 1. The ensemble's spread represents…
  2. 2. Members are pulled towards observations…
  3. 3. Each member is forecast with…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • Forecast: run each of N members through the model; the sample covariance P_f = AAᵀ/(N − 1) of the anomalies A replaces the Kalman covariance.
  • Analysis: update each member with K = P_f Hᵀ(H P_f Hᵀ + R)⁻¹. The stochastic EnKF (Evensen, 1994; Burgers et al., 1998) perturbs the observations for each member so that the analysis spread is right; deterministic square-root filters (ETKF, EAKF) transform the anomalies instead.
  • Rank deficiency: with N members the sample covariance has rank at most N − 1, far below the state dimension.
  • Sampling error: small ensembles show spurious correlations between distant variables.
  • Localisation: multiply P_f element-wise by a compactly supported correlation such as Gaspari–Cohn, or analyse each region with nearby observations only (LETKF).
  • Inflation: multiply anomalies by a factor slightly above 1 to counter the spread lost to sampling and model error.
📝 Quick check (Level 1)
0/3 answered
  1. 1. With N members the sample covariance has rank at most…
  2. 2. Localisation removes…
  3. 3. The stochastic EnKF perturbs…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

Lorenz-96 and localisation

Exercise 1.

  • The Lorenz-96 model with 40 variables on a ring and forcing F = 8, integrated with RK4, Δt = 0.05.
  • The Gaspari–Cohn function and the localisation matrix for a half-width c.
  • Correlations between distant variables estimated from 1000 states and from 10 states.

Practice.

  • Start with localisation and inflation; a raw EnKF with tens of members rarely works in high dimension.
  • Tune the localisation radius with ensemble size: larger ensembles allow wider localisation.
  • Monitor spread against error: spread far below the error signals filter divergence.
  • Use deterministic filters (ETKF, LETKF) in operations to avoid noise from perturbed observations.
  • Tools: DART (NCAR), PDAF, DAPPER for experiments, and EnKF implementations in JEDI.
import numpy as np

def enkf_analysis(E, y, sigma_o, rho, rng, infl=1.05):
    m = E.mean(0); A = infl * (E - m); E = m + A
    P = rho * (A.T @ A / (len(E) - 1))                    # localised sample covariance
    K = P @ np.linalg.inv(P + sigma_o**2 * np.eye(len(m)))
    Y = y + sigma_o * rng.standard_normal(E.shape)         # perturbed observations
    return E + (Y - E) @ K.T
🐍 Exercise 1: Lorenz-96 and spurious correlations
Integrate Lorenz-96, build the Gaspari–Cohn localisation matrix, and compare correlations between distant variables estimated from 1000 states and from 10.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Spread far below the error signals…
  2. 2. NCAR's ensemble DA toolkit:
  3. 3. Larger ensembles allow…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Why the EnKF works. For a linear model with Gaussian errors and N → ∞, the ensemble mean and covariance follow the Kalman filter exactly. For nonlinear models each member feels the full nonlinearity, so the covariance becomes flow-dependent without a tangent-linear or adjoint model.

Why small ensembles fail. A sample correlation from N members has sampling error of order 1/√N. In Exercise 1 the mean absolute correlation between variables 10 to 30 grid points apart was 0.03 from 1000 states but 0.26 from 10 states. The filter believes these spurious correlations, pulls distant variables by the wrong amounts, and loses spread. The ensemble then trusts itself too much and ignores new observations: filter divergence.

Localisation and inflation. The Schur product of P_f with a positive definite localisation matrix stays positive semi-definite, removes distant correlations and raises the effective rank. Inflation restores spread lost to sampling error. The best localisation radius balances sampling noise, which favours narrow localisation, against lost real correlations, which favour wide localisation.

📝 Quick check (Level 3)
0/3 answered
  1. 1. The sampling error of a correlation from N members is of order…
  2. 2. Mean |correlation| between distant variables from 10 states was…
  3. 3. The Schur product of a covariance and a localisation matrix is…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

How do ensemble size and localisation radius determine whether an EnKF tracks a 40-variable chaotic system or diverges?

History.

  • G. Evensen (1994) introduced the ensemble Kalman filter; G. Burgers, P. J. van Leeuwen and G. Evensen (1998) added perturbed observations.
  • P. Houtekamer and H. Mitchell (1998, 2001) introduced localisation; G. Gaspari and S. Cohn (1999) gave the standard taper.
  • J. Anderson and S. Anderson (1999) introduced inflation; C. Bishop et al. (2001) and B. Hunt et al. (2007) developed the ETKF and LETKF.

Exercise 2. Lorenz-96 truth; all 40 variables observed every 0.05 time units with error 1; stochastic EnKF with inflation 1.05; 400 cycles, RMSE averaged after 100. Analysis RMSE (ensemble spread), seed 0; the error between two random states of the attractor is 5.1:

members no localisation c = 2 c = 4 c = 8
10 diverged 0.32 (0.32) 0.29 (0.26) 0.35 (0.21)
20 diverged 0.31 (0.34) 0.27 (0.29) 0.23 (0.25)
40 diverged 0.31 (0.36) 0.27 (0.31) 0.24 (0.26)
  • Without localisation the 10- and 20-member filters diverged in every seed (error above 3 with spread below 0.25); 40 members diverged with seed 0 but tracked with seeds 1 and 2 (0.26 and 0.2).
  • With localisation every ensemble size tracked the truth, with errors between 0.23 and 0.35 against an observation error of 1.
  • The best radius grows with ensemble size: half-width 4 was best for 10 members in all three seeds, half-width 8 for 20 and 40 members.
  • Seeds 1 and 2: 20 members with c = 8: 0.24 and 0.21; 10 members with c = 4: 0.28 and 0.29.
🐍 Exercise 2 (research): how do ensemble size and localisation radius determine whether an EnKF tracks a 40-variable chaotic system or diverges?
Run a stochastic EnKF on Lorenz-96 with 10, 20 and 40 members, without localisation and with Gaspari–Cohn half-widths 2, 4 and 8, and compare analysis error with ensemble spread.

The EnKF in practice

  • Weather: Canada’s global ensemble uses an EnKF; NCEP’s hybrid system uses EnKF covariances inside 4D-Var.
  • Oceans: TOPAZ assimilates satellite and in-situ data with an EnKF for the Arctic.
  • Reservoirs and hydrology: history matching of oil reservoirs and soil-moisture estimation.
  • Machine learning: ensemble Kalman inversion trains models without gradients.

References

  1. G. Evensen (1994). “Sequential data assimilation with a nonlinear quasi-geostrophic model using Monte Carlo methods to forecast error statistics.” Journal of Geophysical Research.
  2. G. Burgers, P. J. van Leeuwen and G. Evensen (1998). “Analysis scheme in the ensemble Kalman filter.” Monthly Weather Review.
  3. P. L. Houtekamer and H. L. Mitchell (2001). “A sequential ensemble Kalman filter for atmospheric data assimilation.” Monthly Weather Review.
  4. G. Gaspari and S. E. Cohn (1999). “Construction of correlation functions in two and three dimensions.” Quarterly Journal of the Royal Meteorological Society.
  5. B. R. Hunt, E. J. Kostelich and I. Szunyogh (2007). “Efficient data assimilation for spatiotemporal chaos: a local ensemble transform Kalman filter.” Physica D.