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.

Mathematical modelling

GeoStack · lens 3 of 5 · 1 December 2026

Abstract

The modelling cycle: two tracks meet at compare. A random misfit runs the inner loop, which re-estimates the state and the parameters. A systematic one runs the outer loop, which revises the model’s hypotheses one rung at a time, or the observing system. Below it, the six-step cycle takes a model from simple to fast, and the hypothesis ladder, after Hoshin Gupta, says what the outer loop revises and how to tell which rung a misfit points at.

describemathax
fitinferax, pyrox
physicsGeoNumerics
dataGeoStack (geotoolz)
assembleGeoModels
orchestratepipekit
dashed, numbered: off the shelf the lens expects, or no library yet
Dhanded to the data-engineering lens
Phas a probabilistic-numerics counterpart
Real-world system
modellingobserving
Equationsphysical termsgeophysix
MeasurementsDread productsgeoproductsgeocatalog
Discretisedoperatorsgridaxspectraldiffx
Retrievalsradiometryradiomax
Modelpredictionssesmax · radtraxplumax
RegriddedDobservationsgeoops
outer loop: the ladder
predictionsobservations
CompareD1matchup, misfit, scoresgeocatalog.matchuppipekit-evaluate · diagnostix
pipekit-cycle
randomsystematic
Inner loopstate, parametersfilterax · vardaxpyrox-ssmargminax · pyrox
Outer loopclimb the laddernoise, closures,architecture, laws

Data assimilation spans three repos (the model in pyrox-ssm, the algorithms in filterax and vardax, the loop in pipekit-cycle) because each piece sits on its own rung.

StepLibrariesShelf
Equationsgeophysix for the physical termsphysics
Discretisedgridax, spectraldiffxphysics
Model → predictionssesmax, radtrax, plumaxassemble
Measurementsgeoproducts reads them, geocatalog indexes themdata
Retrievalsradiomax: radiometry, spectral response, empirical retrievalsphysics
Regridded → observationsgeoops (reproject, resample)data
Comparegeocatalog.matchup pairs predictions with observations in space and time; pipekit-evaluate, diagnostix score themorchestrate ①
Inner loopstate: filterax, vardax, pyrox-ssm; parameters: argminax, pyrox; run by pipekit-cyclefit
Outer loopyou climb the hypothesis ladder: the uncertainty, the process forms, the architecture or the conservation laws, or the observing system; no library compares structures yet ④people

Where it doesn’t fit

The six-step cycle: from a simple model to a fast one

The modelling cycle says which loop to run; the six-step cycle says how to make running it cheap, one step of model complexity at a time. Let θ\gvect{\theta} be what is inferred (the state included), ff the forward model, hh the observation operator and ε\gvect{\varepsilon} the observation error.

y=h(f(θ))+ε\vect{y} = h(f(\gvect{\theta})) + \gvect{\varepsilon}

Each learned step is scored against the earlier step that computes the same thing: the emulator against the simulator, both fast inversions against step 2, the oracle. Moving down, a query falls from hours to milliseconds, because training is paid once, up front.

1 · Simple model–ff and hh; simulate (θ,y)(\gvect{\theta}, \vect{y}) pairssesmax · plumax · radtrax

2 · Model-based inferencehoursthe oracle: p(θ∣y)∝p(y∣θ)p(θ)p(\gvect{\theta} \mid \vect{y}) \propto p(\vect{y} \mid \gvect{\theta}) p(\gvect{\theta})DACycle + filterax · vardax · pyrox

3 · Emulatortrain oncef^(⋅;θemu)\hat{f}(\cdot; \gvect{\theta}_\text{emu}) fitted to ffSimulationDataset · geonnaxModelRegistry

4 · Emulator-based inferenceminutesstep 2 with f^\hat{f} in place of ffDACycle + NeuralForward

5 · Amortized inferencemsq(θ∣y;ν)q(\gvect{\theta} \mid \vect{y}; \gvect{\nu}), one passpipekit-train · gauss_flows · pyroxvardax AmortizedPosterior

6 · Improve–rerun, compare row by row, change one steppipekit-evaluate Benchmark · ReferenceRule

Solid arrows on the left: trained on step-1 simulations. Dashed arrows on the right: scored against. The tag on each box is the cost of one query. Steps 3 and 4 may be skipped where the forward model is already cheap, as in plumax’s Gaussian plume; step 2 may not.

StepWhat it isTrained onReferenceLives inMode in scientific ML
1 · Simple modelff and hh, run forward to draw pairs (θ,y)(\gvect{\theta}, \vect{y})nothing—sesmax, plumax, radtrax—
2 · Model-based inferencethe posterior p(θ∣y)p(\gvect{\theta} \mid \vect{y}) by a classical methodnothingnone: it is the oracleDACycle with filterax, vardax, pyroxestimation
3 · Emulatorf^(⋅;θemu)\hat{f}(\cdot; \gvect{\theta}_\text{emu}) fitted to ffstep-1 simulationsstep 1, on inputs and JacobiansSimulationDataset, geonnax, ModelRegistrylearning
4 · Emulator-based inferencestep 2 with f^\hat{f} in place of ffnothing newstep 2, case by caseDACycle with NeuralForwardestimation
5 · Amortized inferenceq(θ∣y;ν)q(\gvect{\theta} \mid \vect{y}; \gvect{\nu}), observations straight to a posteriorstep-1 simulationsstep 2, and the truthpipekit-train with gauss_flows or pyrox; vardax AmortizedPosterioramortized
6 · Improvererun, compare row by row, change one step—the step beforepipekit-evaluate Benchmark, ReferenceRule; lineage in pipekit-experimentbilevel, when a step’s parameters are learned through it

The usual faults. An emulator scored against observations instead of the simulator; an amortized map trained on step 4’s outputs, which distils that inversion and its errors; a learned step compared only with the step that taught it; only the mean compared, never the spread; a classical method that no longer runs, so nothing can be scored again.

The hypothesis ladder: what the outer loop revises

After Hoshin Gupta’s 2017 Horton Lecture. A model is not one hypothesis but a stack of them, each adding information by restricting the trajectories the model can make: the conservation laws, the system architecture, the process forms, and the uncertainty. They are built from the top down, and a misfit is revised from the bottom up: change the lowest rung that can explain it, and climb only when it cannot. The rungs are where the other lenses meet: the top two are numerical-methods chapters 8 to 10, the next two are parts I and II of scientific ML, and the solution procedure is numerical methods again.

Built top down · revised bottom up

Conservation lawsHCLH_\text{CL}control volume, what is conservedgeophysix · gridax termssesmax · radtrax · plumax models

restricts trajectories

System architectureHSAH_\text{SA}4scale, dimension, structure, classesgridax grids · layers, modessource and stability classes

Process formsHPPH_\text{PP}3closures at the architecture’s scaledrag, diffusivity, plume risegeonnax · pyrox-gp functions

UncertaintyHUNH_\text{UN}inputs, structure, the data’s errorsradtrax NoiseModel · priorsfilterax model error

Solution proceduresolveverify it; it is not a hypothesisintegrix · NM ch. 20–24

Parameters and stateθ,x\gvect{\theta}, \vect{x}the inner loopfilterax · vardax · argminax

revise upward, one rung at a time

Each rung holds the ones above it fixed. Inference gets harder going up: parameters and state are a search over values, process forms a search over equations, architecture a search over structures that the wrong closures confound. The four steps below write each search as an equation. The solution procedure is dashed because it is verified, not inferred; unverified numerics look like structural error.

Each rung in three of the applications

RungOcean and DARemote sensingSources
Conservation laws HCLH_\text{CL}which equations: barotropic or baroclinic QG, shallow water, plane or sphere (BarotropicQG, BaroclinicQG, NonlinearShallowWater2D, SphericalSWM)absorption only (BeerLambert), or scattering, or emission; what the column conservesa steady plume, transient puffs or Eulerian transport (GaussianPlume, GaussianPuff, EulerianDispersion); mass balance for the IME (IMEEstimate)
Architecture HSAH_\text{SA}resolution, eddy-permitting or resolving; how many layers (StratificationProfile), layers or modes (ModalTransform); closed basin or open boundariesthe column’s layers (layers_from_levels, afgl_us_standard); the band set and spectral sampling; the footprint; per pixel or per scene; surface classespoint or area source (GaussianSource, SurfaceFluxSource); one source or many; stack height; a prescribed wind (to_prescribed_wind) or a coupled one
Process forms HPPH_\text{PP}bottom drag linear or quadratic (LinearDrag2D, QuadraticDrag2D); harmonic or biharmonic viscosity (gridax diffuse, biharmonic); forcing as a field or a reduced basis (BasisForcing); a learned closure (geonnax)the surface, Lambertian or a Legendre series in wavenumber (Lambertian, PolynomialAlbedo); the band form (BandInstrument); the line shape in the cross-section tablesthe dispersion widths σ by Pasquill–Gifford or Briggs (calculate_pg_dispersion, get_dispersion_params); plume rise (BriggsPlumeRise); eddy diffusivity (EddyDiffusivity)
Uncertainty HUNH_\text{UN}background and model error (Σx\gmat{\Sigma}_x, Ση\gmat{\Sigma}_\eta), observation and representativeness error (Σε\gmat{\Sigma}_\varepsilon); ensembles in filteraxinstrument noise (NoiseModel: DiagonalNoise, SNRNoise); the matched filter’s background covariance; structured noise is a gap (applications note 6)the wind’s error; turbulence as a stochastic process (OUTurbulence); emission and population priors (LognormalMark, LognormalParetoMark); detection probability (LogLogisticPOD)
Solution solvesteppers and the elliptic solve (integrix.march, gridax.solvers)spectral quadrature through the response matrix (response_matrix); Jacobians by autodiffEulerian resolution against the analytic plume; quadrature over a population (integrix.expect)
Parameters, state θ,x\gvect{\theta}, \vect{x}the initial state; drag, viscosity and wind amplitude (SeasonalWindForcing)the column enhancement; albedo coefficients; the spectral shift δ (BandInstrument)the emission rate QQ in kg h⁻¹ (infer_emission_rate); the source location; a wind scaling

Architecture is more than resolution

Gupta names scale, dimension and spatial structure, lumped against distributed. The applications add more decisions on the same rung:

Heterogeneity: resolve, classify or integrate

StrategyIt assumesExamplesIt fails when
Resolveheterogeneity is explicit down to the grid spacing; below it is a closure’s joban eddy-resolving ocean; 30 m pixels; an Eulerian plume (EulerianDispersion)it costs too much, or the data cannot constrain each cell: under-constrained
Classifymembers of a class share parameters; classes are the units of the modelhydrologic response units; plant functional types; land-cover and surface classes; water masses; Pasquill–Gifford stability classes A to F (get_pg_params); source sectors (LandfillIntensity)the class boundaries are wrong, or variance within a class matters: over-constrained
Integrateheterogeneity is a distribution over sub-grid states or functionsGupta’s conductivity, a distribution p(K)p(K) over sub-grid values; stochastic turbulence (OUTurbulence); emission populations (LognormalMark, MixtureLognormalMark); stochastic parameterisationsthe distribution’s shape is itself a strong hypothesis

Classes are architecture, not parameters. Choosing six stability classes, or one surface class per land-cover type, decides what the model can distinguish before any parameter is fitted, and a misfit that follows the classes says the classes are wrong.

Try to improve the hypothesis: four steps

Gupta’s loop is: make a hypothesis, collect data, assess the likelihood, fix the hypothesis. Fixing it is four inferences, each harder than the last, and each moves one more hypothesis from “assumed correct” to “inferred”. Read each equation by where its semicolon sits: what is left of it is searched, what is right of it is held fixed.

Symbols: D\mathcal{D} = {uobs\vect{u}_\text{obs}, yobs\vect{y}_\text{obs}} the data, inputs and observations; x\vect{x} the state and μx\gvect{\mu}_x its prior (background) mean; θ\gvect{\theta} the parameters; hh the observation operator and Jh\mat{J}_h its Jacobian; Σx\gmat{\Sigma}_x and Σε\gmat{\Sigma}_\varepsilon the prior and data-error covariances, and Σy\gmat{\Sigma}_y the covariance of the observations; r\vect{r} the residual (innovation); HCLH_\text{CL}, HSAH_\text{SA}, HPPH_\text{PP} and HUNH_\text{UN} the four hypotheses; CPP\mathcal{C}_\text{PP} a set of candidate process forms; gg a random process function. Gupta writes L(model∣data)L(\text{model} \mid \text{data}) for the likelihood; here it is the density p(D∣model)p(\mathcal{D} \mid \text{model}), and the semicolon carries his brace: everything after it is assumed correct. Shapes: x,μx∈RDx\vect{x}, \gvect{\mu}_x \in \mathbb{R}^{D_x}, θ∈RDθ\gvect{\theta} \in \mathbb{R}^{D_\theta}, yobs,r∈RDy\vect{y}_\text{obs}, \vect{r} \in \mathbb{R}^{D_y}, Jh∈RDy×Dx\mat{J}_h \in \mathbb{R}^{D_y \times D_x}, Σx∈RDx×Dx\gmat{\Sigma}_x \in \mathbb{R}^{D_x \times D_x} and Σε,Σy∈RDy×Dy\gmat{\Sigma}_\varepsilon, \gmat{\Sigma}_y \in \mathbb{R}^{D_y \times D_y}.

1 · Check the assumptions about the data

Basic. Does the likelihood reflect the stochastic nature of the information the data provides?

p(yobs∣x,θ; HUN)=N(yobs; h(x;θ), Σε)p(\vect{y}_\text{obs} \mid \vect{x}, \gvect{\theta};\ H_\text{UN}) = \mathcal{N}(\vect{y}_\text{obs};\ h(\vect{x}; \gvect{\theta}),\ \gmat{\Sigma}_\varepsilon)
r=yobs−h(μx)\vect{r} = \vect{y}_\text{obs} - h(\gvect{\mu}_x)
Ep(yobs)[rr⊤]=Σy=JhΣxJh⊤+Σε\mathbb{E}_{p(\vect{y}_\text{obs})}[\vect{r}\vect{r}^\top] = \gmat{\Sigma}_y = \mat{J}_h \gmat{\Sigma}_x \mat{J}_h^\top + \gmat{\Sigma}_\varepsilon

The likelihood is itself a hypothesis, the data’s half of the uncertainty rung: Gaussian or not, which covariance, independent or correlated, with or without representativeness error. Check it before any search: the innovations r\vect{r} should be exactly as spread as the prior and the data errors together say, and the whitened residuals should look like white noise.

2 · Estimate the parameters and the state

Easiest. Is there a state and a set of parameter values for which this model explains the data?

x⋆,θ⋆=argmaxx,θ p(D∣x,θ; HUN,HPP,HSA,HCL⏟assumed correct)p(x,θ)\vect{x}^\star, \gvect{\theta}^\star = \mathrm{argmax}_{\vect{x}, \gvect{\theta}}\ p(\mathcal{D} \mid \vect{x}, \gvect{\theta};\ \underbrace{H_\text{UN}, H_\text{PP}, H_\text{SA}, H_\text{CL}}_{\text{assumed correct}}) p(\vect{x}, \gvect{\theta})

Hold every hypothesis fixed, behind the semicolon, and search over all feasible values of the state and the parameters. This is the inner loop: a posterior over values, cheap because the space is a vector space and the gradient exists.

3 · Estimate the process forms

Harder. Which equation form, at this architecture’s scale, explains the data once its parameters are integrated out?

HPP⋆=argmaxHPP∈CPP p(D∣HPP; HUN,HSA,HCL)H_\text{PP}^\star = \mathrm{argmax}_{H_\text{PP} \in \mathcal{C}_\text{PP}}\ p(\mathcal{D} \mid H_\text{PP};\ H_\text{UN}, H_\text{SA}, H_\text{CL})
p(D∣HPP; ⋅)=∫p(D∣x,θ,HPP; ⋅)p(x,θ∣HPP) dxdθp(\mathcal{D} \mid H_\text{PP};\ \cdot) = \int p(\mathcal{D} \mid \vect{x}, \gvect{\theta}, H_\text{PP};\ \cdot) p(\vect{x}, \gvect{\theta} \mid H_\text{PP})\ \mathrm{d}\vect{x} \mathrm{d}\gvect{\theta}

The process form moves to the left of the semicolon. Its parameters are integrated out rather than fitted, because parameters are artifacts of the equation chosen: comparing forms at their best-fit parameters rewards the one with the most knobs. The evidence of each candidate form is its score.

4 · Estimate the system architecture

Harder still. How do we tell the effects of the architecture from the effects of the parameterisation?

HSA⋆,HPP⋆=argmax p(D∣HSA,HPP; HUN,HCL)H_\text{SA}^\star, H_\text{PP}^\star = \mathrm{argmax}\ p(\mathcal{D} \mid H_\text{SA}, H_\text{PP};\ H_\text{UN}, H_\text{CL})
p(D∣HSA; ⋅)=Eg∼pME(g∣HSA,HCL)[p(D∣g,HSA; ⋅)]p(\mathcal{D} \mid H_\text{SA};\ \cdot) = \mathbb{E}_{g \sim p_\text{ME}(g \mid H_\text{SA}, H_\text{CL})}[ p(\mathcal{D} \mid g, H_\text{SA};\ \cdot)]

Architecture and process forms move left together, because a wrong closure can make a right architecture look wrong. Gupta’s answer is the maximum-entropy route: average over random process functions gg, drawn from the least informative distribution that still obeys the physics, so the closure no longer confounds the architecture. Each candidate then becomes a point on the performance–uncertainty plane.

The pattern

StepInferred, left of the semicolonAssumed correct, right of itSearched overCost of one candidate
1 · Basicthe data’s error modelthe modellikelihood families and covariancesresidual statistics
2 · Easiestx,θ\vect{x}, \gvect{\theta}HUNH_\text{UN}, HPPH_\text{PP}, HSAH_\text{SA}, HCLH_\text{CL}a vector space, with gradientsone inversion
3 · HarderHPPH_\text{PP}HUNH_\text{UN}, HSAH_\text{SA}, HCLH_\text{CL}a set of equationsone evidence: an inversion with its curvature, or an integral
4 · Harder stillHSAH_\text{SA}, HPPH_\text{PP}HUNH_\text{UN}, HCLH_\text{CL}a set of structuresan ensemble over random closures
(5)HCLH_\text{CL}HUNH_\text{UN}conservation lawsGupta notes that the same route could test them; it is rarely done

Diagnose, then revise: what a misfit says

Compare decides which rung to revise. Gupta’s two failures frame it: a model is over-constrained when a hypothesis is stronger than the evidence (a tight band that misses the data) and under-constrained when knowledge is missing (a band so wide it says little); usually it is some of both. Learning is a change in uncertainty, not only a reduction: a posterior can narrow, widen or move, and each says something different about the hypotheses.

Reduced

the posterior is narrower

Increased

the prior was overconfident

Shifted

same width, moved

prior p(θ)p(\gvect{\theta})posterior p(θ∣D)p(\gvect{\theta} \mid \mathcal{D})

Score the change, not only the misfit: the KL divergence from prior to posterior, the change in entropy, and whether the posterior lies inside the prior. A widening is learning too: the prior was overconfident. The measures exist in gauss_flows (kl_divergence, entropy, mutual_information, and their Gaussianization estimators) and gaussx (gaussian_kl_divergence, gaussian_entropy); none is a scorer yet ②.

The misfit looks likeIt saysRevise firstWith
random and unbiased; the spread covers the observationsnothing structural is wrongparameters and state: the inner loopfilterax, vardax, argminax
narrow and wrong: observations outside a tight spreadover-constrained: a hypothesis is too stronguncertainty first (is the spread honest?), then process forms (a deterministic closure?), then architecture (missing heterogeneity)spread–skill, rank histograms; a posterior shifted outside its prior
wide and right: the spread covers everythingunder-constrained: knowledge is missingmore informative data, or a constraint the evidence justifiesexpected information gain (gauss_flows mutual_information)
wrong in time: lagged peaks, the wrong recession or decaya process formprocess formscompare forms by evidence (argminax.diagnose evidence, pyrox-gp log_marginal_likelihood)
wrong in some places or classes: one surface type, one stability classheterogeneity unresolved or wrongly classifiedarchitectureresiduals stratified by class
changes with the grid spacing Δs\Delta s or the time step Δt\Delta tthe solution, not a hypothesisverify firstnumerical methods chapter 24
a budget that does not closea conservation law, or a non-conservative schemeconservation laws, or finite volumes instead of differencesnumerical methods chapters 8 and 13

Comparing hypotheses: the maximum-entropy route

Gupta’s recipe for climbing the ladder without confounding the rungs: at each rung, add only as much information as the evidence justifies at the model’s scale.

A1A2A3vague
under-constrained
vague and wrongconfident and wrong
over-constrained
target−log⁡p(D)-\log p(\mathcal{D}), worse →ensemble entropy H\mathbb{H}, vaguer →

Each candidate architecture is run with random process forms, then placed by its fit (−log⁡p(D∣HSA)-\log p(\mathcal{D} \mid H_\text{SA})) and the entropy of its ensemble, each with a bootstrap box. Rank with a proper score (the log score or CRPS penalises both bias and overdispersion); read the plane to see why one candidate wins. After Gupta’s slide on inferring system architecture.

  1. Fix the conservation laws. They are the rung we are most sure of.

  2. Replace every process form with random functions constrained by physics: bounded by mass balance, monotone where a larger gradient must give a larger flux, stochastic because sub-element conditions differ ③.

  3. Compare architectures on the plane by Monte Carlo over those functions: the closures no longer confound the architecture ④.

  4. Choose process forms by Bayes, given the architecture.

  5. Estimate parameters and state, given both: the inner loop.

Three questions, three figures. The modelling loop says which loop to run next. The ladder says what that loop revises. The six-step cycle says how cheaply each candidate can be evaluated, and this is where it pays: Gupta ran 10,000 cases on a lumped model, and for an ocean or a radiance model that many runs needs step 3’s emulator or step 5’s amortized inference.

Where the slides need care

Where it doesn’t fit