Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Matched filter vs 3D-Var on the HAPI methane scene

This notebook runs the matched filter (MF) on the same synthetic HAPI methane scene as ../assimilation/06_variational_methane_retrieval.ipynb, so the two retrievals are directly comparable. The derivation — and the sense in which the MF is the one-step PSAS limit of 3D-Var with a flat prior — is in the companion note 00_mf_derivation.md.

What to expect:

1. Load the HAPI CH₄ absorption LUT and build the forward model

Exactly the same plumbing as the 3D-Var notebook — same LUT, same SRF stride, same atmospheric path. Reusing the identical setup is deliberate: it means any difference in the retrieved amplitude fields is strictly attributable to method (MF vs 3D-Var), not to a drift in physics.

HR grid: 100 wavenumbers, 100 bands.

2. Simulate the same Gaussian plume scene

32×32 pixels over a 1.5 km domain (~47 m/pixel), 5 ppm peak VMR, Pasquill stability class D, wind from the west — identical to the 3D-Var tutorial.

scene 32×32, peak VMR 5.00e-06, noise_std 5.000e-05

3. Matched filter: linear and nonlinear targets

The target comes directly from the forward model — no hand-rolled Beer–Lambert. For the “linear” target we take a JVP at the zero-VMR background; for the “nonlinear” we take the finite-amplitude response at roughly the observed peak VMR. In the 5-ppm regime with our LUT, α⋅amax⁡≈0.5\alpha \cdot a_{\max} \approx 0.5, so saturation is visible but not dominant.

|t_linear| = 9.829e+05,  |t_nonlinear| = 5.798e+05
MF theoretical SNR at peak α = 34.0,  FAR=1e-4 threshold = 5.47e-07

4. 3D-Var retrieval for comparison

We use the whitened LBFGS path from the assimilation notebook — it’s the fastest-converging primal route and gives the same MAP estimate as the dual PSAS would. The prior is a Kronecker AR(1) background with a 4-pixel correlation length, which encodes “methane plumes are spatially smooth on this domain.”

3D-Var: 200 LBFGS iterations, 1.23 s

5. Compare the amplitude fields

Top row: truth, MF (linear target), MF (nonlinear target), 3D-Var. Bottom row: retrieval − truth (residuals on the same colour scale). The MF and 3D-Var agree on location and coarse amplitude; 3D-Var is visibly smoother thanks to the AR(1) prior. The linear and nonlinear MF fields differ mainly near the source (highest VMR), where Beer–Lambert curvature is strongest.

<Figure size 1600x750 with 15 Axes>

6. RMSE and peak-amplitude table

MF (linear target)              RMSE = 7.77e-07   peak = 5.22e-07
MF (nonlinear target)           RMSE = 5.20e-07   peak = 5.00e-06
3D-Var (whitened LBFGS)         RMSE = 3.70e-10   peak = 5.00e-06

7. Take-aways

The numeric results tell the honest story of flat-prior linear matched filters at realistic methane concentrations.

  • Linear-target MF badly under-estimates the peak at 5 ppm. Retrieved peak 5.2×10−75.2 \times 10^{-7} vs truth 5×10−65 \times 10^{-6} — a 10× bias. The reason is Beer–Lambert saturation: at the plume core α⋅amax⁡≈0.5\alpha \cdot a_{\max} \approx 0.5, so exp⁡(−0.5)≠1−0.5\exp(-0.5) \ne 1 - 0.5, and the linear target ∂L/∂α∣α=0\partial L/\partial \alpha|_{\alpha=0} over-states the signal the radiance carries at saturation. The MF then divides a saturated numerator by an unsaturated t⊤Σ−1tt^\top \Sigma^{-1} t, shrinking the score.

  • Nonlinear-target MF recovers the peak to within noise. Using nonlinear_target_from_obs(..., amplitude=5e-6) picks the secant (H(xb+αδx)−H(xb))(H(x_b + \alpha \delta x) - H(x_b)) at the actual plume amplitude, so the saturation sits in both numerator and denominator and cancels out. Same single-solve cost, 10× better peak amplitude.

  • 3D-Var dominates both on RMSE on this scene because (i) it uses the full nonlinear forward model, (ii) it leverages the smooth Kronecker AR(1) prior, and (iii) it is iterative so it converges to the MAP rather than stopping at the one-step PSAS approximation.

  • Runtime. MF is milliseconds (one Σ-solve + one einsum per image); 3D-Var took ~1 s for 200 LBFGS iterations on this 1024-state problem. The MF is the right default for screening — you want a cheap detector pass over an archive before triggering the full inverse. For detections you care about, hand them to 3D-Var.

  • How to close the gap. Iterating the MF with a nonlinear target re-linearised around the latest estimate (a “matched-filter-with-update” scheme) gets you most of the way to 3D-Var for compact plumes without the LBFGS loop. That is exactly the outer loop of incremental 3D-Var; see 00_variational_derivation.md §2.