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.

Which context, which stage, which map: where does each piece of code run?

GeoStack · background · the role ladder · where code runs

Abstract

The role ladder says how big a piece is, from a structure to a recipe. Three tiers then say where it runs (its execution context), which job it does in the pipeline (its stage), and, for the pieces that compute, what kind of map it is (its map properties). One data-assimilation window over the North Atlantic carries every section.

Keywords:execution contexthost I/Osetupapplyparallelismpipeline stagemap kindlocalitylinearityadjointdata assimilation

Three tiers

The tiers nest. Every piece of code has an execution context. Every pipeline step is one stage, and its context follows from it. Only the apply stage computes values, so only what runs there carries map properties. The role ladder cuts across all three; it has its own section.

1 · Execution context: where it runs
Host I/OSetupApplyParallelism
2 · Pipeline stage: which job, what it optimises
FindSearchCatalogSave
ComputeStreamSplitApplysetup: fit · planCombine
KeepWriteCommitPublish
colour = context
only the ringed Apply stage
3 · Map properties: apply only, three tags
Map kindbijectioninjectionsurjectionlossywhat can be undone
Localitypointwise · along a dimstencil · regridgather · scatterglobalwhat parallelism needs
Linearitylinearaffinenonlinearwhat has an adjoint

Each stage is coloured by its execution context, as in the role ladder’s figures: blue is host I/O, amber setup, teal apply and violet parallelism, so Split and Combine are parallelism. Fit and plan are Apply’s setup. Tier 3 applies only to the ringed Apply stage, where values are computed.

The running example

Indices: ii runs over output cells or entries, jj over input cells, e=1,…,NEe = 1, \ldots, N_{\mathcal{E}} over members, pp over patches. Distances d(i,j)d(i, j) are great-circle distances in km.

Table 2:The symbols used on this page.

SymbolVariable roleShapeUnit
x\vect{x}state · η\eta, uu, vv on the model gridRDx\mathbb{R}^{D_x}, (field, y, x)m, m s⁻¹
μx\gvect{\mu}_xin · background state, from GLORYSRDx\mathbb{R}^{D_x}m, m s⁻¹
y\vect{y}in · observations, nadir and SWOTRDy\mathbb{R}^{D_y}, (obs,)m
H\mat{H}const · observation operator, η\eta read at each observationRDy×Dx\mathbb{R}^{D_y \times D_x}—
Σε\gmat{\Sigma}_\varepsilonθ\gvect{\theta} · observation-error covarianceRDy×Dy\mathbb{R}^{D_y \times D_y}m²
f,gleft,grightf, g_\text{left}, g_\text{right}a map, its left inverse, its right inverseX→Y\mathcal{X} \to \mathcal{Y}, Y→X\mathcal{Y} \to \mathcal{X}—
A\mat{A}a linear operatorX→Y\mathcal{X} \to \mathcal{Y}—
P↓,P↑\mat{P}_\downarrow, \mat{P}_\uparrowconst · restriction (fine to coarse), prolongation (coarse to fine)RNcoarse×Nfine\mathbb{R}^{N_\text{coarse} \times N_\text{fine}}, RNfine×Ncoarse\mathbb{R}^{N_\text{fine} \times N_\text{coarse}}—
rrθ\gvect{\theta} · reach of an operatorN\mathbb{N}cells
ρ\rhoconst · Gaspari–Cohn taper, ρ(0)=1\rho(0) = 1, zero beyond 2c2cR≥0→[0,1]\mathbb{R}_{\ge 0} \to [0, 1]km → —

Here Dx=NVxNrowNcolD_x = N_{\mathcal{V}_x} N_\text{row} N_\text{col} is the length of the state, DyD_y the number of observations in the window, and NfineN_\text{fine}, NcoarseN_\text{coarse} the cell counts of a fine and a coarse grid.

1 · Execution contexts: where code runs

The first tier has four contexts. Each fixes a library, a precision and one rule about tracing, so it decides most of the engineering before a line is written. Host I/O and setup feed one compiled apply; the parallelism layer runs that apply many times.

Host I/Obytes in and out: find, read, decode, writePython, NumPy, async · never traced
Setuponce per grid or per fit: plans, weights, masks, statisticsNumPy, SciPy, pyproj, GDAL · concrete values · float64
Parallelismruns one kernel many times, over piecesvmap · sharding · threads · async · processes · dask · MPI
Applypure, jit-compiled, differentiable where neededJAX through xp · the data's dtype · setup enters as constants

The parallelism layer wraps the apply: it never needs a second implementation of the kernel.

Table 3:The four execution contexts: what goes in and out, in the window, and what each optimises.

ContextIn → OutIn the windowShape · unitOptimises
Host I/O · bytes ↔ carriers, per file or request, often asyncfiles, objects, API responses → carriersGLORYS Zarr, GEBCO NetCDF, nadir and SWOT L3 files in the window(file,) · byteslatency and bandwidth: concurrency, retries, prefetch. Never traced; precision as stored on disk. Lives in geocatalog, geocloud, geoproducts, xrtoolz-products.
Setup · geometry and data → constants, once per grid, grid pair or fitgrids, positions, training data → weights, indices, masks, statisticsremap weights GLORYS → model, the land mask, each observation’s four cells and hour(target, k) · —amortisation: built once, cached per grid, shipped to workers. Float64, concrete values only; a traced input raises.
Apply · carriers → carriers, every call, under jitstate, observations, setup constants → tendencies, Hx\mat{H}\vect{x}, analysesthe model step, Hx\mat{H}\vect{x}, the cost and its gradient, the local solves(member, field, y, x) · m, m s⁻¹FLOPs fused into one compiled call, and a busy device. Written in xp, so it runs eagerly on NumPy and compiled on JAX; computes in the data’s dtype.
Parallelism · one kernel → many pieces, over members, patches, chunks, files, devicesa kernel and its pieces → the pieces’ results32 members, 300 patches, 240 frames, many files(piece, …) · —throughput: fixed shapes, one transfer per batch, no oversubscribed threads. The tool follows the scope and the communication (section 4).

2 · Pipeline stages: what a job is for

The second tier names the job a step does in the pipeline. There are ten stages in three acts, defined on the geo pipeline page, plus two that cut across all of them: orchestrate (decides what runs when, and resumes after a failure) and observe (logs, metrics, QC taps). Each stage optimises one thing, and its tools are chosen for that one thing. Fit and plan, which build Apply’s constants from data and from grids, have no stage of their own among the ten: they are Apply’s setup, run once before the first patch is applied, as the pipeline page fits a scene-wide statistic first and then applies it per patch.

Findno pixel is decoded

searcha question → file namesnames, not data

catalogfiles → table of footprints; table, window → rowsoptimises: one scan, many queries; no bytes read

saverows → local copiesoptimises: download once

Computesplit → apply → combine, on a lazy field

streamfiles, window → carrieroptimises: only the window’s bytes

splitcarrier → patches with halosoptimises: equal pieces, small halo

Apply’s setup, once, before the first call

fitdata → statistics θ\gvect{\theta}optimises: fit once, reuse

plangrids → weights, indicesoptimises: geometry once per grid

applybatch, θ\gvect{\theta}, plan → outputsoptimises: fused FLOPs

combinetiles, weights → fieldoptimises: no seams

Keepa file, a version, a record

writefield → COG, Zarr chunksoptimises: aligned chunks

commitchunks → one versionoptimises: all or nothing

publishversion → catalog recordoptimises: findable by the next run

orchestrate · observe — across every stage

The ten stages in three acts, top to bottom. Colour is the execution context (blue host I/O, amber setup, teal apply, violet parallelism); fit and plan are drawn as Apply’s setup. Each act has a figure of its own below.

2.1 Act 1 · Find: search, catalog, save

Finding answers “which files touch my window and time?” without reading a pixel. Search asks the archive what it holds and gets names back, not data. Catalog scans the archive once into a table of footprints and times (its index), then intersects that table with the window (its query). For the North Atlantic box this turns a full archive into the handful of GLORYS days, one GEBCO tile and the altimetry passes that cross it.

files
index
timefootprint
query
2 rows0 bytes read
GeoParquet table · one row per file

Save moves bytes, so its cost is latency and bandwidth, not FLOPs: it copies the rows’ files into a local cache once, with many downloads in flight. All three stages of the act are host I/O: threads or async, never JAX.

Table 4:The Find stages: what each takes and gives, what it optimises, and the tool.

StageIn → OutOptimisesTool
searcha question → file namesnames, not dataa folder listing; STAC or CMR in production
catalog, its indexfiles → table (file,)one scan amortised over every later querygeocatalog.build
catalog, its querytable, GeoSlice → rowsno bytes read; spatial index, not a loopgeocatalog.query
saverows → local filesdownload once; parallel requestsgeocatalog.stage(LocalCache, parallel=8)

2.2 Act 2 · Compute: stream, split, apply, combine

The second act turns the saved files into one carrier, cuts it into pieces, computes on each piece and stitches the results back.

Stream

Stream decodes only the window’s byte ranges into a carrier. It is still host I/O, like save: threads or async, never JAX.

object store
save ×8
local cache
stream
windowbyte ranges only

Table 5:The Stream stage.

StageIn → OutOptimisesTool
streamfiles, window → GeoArray["band y x"]bytes read ∝\propto window, not fileCogField, prefetch_iterable, product readers

Split

Split turns one big field into many equal pieces with a halo of reach rr around each, so a local operator can run on a piece alone. Equal shapes matter more than equal areas: one compiled kernel, no retracing. The halo is the price, and it is paid in every piece.

corehalo rr

split

(patch, y, x)fixed shape

Table 6:The Split stage.

StageIn → OutOptimisesTool
splitfield → (patch, y, x) + positionsequal shapes, smallest halo that covers rrSpatialPatcher, SphericalCap, batch_split

Apply, and its setup

Apply reads constants many times, and building them is its setup. Fit learns statistics θ\gvect{\theta} from data (a mean, a scale, a climatology, a background covariance) and stores them with a trailing underscore. Plan builds geometry from grids alone (remap weights, the four cells and hour of each observation, a mask). Both run once, on concrete values, in float64.

data

fit

μ,σ\gvect{\mu}, \gvect{\sigma}θ\gvect{\theta} (once)

fine grid

plan

coarse grid

weights (target, k) and indices (target, k): no field values needed

Apply is the only stage that does the science. It takes a batch, θ\gvect{\theta} and the plan, and is one jitted function vmapped over the batch axis. Everything before it exists so that this call has fixed shapes, constants already built and data already on the device.

batch

θ\gvect{\theta}, planjit(vmap(f))

outputs

What an apply does to its input is the third tier, map properties; how big the pieces inside it are is the role ladder, rungs ⓪ to ④.

Table 7:Apply’s setup: fit and plan.

StageIn → OutOptimisesTool
apply, setup: fitdata → θ\gvect{\theta}, stored with a trailing underscorefit once, without racesfit_once, fit(x) -> self
apply, setup: plansource grid, target grid → (target, k)geometry once per grid pair, cachedReproject(engine="interp"), the interp plans

Combine

Combine undoes split. Each pixel is covered by several patches, and its value is their weighted mean, so the seams vanish. With weights that taper to zero at a patch edge,

xi=∑pwi(p)xi(p)∑pwi(p)x_i = \frac{\sum_p w_i^{(p)} x_i^{(p)}}{\sum_p w_i^{(p)}}

where pp runs over the patches that cover pixel ii, xi(p)x_i^{(p)} is patch pp’s value there, in the field’s unit, and wi(p)w_i^{(p)} its weight, dimensionless. An inverse-variance weight w=1/σ2w = 1/\sigma^2, with σ2\sigma^2 the analysis-error variance of a patch at the pixel, makes (1) the minimum-variance merge of the analyses.

overlap: ∑wx/∑w\sum w x / \sum w

combine

one field, no seams

Table 8:The Combine stage.

StageIn → OutOptimisesTool
combine(patch, y, x), weights → (y, x)no seams; streaming, bounded memoryOverlapAdd, InvVarWeightedMean, max_in_flight

2.3 Act 3 · Keep: write, commit, publish

Keeping is host I/O again. Write lays the field into chunks that match how it will be read; commit makes the chunks of one run a single version, visible all at once or not at all; publish adds a record to a catalog, so the next run’s query finds it. That closes the loop back to Find.

Zarr / COG chunks
commit
v1 · v2 · v3
publish
catalog recordfootprint, time, version→ the next run's query

Table 9:The Keep stages.

StageIn → OutOptimisesTool
writefield → chunkschunks aligned with patches and readswrite_cog, WriteCOG, Zarr
commitchunks → versionatomic: no half-written run is ever readPatchJournal; Icechunk (proposed)
publishversion → recordfindable by the next queryproduct catalog (proposed)

3 · Map properties: what an apply does to its input

Inside apply, every operator f:X→Yf : \mathcal{X} \to \mathcal{Y} sits at one point on three independent axes. Map kind says whether information is kept (can we invert it?). Locality says which inputs each output reads (how can we parallelise it?). Linearity says whether it has an adjoint (can we take its gradient cheaply and test it?). Here X\mathcal{X} is the input space, Y\mathcal{Y} the output space, and x∈X\vect{x} \in \mathcal{X}, y∈Y\vect{y} \in \mathcal{Y}.

3.1 Map kind: what is kept

bijectionone-to-one, onto · f−1f^{-1} exists

injectionnothing lost · some outputs unhit

surjectionevery output hit · inputs merge

lossy (neither)merges and misses · no inverse

Hollow rings mark outputs no input reaches. A merge (two arrows into one dot) is information lost.

Table 10:The four map kinds, with stack examples and what each buys.

KindStack examplesWhat it buys
bijectionstandardise with fitted μ,σ\gvect{\mu}, \gvect{\sigma}; a flow layer; a change of variablesexact inverse; density transform
injectionembed, pad, prolongation P↑\mat{P}_\uparrow, stacka left inverse (select, crop, P↓\mat{P}_\downarrow)
surjectionselect, crop, restriction P↓\mat{P}_\downarrow, Hx\mat{H}\vect{x}, a band meana right inverse; the reason DA is ill-posed
lossythresholds, masks with a fill, clipping, a quantisernothing to undo; keep it last or log what it drops

3.2 Locality: which inputs each output reads

Locality is the sparsity of the Jacobian. Output yiy_i depends on input xjx_j only when the two are within reach rr:

∂yi∂xj=0 if d(i,j)>r\frac{\partial y_i}{\partial x_j} = 0 \text{ if } d(i, j) > r

where d(i,j)d(i, j) is the distance between the output’s and the input’s positions, in cells or km. Small rr means small halos and free parallelism; rr as big as the domain means one piece, or communication.

pointwiser=0r = 0

along a dimr=0r = 0 across, ∞\infty along

stencilr=1r = 1 cell

regrid blockrr = coarse cell

gatherpoint ← 4 cells

scatterpoints → a cell

globalrr = domain

output inputs read observation

reach rr grows → halo grows → parallelism costs morepointwise stencil regrid local solve globalvmap anything halo, then vmap patches one device, or exchange

Locality in time follows the same pattern: a step reads its predecessor (r=1r = 1 step), so time is sequential unless the frames are independent (a pointwise climatology, a per-frame H\mat{H}).

Table 11:Locality classes, an example of each, the parallel tool it calls for, and what it does to the Coupling.

LocalityExampleParallel toolCoupling effect
pointwisestandardise, index, thresholdvmap, any chunkingkeep
along a dima band mean, a vertical mode, a time meanchunk the other dimsreduce, mix
stencilgradient, Laplacian, advectionhalo of rr, then patcheskeep (+ halo)
regridP↓\mat{P}_\downarrow, P↑\mat{P}_\uparrow, reprojectchunk the target, read the footprintregrid
gatherHx\mat{H}\vect{x}: obs ← 4 cellsvmap over observationsselect
scatterH⊤y\mat{H}^\top\vect{y}, binning points to cellssegment_sum, not a loopexpand
globala Poisson solve, a full-domain EOFone device, or MPI exchangemix

3.3 Linearity: is there an adjoint?

A linear operator A\mat{A} satisfies A(αx1+βx2)=αAx1+βAx2\mat{A}(\alpha \vect{x}_1 + \beta \vect{x}_2) = \alpha \mat{A}\vect{x}_1 + \beta \mat{A}\vect{x}_2 for scalars α,β\alpha, \beta. It has an adjoint A⊤:Y→X\mat{A}^\top : \mathcal{Y} \to \mathcal{X}, defined by the dot-product identity:

⟨Ax,y⟩Y=⟨x,A⊤y⟩X\langle \mat{A}\vect{x}, \vect{y} \rangle_{\mathcal{Y}} = \langle \vect{x}, \mat{A}^\top \vect{y} \rangle_{\mathcal{X}}

where ⟨⋅,⋅⟩X\langle \cdot, \cdot \rangle_{\mathcal{X}} and ⟨⋅,⋅⟩Y\langle \cdot, \cdot \rangle_{\mathcal{Y}} are the inner products of the input and output spaces, each a scalar. The identity is also the test: draw random x\vect{x}, y\vect{y}, compare both sides of (9), and a hand-written adjoint either matches to rounding or is wrong.

X\mathcal{X} state

Ax\mat{A}\vect{x} (forward)A⊤y\mat{A}^\top \vect{y} (adjoint)

Y\mathcal{Y} obs

⟨Ax,y⟩Y=⟨x,A⊤y⟩X\langle \mat{A}\vect{x}, \vect{y} \rangle_{\mathcal{Y}} = \langle \vect{x}, \mat{A}^\top \vect{y} \rangle_{\mathcal{X}} to rounding

The adjoint is what makes a gradient cheap. The observation part of the 3D-Var cost and its gradient are

Jo(x)=12(h(x)−y)⊤Σε−1(h(x)−y)\mathcal{J}_\text{o}(\vect{x}) = \frac{1}{2} (h(\vect{x}) - \vect{y})^\top \gmat{\Sigma}_\varepsilon^{-1} (h(\vect{x}) - \vect{y})
∇xJo(x)=H⊤Σε−1(h(x)−y)\nabla_{\vect{x}} \mathcal{J}_\text{o}(\vect{x}) = \mat{H}^\top \gmat{\Sigma}_\varepsilon^{-1} (h(\vect{x}) - \vect{y})

where h:RDx→RDyh : \mathbb{R}^{D_x} \to \mathbb{R}^{D_y} is the observation operator, H∈RDy×Dx\mat{H} \in \mathbb{R}^{D_y \times D_x} its Jacobian (h(x)=Hxh(\vect{x}) = \mat{H}\vect{x} when hh is linear), Σε∈RDy×Dy\gmat{\Sigma}_\varepsilon \in \mathbb{R}^{D_y \times D_y} the observation-error covariance in m², and Jo\mathcal{J}_\text{o} a dimensionless scalar. One forward and one adjoint call give the whole gradient (11), whatever the size of x\vect{x}.

Table 12:The three linearity classes, with examples and what each buys.

LinearityExamplesWhat it buys
linearH\mat{H} as interpolation, P↓\mat{P}_\downarrow, P↑\mat{P}_\uparrow, a stencil, a remap planan adjoint, the dot-product test, CG and lineax solves
affinestandardise (x−μ)/σ(\vect{x} - \gvect{\mu}) / \gvect{\sigma}, a calibration with offsetlinear after removing the offset; exact inverse if every entry of σ\gvect{\sigma} is positive
nonlinearthe model step, advection with WENO, a neural termtangent-linear and adjoint by jax.jvp, jax.vjp around a state

3.4 Ten operators on all three axes

Table 13:Ten operators of the window, each placed on the three axes.

OperatorMap kindLocalityLinearity
standardise (fitted μ,σ\gvect{\mu}, \gvect{\sigma})bijectionpointwiseaffine
select / cropsurjectionpointwiselinear
embed / padinjectionpointwiselinear
gradient, Laplacianlossy (constants vanish)stencillinear
restriction P↓\mat{P}_\downarrowsurjectionregridlinear
prolongation P↑\mat{P}_\uparrowinjectionregridlinear
Hx\mat{H}\vect{x}, bilinear in space and timesurjectiongatherlinear
model step Δt\Delta tbijection (smooth flow, in practice)stencil, r=1r = 1 stepnonlinear
local ETKF analysislossylocal solve, r=2cr = 2cnonlinear
Poisson solvebijection on zero-mean fieldsgloballinear

3.5 One regrid, two contexts

Most regrids split into a setup that needs only geometry and an apply that needs only values. Take block-averaging GLORYS onto the model grid, P↓\mat{P}_\downarrow:

Setupaverage_planonce per grid pair · NumPy, float64

In

Gsrc,Gtgt\mathcal{G}_\text{src}, \mathcal{G}_\text{tgt} source and target gridsGLORYS 360 × 480 and model 120 × 160; transforms and CRS onlyGrid, Grid · —

↓ wik=aik/∑k′aik′w_{ik} = a_{ik} / \sum_{k'} a_{ik'}

Out · constants for every apply

W,V\mat{W}, \mat{V} weights and source indices9 source cells per target cell(target, k), (target, k) · —

Here aika_{ik} is the overlap area of target cell ii and its kk-th source cell. Concrete values only; cached per grid pair.

Applyaverage_applyevery field, every frame · jit, vmap over time

In

xsrc\vect{x}_\text{src} GLORYS fieldone frame of SSH, T or S(y_s, x_s) · m, °C, psu

Constants · from the setup

W,V\mat{W}, \mat{V}enter the trace as constants(target, k) · —

↓ xtgt,i=∑kwikxsrc,Vikx_{\text{tgt},i} = \sum_k w_{ik} x_{\text{src}, V_{ik}}

Out

xtgt\vect{x}_\text{tgt} on the model grida gather and a weighted sum: linear, regrid-local(y, x) · as input

Its adjoint is the same weights scattered back with segment_sum. The interp plans exist today; the “average” plan is missing.

Here Gsrc\mathcal{G}_\text{src} and Gtgt\mathcal{G}_\text{tgt} are the source and target grids, W\mat{W} and V\mat{V} the plan’s weights (dimensionless) and source-cell indices, both (target, kk) with kk indexing a target cell’s source cells, xsrc\vect{x}_\text{src} one GLORYS frame and xtgt\vect{x}_\text{tgt} the same frame on the model grid, in the input’s unit.

4 · Parallel tools: which tool for which piece

The parallelism context splits further, by two questions. Scope: where do the pieces live (one kernel, one device, several devices, processes, machines)? Communication: are the pieces independent, or do they exchange a halo every step? Host I/O sits in a band of its own, because waiting on a network is concurrency, not compute.

scopeindependentexchange per step
one kernelmembers, patches, obsvmap32 × 300 in one callroll / padin the stencil
one devicetoo big for one calllax.map / scanbatches in sequencescantime steps
several devicesone hostsharding (jit)split the batch axisshard_map+ ppermute halos
several processesCPU-bound setupProcessMap (spawn)plans, GDAL, decodingmpi4jaxrank per subdomain
several machinesmany windows, yearsdask / map_blocksone jitted apply per chunkMPIjax.distributed
host I/O concurrencyThreadMap · AsyncMap · obstore range reads · prefetchwaits on the network, so threads and async beat processes

All rows are parallelism, so all are violet. The two outlined in bold run inside one jit and need no code beyond the apply; the rows below add workers or devices. The right column needs the halo exchange that locality rr implies. The blue band is host I/O.

Table 14:Five rules for running pieces in parallel.

RuleWhy
Never fork after JAX startsJAX’s threads do not survive fork; use spawn, or start workers before importing JAX.
Budget threadsBLAS × workers × XLA threads oversubscribes the CPU; set one per worker.
One accelerator per processtwo processes on one GPU fight over its memory.
Random keys by fold_infold_in(key, patch_id) gives each piece the same draw on every rerun and every layout.
Ship the setup, not the recipesend workers the built plan; rebuilding it in each worker repeats the setup once per worker.

5 · The role ladder: how big a piece is

The three tiers say where code runs, which job it does and what map it is; they don’t say how big a piece is. The role ladder does, from a ⓪ structure to a ⑥ recipe, and on this page “role” means a rung and nothing else. It meets the tiers at fixed places (the ladder and the other axes): rungs ⓪ to ④ are the compiled region, where functions and Modules trace under one jit; a ⑤ step is where a carrier is unwrapped and rewrapped; every pipeline stage is a ⑤ step, the stage chain is a ⑥ recipe, and setup, beside the ladder, builds the ③ models’ state. The ocean example’s ladder draws this window’s pieces on every rung, coloured by the context they run in.

6 · Everything in one pipeline

The running example, tagged by context and rung. The state x\vect{x} has DxD_x entries, the ensemble NEN_{\mathcal{E}} members, y\vect{y} holds the window’s observations, H\mat{H} is the observation operator built from the plan WH,VH\mat{W}_H, \mat{V}_H, Σε\gmat{\Sigma}_\varepsilon the observation-error covariance, ρ\rho the localisation taper and P↓\mat{P}_\downarrow the block average to the coarse grid.

# Shapes: N_row = 120, N_col = 160 cells; 3 fields; N_ℰ = 32 members;
#         D_y observations; N_patch = 300 patches; N_frame = 240 frames
# Units:  SSH m, T °C, S psu; distances km; time s

# ── host I/O · catalog, save · ① primitives, ② strategy ──
# today (geocatalog)
# rows = {files : footprint ∩ window ≠ ∅}
# → (file,) table
rows = geocatalog.query(index, window)
# today (geocatalog)
# → local paths
paths = geocatalog.stage(rows, LocalCache(root), parallel=8)

# ── setup · Apply's plans · builds ③ models (NumPy, float64)
# proposed (average plan)
# w_ik = a_ik / ∑_k' a_ik'
# (y_s, x_s) grid, (y, x) grid → (target, 9) weights, indices
glorys_plan = average_plan(glorys_grid, model_grid)
# today* (geoops)
# y_o ≈ ∑ w x at the 4 cells and 2 hours around each obs
# (obs, 2) positions → (obs, 8) weights, indices
obs_plan = interp_plan(model_grid, obs_lonlat, obs_time)

# ── parallelism · split · ② strategy SphericalCap ───────
# today (geopatcher)
# halo = 2c, the taper cutoff
# (member, field, y, x) → (patch, member, field, y_p, x_p)
patches = batch_split(background_ensemble, SphericalCap(cutoff_km=300))

# ── apply · apply · ④ algorithm under jit(vmap) ─────────
# user
# x̄_t|t = μ_x + X̃ Wₐ (y − H μ_x), with Σ_ε⁻¹ tapered by ρ
# map the patch axis only; every patch gets all D_y observations, and ρ zeroes
# those beyond the cutoff from its centre
# (patch, member, field, y_p, x_p), (obs, 8), (obs,) → (patch, member, field, y_p, x_p)
analysis = jax.jit(jax.vmap(local_etkf, in_axes=(0, None, None)))(
    patches, obs_plan, obs_values
)

# ── parallelism · combine ────────────────────────────────
# today (geopatcher)
# x_i = ∑ₚ w_i⁽ᵖ⁾ x_i⁽ᵖ⁾ / ∑ₚ w_i⁽ᵖ⁾
# (patch, member, field, y_p, x_p) → (member, field, y, x)
analysis_field = combine(analysis, OverlapAdd(taper="cosine"))

# ── apply · multiscale · ④ algorithm over a ③ plan ──────
# proposed (average plan)
# x_c = P↓ x
# (member, field, 120, 160) → (member, field, 30, 40)
coarse = jax.vmap(average_apply, in_axes=(0, None))(analysis_field, coarse_plan)

# ── host I/O · write, commit · ① primitive ──────────────
# today (geocloud)
# (field, y, x) → COG
geocloud.cog.write_cog(analysis_mean, out_uri)
# proposed (Icechunk)
# chunks → one version
session.commit("window 2026-11, local ETKF")

Program 1:The window tagged by execution context, stage and rung, from the catalog query to the committed analysis.

Read down the comments: the section headers name the execution context, the stage and the rung, the today/proposed markers are the status, and every line between them is one stage. The two lines that do science, local_etkf and average_apply, are the only ④ algorithms and the only ones under jit; wrapped in a ⑤ step each, and chained, they would make the ⑥ recipe DACycle.

7 · Numbers for the running example

Table 15:The window’s sizes, by execution context and stage.

Context · stageQuantityValueUnit
host I/O · streamGLORYS, 3 fields × 360 × 480 float32, per frame2.07MB
host I/O · saveGEBCO, 7 200 × 9 600 int16, once138MB
setup · plan, for applyGLORYS → model, taps per cell9—
setup · plan, for applyGEBCO → model, taps per cell (avoid: reshape-mean)3 600—
apply · state3 × 122 × 162 entries with the ghost ring59 292values
apply · ensemble57 600 × 32 float32 (no ghosts)7.37MB
parallel · splitpatches, each one 32 × 32 eigen-decomposition300solves
parallel · splitper-cell local analysis instead (one per cell)19 200solves
apply · multiscalecoarse grid 30 × 401 200cells