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 axis, which pixel, which face: what does each carrier know?

GeoStack · background · carriers · 1 of 2: one array

Abstract

A carrier is an array plus the names that stop it being misread. The stack has three of its own, DimArray, GeoArray and CField, and meets a fourth, xarray’s DataArray, at its edges. Each answers one question about where a value is, and refuses the others. One data-assimilation window over the North Atlantic carries every section.

Keywords:carriersDimArrayGeoArrayGeoSwathGeoPointsCFieldxarraystaggergeoreferencedata assimilation

Who and what the carriers serve

A carrier exists for the people who will hold it and the packages that will take it. Each of the four is shaped around one group of users, and around the packages those users already work in. That is the real reason there are several: each carries only the names its own users read.

Table 1:Who holds each carrier, what they ask of it, and what they hold in the window.

UsersThey askThey holdIn the window
Remote-sensing and EO researcherswhere on Earth is this pixel, and what does this sensor see there?GeoArray, GeoSwath, GeoPointsGLORYS, GEBCO, nadir tracks, the SWOT swath, tide gauges
Model and numerics developerswhere in the cell is this value, and which stencil reads it?CFieldη\eta, uu, vv and the depth on the C-grid
ML and DA researcherswhich axis is which, and what shape goes into the solver?DimArray, plain arrays, the pytreeensembles, innovation statistics, the DA vector
Analysts and data engineerswhich value sits at which coordinate, on disk and lazily?xr.DataArray, Dataset, DataTreethe GLORYS store, the window written to Zarr
users · EO and remote-sensing researchers
GeoArray · GeoSwath · GeoPointsgeotoolz-array
packages · geoops, geopatcher, geocatalog, geoproducts, geocloud
hoped for · rtmx and plumax (methane), xrtoolz-products
users · model and numerics developers
CFieldgridax
packages · gridax operators and GridOps, sesmax-core terms and states
hoped for · sesmax-ocean, sesmax-couple, spectraldiffx fields
users · ML and DA researchers; everyone, once the grid is gone
DimArraypipekit-array
packages · pipekit's dim functions and operators, every adapter above
hoped for · filterax and vardax diagnostics, ML feature pipelines
users · analysts and data engineers
xr.DataArrayxarray, from outside the stack
packages · xrops, sesmax-core io, geoarray to_xarray, geocatalog load
hoped for · xgcm on model output, Icechunk stores of each window

Teal: pytrees that enter jit. Blue: outside the trace. “Hoped for” names packages that should take the carrier as it is, with no wrapper of their own.

Two rules follow from serving several groups at once. A package takes the carrier its users already hold, and never asks them to learn another one to call it. And every carrier stays optional: a plain array works everywhere, so nobody pays for metadata they do not read.

At a glance

Every carrier starts from the same plain array and adds the least metadata its one question needs. The three stack carriers are pytrees and live inside the trace; the DataArray meets them at the jit boundary.

plain array x\vect{x}shape only: (240, 122, 162)

+ dim names, labels

DimArraywhich axis is which(“time”, “y”, “x”)

+ transform, CRS, fill+ stagger per axis

GeoArraywhere on Earth each pixel is+ GeoSwath (lat, lon per pixel)+ GeoPoints (moving or stations)

CFieldwhere in the cell each value sitsT, U, V, X positionsgrid passed to the operator

GeoArray ↔ A-grid CField: the only geo ↔ grid bridge

pytrees above · jit, grad, vmapjit boundary: to_xarray ↓ · from_xarray ↑

xr.DataArraywhich value at which coordinatecoords, align by value, lazy dask chunksfiles: netCDF, Zarr

pipekit adapter registry: all four reach the shared dim functions

Teal: pytrees, inside the trace. Blue: outside it. The registry under all four is why one reduce or isel works on each.

The running example

Notation

Indices: jj is the row (y), ii the column (x), tt the frame, kk the axis of an array.

Table 3:The symbols used on this page.

SymbolMeaningShapeUnit
x\vect{x}the plain array a carrier holdsRN1×…×NK\mathbb{R}^{N_1 \times \ldots \times N_K}the field’s
d\vect{d}dim names, one per axisKK strings—
C\mathcal{C}labels or coordinates per axisper axisper axis
Γ\Gammageoreference: CRS, transform, fill, attrstuple—
A\mat{A}affine transform (a,b,c,d,e,f)(a, b, c, d, e, f)(6,), float64° or m per pixel
s\vect{s}stagger: one position per grid axis{y, x} → {center, right}—
η,u,v\eta, u, vsea-surface height, eastward and northward velocity(y, x)m, m s⁻¹
H\mat{H}observation operator: η\eta read at each observation(y, x) → (obs,)m → m

1 · Three levels of data

The data axis of the stack has three values (from GeoStack’s kinds-and-roles page). A carrier is the top one; the levels below it are what a kernel sees after it unwraps.

(122, 162)arraywhich axis is y?

x → y ↓η\etanamed arraywhere on Earth?

70°W, 55°N 30°W, 25°Nη\etacarrieranswers both

A kernel sees the left box; the carrier unwraps to it, and rewraps the result.

2 · DimArray: which axis is which

DimArray is the plain carrier: data, a name per axis and static labels (band names, levels, members), and no geography. It is what a kernel’s output becomes once the spatial dims are gone, and what any carrier becomes when its defining dims are consumed.

field ↗y ↓data(field, y, x)x →
dims (static)("field", "y", "x")labels (static)etauvpytree leafdata only; a new label set recompilescombine checksshared dims agree exactly

A DimArray: a 3-D block with named axes and labels on the field axis.

Packagepipekit-array; the reference adapter, DimArrayAdapter
BackendsNumPy, JAX, dask
Recompiles whendims or labels change
In the windowthe innovation statistics per hour, a basin-mean time series, any ensemble summary that has left the grid
RefusesCRS, transform, stagger, fill values: those are another carrier’s question

3 · GeoArray: where on Earth each pixel is

GeoArray holds data whose last two dims are (y, x), plus the georeference Γ\Gamma: a CRS, a six-number affine transform, a fill value and frozen attrs. The transform is the grid, so a GeoArray carries its own grid, cheaply.

3.1 The affine transform is the grid

A pixel at column ii, row jj has its centre at

λji=a(i+12)+b(j+12)+c\lambda_{ji} = a (i + \frac{1}{2}) + b (j + \frac{1}{2}) + c
ϕji=d(i+12)+e(j+12)+f\phi_{ji} = d (i + \frac{1}{2}) + e (j + \frac{1}{2}) + f

where (a,b,c,d,e,f)(a, b, c, d, e, f) is the transform in GDAL/affine order, λ\lambda the longitude and ϕ\phi the latitude, in degrees (or x and y in a projected CRS, in metres). For the model’s T cells, a=0.25a = 0.25, e=−0.25e = -0.25, c=−70c = -70, f=55f = 55 and b=d=0b = d = 0, so pixel (0, 0) is centred at 69.875°W, 54.875°N and rows run south.

i=0i = 012…\ldotsj=0j = 01⋮\vdots

corner (c,f)=(−70∘,55∘)(c, f) = (-70^{\circ}, 55^{\circ})a=0.25∘a = 0.25^{\circ} east per columne=−0.25∘e = -0.25^{\circ} per row: rows run south

transform A\mat{A}, 6 numbers(0.25, 0, −70, 0, −0.25, 55)float64, a pytree leaf: a new transform does not recompile

  • crs EPSG:4326, fill, attrs(static: a change recompiles)

Dark dot: the corner the transform names. Teal: the centre of pixel (0, 0), half a pixel in from it.

3.2 Four geometries, three classes

What changes between geometries is how a value’s position is found. On a regular grid it is a function of the index: six numbers. On a swath it is stored per pixel, and the index still says which pixels are neighbours. For points it is stored per sample, with no neighbours at all, and there are two ways to sample: platforms that move, each sample with its own time, and stations that stay put, sharing one time axis. geoarray keeps the last two in one class, GeoPoints, with two modes; the window uses all four.

grid · GeoArray(y, x); position = f(index)6 numbersGLORYS, GEBCO, \eta frames

swath · GeoSwath(row, col); lat, lon per pixelneighbours from the indexSWOT KaRIn swath

t1t_1tnt_nmoving points · GeoPoints(obs,); xy and time per obsno neighbours, no shared timenadir tracks, Argo, drifters

Bermuda Halifax stations · GeoPoints(time, obs); xy once per sitespace fixed, time sharedtide gauges, weather stations

Top: position from the grid. Bottom: position stored per sample. Blue: observations, as everywhere; triangles are fixed sites, each with a time series.

These are CF’s discrete sampling geometries: moving points are its point and trajectory types, stations its timeSeries. Its profile type (an Argo cast, a radiosonde) adds depth or height, which GeoPoints carries as z with a vertical; the SSH window has no vertical axis, so profiles stay out of it.

Packagegeotoolz-array, import geoarray; adapters GeoArrayAdapter, GeoSwathAdapter, GeoPointsAdapter
Pytree leavesdata and transform (float64, (*batch, 6); x64 required)
Staticcrs, fill_value, attrs, dims, coords
Dimsany, ending in (y, x); leading dims may index transform rows
combine checkssame grid (GridMismatchError) and same fill
Nodatafill_value is nodata; a pixel is invalid when any band is non-finite or equals the fill
Refusesa georeader GeoTensor (an ndarray subclass that np.asarray would silently strip); aligning two grids by value

3.3 Points: moving or static

One class, two modes, and the mode is fixed by where time lives. GeoPoints takes either a per-sample time (obs,) or a shared time dim, and raises if given both. Stations are not a fourth carrier: they differ from moving points only in which coordinates are indexed by obs, and a second class would repeat the adapter, isel, interp_at and the combine check.

Table 4:The two modes of GeoPoints.

Moving pointsStations
Data(obs,), or (variable, obs)(time, obs)
Positionsxy (obs, 2): one per samplexy (obs, 2): one per site, for every time
Timeleaf time (obs,)a time dim with a TimeAxis
Hx\mat{H}\vect{x}interp_at(frames, pts, frame=hour): each sample reads its own frameinterp_at(frames, gauges): time stays a leading dim
Mean over timenot defined: no time axisstill GeoPoints: one value per site
Mean over obsDimArrayDimArray (time,)
combine checkssame xy, time, z, validsame sites, same time axis
Gapsnone to fill: a missing sample is absenta gauge down for a day: NaN or valid=False along time

The difference that matters most is the Hx\mat{H}\vect{x} plan. Write wolw_{ol} for the bilinear weight of sample oo on its ll-th neighbouring cell VolV_{ol}, and tot_o for the frame a moving sample reads. For stations the weights are a function of the site alone, so they are built once and reused for every frame:

(Hxt)o=∑l=14wolxt,Vol(\mat{H}\vect{x}_t)_o = \sum_{l=1}^{4} w_{ol} x_{t, V_{ol}}

where xt\vect{x}_t is frame tt of η\eta, shape (y, x) in m, the weights are dimensionless, and l=1,…,4l = 1, \ldots, 4 runs over the four cells around the site. For moving points each sample has its own time, so the weights cover space and the two frames around it:

(Hx)o=∑l=18wolxtol,Vol(\mat{H}\vect{x})_o = \sum_{l=1}^{8} w_{ol} x_{t_{ol}, V_{ol}}

where x\vect{x} now holds every frame, shape (time, y, x) in m, l=1,…,8l = 1, \ldots, 8 runs over four cells in each of two frames, and tolt_{ol} is the frame of tap ll.

stations: plan once, gather every frame

setup, once(site, 4) weights

240 frames

vmap(gather)→ (time, obs)

the plan is a ③ model shared by H\mat{H} and its adjoint; one per gauge network

moving points: a plan per sample, in space and time

frame tt

frame t+1t + 1

4 cells × 2 frames= 8 taps per samplerebuilt for every window’s new set of tracks

Both are linear gathers, so both have a scatter as their adjoint; what differs is how often the plan is built, and how many taps it has. Today interp_at reads one frame per sample (frame=), so the time half of the 8-tap plan is nearest-hour, not linear in time.

4 · CField: where in the cell each value sits

On an Arakawa C-grid, η\eta sits at cell centres, uu on east faces and vv on north faces, all stored in arrays of the same shape. The index alone does not say which; the stagger does. CField adds one stagger per grid axis and nothing else.

4.1 Four positions, one index

gridax stores every field at the same index (j,i)(j, i) and records the position in the stagger: an axis left out is centred, and right means half a cell up that axis. The point’s name is a shorthand, CField(data, dims, loc="U"):

Table 5:The four points of a C-grid cell and their stagger.

PointPosition of value (j,i)(j, i)stagger as storedIn the window
T(j,i)(j, i)()η\eta, depth HH
U(j,i+12)(j, i + \frac{1}{2})(("x", "right"),)uu
V(j+12,i)(j + \frac{1}{2}, i)(("y", "right"),)vv
X(j+12,i+12)(j + \frac{1}{2}, i + \frac{1}{2})(("x", "right"), ("y", "right"))relative vorticity

Tη\eta, depth HHUuu, (j,i+12)(j, i + \frac{1}{2})Vvv, (j+12,i)(j + \frac{1}{2}, i)Xvorticity, (j+12,i+12)(j + \frac{1}{2}, i + \frac{1}{2})cell (j,i)(j, i): north is up, jj grows north

loc → staggerT ()U x: rightV y: rightX both rightleft out = centred

All four live in arrays of total shape (122, 162): the interior plus one ghost ring. Only the stagger tells them apart.

4.2 Why a CField does not hold its grid

A GeoArray holds its grid because a transform is six numbers. A gridax spherical C-grid holds its metric as arrays: cos⁡ϕ\cos\phi at T and at V rows, each field-sized, plus the 1-D latitudes and longitudes and the scalars Δλ\Delta\lambda, Δϕ\Delta\phi and RR (the Earth’s radius). Carrying them on every field would copy the grid into every term of every tendency, so the grid travels with the operator instead: an argument to a canonical function, or bound once in GridOps. The CField docstring says it outright: “It never holds the grid.”

4.3 The stagger check catches a wrong term

A tendency adds terms. Every term of ∂tu\partial_t u must sit at U, and adding a T-point term to it is a physics bug that a plain array would accept. The canonical functions take CFields through @located, which checks each operand’s point, calls the function on the arrays and puts the result on its declared point; combine does the same for element-wise maths. Both check at trace time:

# Shapes: (member, y, x) = (32, 122, 162); η at T, u at U, v at V
# Units:  η m; u, v m s⁻¹; f s⁻¹; g m s⁻²
# today (gridax)
ops = gridax.GridOps(grid, mask)
# today (gridax)
# v̄ = average of the four V points around each U point
# CField[V] → CField[U]
v_at_u = ops.interpolate(state.v, dst="U")
# today (gridax)
# δₓη at U = (η[j, i+1] − η[j, i]) / Δx
# CField[T] → CField[U]
deta_dx = ops.difference(state.eta, axis="x", dst="U")
# today (gridax)
# ∂ₜu = f v̄ − g δₓη: both operands at U, one check
# → CField[U], m s⁻²
du = gridax.combine(lambda vb, dx: f * vb - g * dx, v_at_u, deta_dx)
# today (gridax)
# U + T: raises at trace time, before any number is computed
gridax.combine(jnp.add, du, state.eta)

Program 1:The stagger check on one term of the u tendency: both operands sit at U, and adding a T-point field raises at trace time.

Packagegridax: gridax.CField, gridax.combine, the element-wise gridax.fields; CFieldAdapter, registered by import gridax; shipped in gridax#522, #531, #532 and #545 (23 Nov 2026)
ConstructorCField(data, dims, labels=None, stagger=(), *, loc=None); loc is a point name, T, U, V, X or W
Pytree leafdata only; dims, labels, stagger static, so new values never recompile. Under a bare jax.vmap the mapped dim comes back named "batch"
Dimsunique names; the grid axes are called x, y and z; labels only on dims that are not staggered
Staggerxgcm’s vocabulary (left, right, outer, inner; an axis left out is centred), stored sorted with no centred axis: () at T, (("x", "right"),) at U. The operators compute on centred and right axes; gridax.to_right moves MITgcm-style left faces
combine checkssame point (StaggerMismatchError), dims, sizes and labels; a plain array joins only if it has size 1 along every staggered axis and at least one grid axis; a full array is asserted with f.like(arr). ndarray * CField raises TypeError
Backendsany array-API array; NumPy and JAX tested; JAX is not imported by import gridax

5 · xr.DataArray: which value at which coordinate

The fourth carrier comes from outside the stack. A DataArray holds data with coordinate arrays, aligns two arrays by coordinate value, carries attrs and encoding, and can hold a lazy dask array chunked over a store far bigger than memory. It has arithmetic operators. It is not a pytree, so it never crosses jit.

lazy: chunked over a Zarr storet=0t = 0one chunk per dayread

coordinates carry valueslatitude [54.96 … 25.04]longitude [−69.96 … −30.04]time [2026-01-01 …]attrs: units, standard_nameencoding: _FillValue on disk only

alignment by value, and the adapter's exact join
lon 0.0000000lon 0.0000001xarray a + b:inner join, empty or NaNcombine(f, a, b):raises (join="exact")

A lazy DataArray: chunks on disk, coordinates, and an exact join that raises on a 1e-7 offset.

Packagexarray; reaches the dim functions through pipekit-array[xarray] (XarrayAdapter, registered lazily, DataArray only)
BackendsNumPy and dask (lazy; a KernelOp runs as one apply_ufunc, one task per chunk); other duck arrays eagerly
combine checksshared coordinates exactly equal: xr.align(join="exact"), so 1e-7 apart raises instead of inner-joining
NodataNaN in memory; _FillValue only as on-disk encoding
Positionsas xgcm axis attrs; xgcm, not gridax, computes on them
Many of themseveral on one grid form a Dataset; several grids a DataTree (carrier trees)

6 · The shared contract

The three stack carriers differ only in their metadata and in the one check their combine runs. Everything else is one contract, so a dim function written once works on all of them.

Table 6:The contract, rule by rule, for each carrier.

RuleDimArrayGeoArrayCFieldDataArray
holds the array, never subclasses it✓✓✓✓
the array is the traced leaf✓✓ (+ transform)✓not a pytree
named dims✓✓, ending (y, x)✓, the grid’s names✓
reached through the adapter registry✓✓✓✓, lazily
no arithmetic operators✓✓✓has them, on purpose
no alignment by value✓✓✓aligns; off in combine
combine checkssame dimssame grid, same fillsame staggerexact coordinates

6.1 combine: check, unwrap, compute, rewrap

Element-wise maths on carriers has one form. With carriers c1,…,cmc_1, \ldots, c_m holding arrays x1,…,xm\vect{x}_1, \ldots, \vect{x}_m and an element-wise function ff:

combine(f,c1,…,cm)=ι(f(x1,…,xm),c1)\op{combine}(f, c_1, \ldots, c_m) = \iota(f(\vect{x}_1, \ldots, \vect{x}_m), c_1)

defined only when the carriers pass their check, where ι\iota rewraps the result with c1c_1’s metadata. The check runs on static metadata, so under jit it costs nothing at run time: it either passes at trace time or the trace fails.

c1c_1: CField[U]

c2c_2: CField[U]

1 · check (trace time)dims · grid and fill · stagger · coords

fails: raise

2 · unwrap: x1=c1\vect{x}_1 = c_1.data, x2=c2\vect{x}_2 = c_2.data

3 · xout=f(x1,x2)\vect{x}_\text{out} = f(\vect{x}_1, \vect{x}_2) (jit)

4 · rewrap: CField[U] with c1c_1’s stagger

combine: carriers in, a check, unwrap to arrays, ff, rewrap.

6.2 Consuming a defining dim demotes the carrier

A carrier’s metadata describes its defining dims. When a reduction consumes them, the metadata has nothing left to describe, and the result drops to a DimArray. Each adapter’s rewrap makes the choice, so pipekit’s reduce follows it. A CField also drops when its values stop sitting on its point (gridax#567): pipekit’s diff along a grid axis, and coarsen along a staggered one.

GeoArrayη\eta frames (time, y, x)

mean over (y, x)

DimArray(time,): no pixels left

CField[V]{y: right, x: center}

mean over x

CField{y: right}: still in a cell

CField[T](time, y, x)

mean over time

CField[T]time is not a grid axis

CField[T](time, y, x)

mean over (y, x), wet only

DimArray(time,): no cell left

GeoPointsgauges (time, obs)

mean over time

GeoPoints(obs,): a value per site

GeoPointsgauges (time, obs)

mean over obs

DimArray(time,): no site left

Teal: still a carrier with geography or a stagger. Grey: demoted to DimArray.

7 · Boundaries: each question has one owner

Each carrier refuses the questions the others own. A request that crosses a boundary converts the carrier rather than growing the one in hand.

Table 7:Each question, the carrier or package that owns it, and what the others do.

QuestionOwnerThe others
dim names, selection by position, reductions, windowspipekit-array’s dim functionsreached through the adapter; never reimplemented
labels by value: groupby, resample, interpxr.DataArraycross with to_xarray(), come back with a from_xarray
files, CF encoding, data bigger than memoryxr.DataArray (and Dataset, DataTree)stack carriers hold in-memory slices
jit, grad, vmapthe three pytreesa DataArray passes .data or converts
CRS, transform, coordinates → pixelsgeoarray holds; geoops computes (geom, interp_at)DimArray and CField hold no CRS
nodatageoarray’s fill_valueCField uses gridax masks (wet = True = keep); DataArray uses NaN
stagger and C-grid stencilsgridaxGeoArray pixels are all cell-centred
grid metric: Δx\Delta x, cos⁡ϕ\cos\phi, areasgridax grids, passed to operatorsnever stored on a field
physical meaning, unitsthe model (sesmax State), geophysixno carrier; a units attr is documentation

Two rules keep the lines stable. A carrier’s metadata is only what its own combine check needs. And consuming a carrier’s defining dims demotes it to DimArray (6.2).

8 · Conversions: drop, assert, or lose

Every conversion does one of three things. It drops metadata, which is always safe. It asserts metadata, which the caller vouches for. Or it interpolates values to another position, which loses information and warns. A C-grid field reaches geography only through T points, so the lossy collocate sits on every path from U, V or X to a GeoArray.

xr.DataArray GLORYS zos, lazy GeoArray.from_xarray from_xarrayGeoArray 1/12°, 360 × 480DimArray labels onlyResampleLike(average) regrid, lossyto_dimarray: drop staggerGeoArray model T cells, 120 × 160agrid_from + CField assert, flip rows

A-grid CField[T]no CRS; spacing from A\mat{A}stagger collocateC-grid CField T, U, V, X; the model

from_cfield (open) or with_data on the sourceto_geoswath T only (today)GeoSwath lat, lon per cellinterp_at = Hx\mat{H}\vect{x}GeoPointsHx\mat{H}\vect{x} at nadir and SWOT

GeoArray η\eta frames(time, y, x)

Solid grey: drop or assert, exact. Dotted: interpolate, lossy (≈). Faint dotted: interp_at does not read a GeoSwath today.

Table 8:Every conversion between the carriers, what it does to the metadata, and whether it ships.

From → toCallKindStatus
GeoArray → DimArraygeoarray.to_dimarray(g); automatic when y, x are consumeddroptoday
CField → DimArraygridax.to_dimarray(f); automatic when no grid axis is leftdroptoday
DimArray → CFieldCField(d.data, d.dims, loc="U")asserttoday
GeoArray → A-grid CFieldgridax.agrid_from(g.grid), then CField(g.data, g.dims)assert; CRS stays on the GeoArraytoday
A-grid CField → GeoArrayg.with_data(f.data) on the sourceexact on the same gridtoday
C-grid U, V, X → A-grid Tgridax.collocate(f, cgrid, src=…)lossy: the 2Δx2\Delta x mode, warnstoday
A-grid T → C-grid U, Vgridax.stagger(f, agrid, dst=…, bc=…)exact for T, lossy for U, Vtoday
T CField → GeoSwathgeoarray.to_geoswath(f, grid), duck-typedassert; ghosts dropped; y x → row col; T onlytoday
GeoArray / GeoSwath → GeoPointsgeoops.geom.interp_at (GeoArray only today)interpolate: Hx\mat{H}\vect{x}today
any carrier → xarrayto_xarray(); a CField needs its grid, f.to_xarray(grid, name), and gives a Dataset with xgcm coordinates x_c, x_g, y_c, y_gdrop nothing xarray can holdtoday
DataArray → DimArraypipekit_array.xarray.from_xarray(da)drop non-index coords, attrstoday
DataArray → GeoArrayGeoArray.from_xarray(da)assert; raises past 10-9 pxtoday
DataArray → CFieldCField.from_xarray(da): an axis attr makes a grid axis, c_grid_axis_shift 0.5 / −0.5 a right / left faceassert; no grid, so coordinates are not checkedtoday

9 · The window through all four carriers

The background enters as a lazy DataArray, becomes a GeoArray to be regridded, a CField to be run, a GeoArray again to be read at the observations, and leaves as DimArray statistics. Each hop is a named call from section 8.

xr.DataArrayzos (time, latitude, longitude), lazyread

GeoArray(360, 480), 1/12° → (120, 160), 1/4°regrid

CField × 3 in a State(122, 162): η\eta at T, uu at U, vv at Vwrap, stagger

CField trajectory(240, 122, 162), one scanrun

GeoArray η\eta frames(240, 120, 160), ghosts trimmed, rows flippedunwrap

GeoPointsHx\mat{H}\vect{x}: nadir (obs,), gauges (time, obs)Hx\mat{H}\vect{x}

DimArrayinnovation RMS per hour (time,)

The background’s path: DataArray, GeoArray, CField, GeoArray, GeoPoints, DimArray.

In the sketch, r=y−Hx\vect{r} = \vect{y} - \mat{H}\vect{x} is the innovation, tot_o an observation’s hour and Ot\mathcal{O}_t the observations of hour tt. The nadir samples are moving points and read one frame each; the gauges are stations, so interp_at keeps their time dim and needs no frame=. The gauge series must be detided before it is compared with this model.

# Shapes: GLORYS 360 × 480; model N_row × N_col = 120 × 160 (+2 ghost); 240 frames;
#         N_n nadir samples; N_g tide gauges
# Units:  η m; u, v m s⁻¹; transform ° per pixel

# today (xarray)
# η_b(φ, λ) at the window start, read into memory
# → DataArray (360, 480), m
background_ssh = xr.open_zarr(glorys_store)["zos"].sel(time=window_start).load()

# today* (geoarray)
# transform from the coordinates, CRS from spatial_ref
# → GeoArray (360, 480), A = (1/12, 0, −70, 0, −1/12, 55)
background_geo = geoarray.GeoArray.from_xarray(background_ssh)

# today* (geoops)
# η̄ⱼᵢ = (1/9) ∑ η over the 3 × 3 GLORYS cells in T cell (j, i)
# (360, 480) → (120, 160) on model_t's grid, m
eta_t = geoops.geom.ResampleLike(like=model_t, resampling="average")(background_geo)

# today (gridax)
# flip rows to run north, wrap at T, add the ghost ring
# (120, 160) → CField (122, 162), T
eta_initial = gridax.embed(gridax.CField(eta_t.data[::-1], ("y", "x")), grid)

# today (sesmax-core)
# xₜ = M₀→ₜ(x₀; θ), one jax.lax.scan, saved hourly
# → State, leaves (240, 122, 162)
forecast = sesmax_core.train.rollout(model, x_initial, dt=45.0, n_steps=19_200, save_every=80)

# proposed (geoarray.from_cfield, open question)
# trim the ghosts, flip back to north-up, attach model_t's transform
# (240, 122, 162) → GeoArray (240, 120, 160)
eta_frames = geoarray.from_cfield(forecast.eta, grid)

# today (geoops)
# H x: η bilinearly at each obs position, in the frame of its hour tₒ
# GeoArray (240, 120, 160), GeoPoints (obs,) → GeoPoints (obs,), m
hx_nadir = geoops.geom.interp_at(eta_frames, nadir, frame=nadir_hour)

# today (geoops)
# (H xₜ)_g = ∑ₗ w_gl x_{t, V_gl}: one plan per gauge, the same for every frame
# GeoArray (240, 120, 160), GeoPoints (240, N_g) → GeoPoints (240, N_g), m
hx_gauges = geoops.geom.interp_at(eta_frames, gauges)

# user
# r = y − H x
# → (obs,), m
innovation = nadir.data - hx_nadir.data

# today* (pipekit-array)
# RMSₜ = √((1/|𝒪ₜ|) ∑_{o ∈ 𝒪ₜ} r_o²): no pixel, no cell, no obs left
# → DimArray (time,), m
rms = pipekit_array.DimArray(hourly_rms(innovation, nadir_hour), dims=("time",))

Program 2:The window through all four carriers, from the GLORYS store to the hourly innovation RMS.

10 · Which carrier to use

Pick by the question the next operation needs answered, and convert when the question changes. Ask in order; the first yes wins.

On disk, lazy, bigger than memory, or groupby and resample by value?

xr.DataArray

Needs to know where on Earth?reproject, matchup, Hx\mat{H}\vect{x}, write a COG

GeoArrayGeoSwath; GeoPoints for tracks and stations

Takes a stencil across grid cells?differences, fluxes, advection, a model RHS

CField+ the grid, to the operator

Neither: statistics, features, anything that has left the grid?

DimArray

Plain arrays stay valid everywhere: every carrier is optional.

11 · Numbers for the window

Table 9:Sizes in the window, carrier by carrier.

CarrierQuantityValueUnit
DataArrayGLORYS zos, one daily field, float32, 360 × 4800.69MB
GeoArrayGEBCO, 7 200 × 9 600 int16, read once138MB
GeoArrayits georeference: the transform48B
CFieldone field with ghosts, 122 × 16219 764values
CFieldthe spherical grid’s metric, if a field carried it0.32MB
CFieldΔx\Delta x at 55°N and 25°N15.9 · 25.2km
CFieldtrajectory of η\eta, 240 × 122 × 1624 743 360values
GeoPointsgauge plan: weights per site, built once4Ng4 N_\text{g}weights
GeoPointsnadir plan today: one frame and 4 cells per sample4Nn4 N_\text{n}weights
GeoPointsgauge series, 240 hours240Ng240 N_\text{g}values
DimArrayinnovation RMS, one per hour240values

12 · Shipped and open

Shipped. What the carriers design doc of 2026-11-21 decided is now on main, in gridax (#522, #531, #532, #545, refined in #567 and #569) and geoarray (#759):

Open:

Where several carriers travel together (a state, a window of ingredients), the next deep dive takes over: carrier trees.

13 · Why three packages, not one

One carrier in one package, with optional slots for a georeference and a stagger, would be simpler to explain. We keep three because each carrier’s package is the lowest one its users already depend on, and putting them together would force every user to install, and reason about, the other groups’ concepts.

13.1 The dependency graph forbids the merge

geotoolz-arrayGeoArray, GeoSwath, GeoPoints+ pyproj, affine; x64
×
gridaxCFieldNumPy-only base; no CRS
no import either way (both packages' rules)
pipekit-arrayDimArray, adapter registry
NumPy · JAX · dask

One merged carrier sits in one package, so that package needs pyproj for the EO side and staggers for the model side: gridax’s NumPy-only base install ends, or geotoolz learns about C-grids.

13.2 Three designs we considered

Table 10:The three designs, for and against.

DesignFor itAgainst it
One carrier, optional slots: Carrier(data, dims, labels, geo=None, stagger=None)One idea to learn. A lat–lon model field is georeferenced and staggered at once, and could say so. The bridge problems of section 8 vanish.One package must hold pyproj, x64 and staggers. The combine check becomes combinatorial (every pair of filled and empty slots). Two nodata models (fill and mask) in one class. Every user meets every slot.
Two carriers: DimArray + a located array with geography or staggerKeeps the floor separate. Still one class for “where”.Geography and stagger answer different questions with different checks; a located array that holds either is the one-carrier design with one slot fewer, and the same dependency problem.
Three carriers (chosen)One question and one check each. Each lives in the lowest package its users already install. Nodata stays one model per carrier. Shared behaviour is already shared, through pipekit’s adapter registry and the fallback to DimArray.Three names to learn. A seam between GeoArray and CField that costs code at every crossing.

13.3 The cost we accept, and how to keep it small

The price of three is the seam between geography and the grid. A model field on a regular lat–lon grid is both georeferenced and staggered, and today it crosses the seam by hand: rows flip, the ghost ring is trimmed, the x64 transform is dropped on the way in and rebuilt on the way out, and Hx\mat{H}\vect{x} waits on a helper that does not exist yet. Three changes keep that seam narrow without merging the classes:

  1. geoarray.from_cfield(f, grid) for regular grids, duck-typed so gridax never imports geoarray: the row flip and the half-pixel shift for U, V and X follow from the stagger.

  2. An optional, opaque georeference on CField: a CRS as WKT and the T transform as a static tuple, carried but never interpreted by gridax. No pyproj, no x64, and no recompiles, since a model’s grid is fixed. from_cfield becomes exact. (Open.)

  3. interp_at on a GeoSwath, for curvilinear and spherical C-grids that no affine transform can describe.