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.
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.
| Users | They ask | They hold | In the window |
|---|---|---|---|
| Remote-sensing and EO researchers | where on Earth is this pixel, and what does this sensor see there? | GeoArray, GeoSwath, GeoPoints | GLORYS, GEBCO, nadir tracks, the SWOT swath, tide gauges |
| Model and numerics developers | where in the cell is this value, and which stencil reads it? | CField | , , and the depth on the C-grid |
| ML and DA researchers | which axis is which, and what shape goes into the solver? | DimArray, plain arrays, the pytree | ensembles, innovation statistics, the DA vector |
| Analysts and data engineers | which value sits at which coordinate, on disk and lazily? | xr.DataArray, Dataset, DataTree | the GLORYS store, the window written to Zarr |
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 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: is the row (y), the column (x), the frame, the axis of an array.
Table 3:The symbols used on this page.
| Symbol | Meaning | Shape | Unit |
|---|---|---|---|
| the plain array a carrier holds | the field’s | ||
| dim names, one per axis | strings | — | |
| labels or coordinates per axis | per axis | per axis | |
| georeference: CRS, transform, fill, attrs | tuple | — | |
| affine transform | (6,), float64 | ° or m per pixel | |
| stagger: one position per grid axis | {y, x} → {center, right} | — | |
| sea-surface height, eastward and northward velocity | (y, x) | m, m s⁻¹ | |
| observation operator: 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 ↓named arraywhere on Earth?
70°W, 55°N 30°W, 25°Ncarrieranswers 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.
A DimArray: a 3-D block with named axes and labels on the field axis.
| Package | pipekit-array; the reference adapter, DimArrayAdapter |
| Backends | NumPy, JAX, dask |
| Recompiles when | dims or labels change |
| In the window | the innovation statistics per hour, a basin-mean time series, any ensemble summary that has left the grid |
| Refuses | CRS, 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 : 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 , row has its centre at
where is the transform in GDAL/affine order, the longitude and the latitude, in degrees (or x and y in a projected CRS, in metres). For the model’s T cells, , , , and , so pixel (0, 0) is centred at 69.875°W, 54.875°N and rows run south.
121
corner east per column per row: rows run south
transform , 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
moving 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.
| Package | geotoolz-array, import geoarray; adapters GeoArrayAdapter, GeoSwathAdapter, GeoPointsAdapter |
| Pytree leaves | data and transform (float64, (*batch, 6); x64 required) |
| Static | crs, fill_value, attrs, dims, coords |
| Dims | any, ending in (y, x); leading dims may index transform rows |
| combine checks | same grid (GridMismatchError) and same fill |
| Nodata | fill_value is nodata; a pixel is invalid when any band is non-finite or equals the fill |
| Refuses | a 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 points | Stations | |
|---|---|---|
| Data | (obs,), or (variable, obs) | (time, obs) |
| Positions | xy (obs, 2): one per sample | xy (obs, 2): one per site, for every time |
| Time | leaf time (obs,) | a time dim with a TimeAxis |
interp_at(frames, pts, frame=hour): each sample reads its own frame | interp_at(frames, gauges): time stays a leading dim | |
| Mean over time | not defined: no time axis | still GeoPoints: one value per site |
| Mean over obs | DimArray | DimArray (time,) |
| combine checks | same xy, time, z, valid | same sites, same time axis |
| Gaps | none to fill: a missing sample is absent | a gauge down for a day: NaN or valid=False along time |
The difference that matters most is the plan. Write for the bilinear weight of sample on its -th neighbouring cell , and 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:
where is frame of , shape (y, x) in m, the weights are dimensionless, and 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:
where now holds every frame, shape (time, y, x) in m, runs over four cells in each of two frames, and is the frame of tap .
stations: plan once, gather every frame
setup, once(site, 4) weights
240 frames
vmap(gather)→ (time, obs)
the plan is a ③ model shared by and its adjoint; one per gauge network
moving points: a plan per sample, in space and time
frame
frame
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, sits at cell centres, on east faces and 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 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.
| Point | Position of value | stagger as stored | In the window |
|---|---|---|---|
| T | () | , depth | |
| U | (("x", "right"),) | ||
| V | (("y", "right"),) | ||
| X | (("x", "right"), ("y", "right")) | relative vorticity |
T, depth U, V, Xvorticity, cell : north is up, 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: at T and at V rows, each field-sized, plus the 1-D latitudes and longitudes and the scalars , and (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 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.
| Package | gridax: 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) |
| Constructor | CField(data, dims, labels=None, stagger=(), *, loc=None); loc is a point name, T, U, V, X or W |
| Pytree leaf | data only; dims, labels, stagger static, so new values never recompile. Under a bare jax.vmap the mapped dim comes back named "batch" |
| Dims | unique names; the grid axes are called x, y and z; labels only on dims that are not staggered |
| Stagger | xgcm’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 checks | same 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 |
| Backends | any 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 storeone 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
A lazy DataArray: chunks on disk, coordinates, and an exact join that raises on a 1e-7 offset.
| Package | xarray; reaches the dim functions through pipekit-array[xarray] (XarrayAdapter, registered lazily, DataArray only) |
| Backends | NumPy and dask (lazy; a KernelOp runs as one apply_ufunc, one task per chunk); other duck arrays eagerly |
| combine checks | shared coordinates exactly equal: xr.align(join="exact"), so 1e-7 apart raises instead of inner-joining |
| Nodata | NaN in memory; _FillValue only as on-disk encoding |
| Positions | as xgcm axis attrs; xgcm, not gridax, computes on them |
| Many of them | several 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.
| Rule | DimArray | GeoArray | CField | DataArray |
|---|---|---|---|---|
| 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 checks | same dims | same grid, same fill | same stagger | exact coordinates |
6.1 combine: check, unwrap, compute, rewrap¶
Element-wise maths on carriers has one form. With carriers holding arrays and an element-wise function :
defined only when the carriers pass their check, where rewraps the result with ’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.
: CField[U]
: CField[U]
1 · check (trace time)dims · grid and fill · stagger · coords
fails: raise
2 · unwrap: .data, .data
3 · (jit)
4 · rewrap: CField[U] with ’s stagger
combine: carriers in, a check, unwrap to arrays, , 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 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.
| Question | Owner | The others |
|---|---|---|
| dim names, selection by position, reductions, windows | pipekit-array’s dim functions | reached through the adapter; never reimplemented |
labels by value: groupby, resample, interp | xr.DataArray | cross with to_xarray(), come back with a from_xarray |
| files, CF encoding, data bigger than memory | xr.DataArray (and Dataset, DataTree) | stack carriers hold in-memory slices |
jit, grad, vmap | the three pytrees | a DataArray passes .data or converts |
| CRS, transform, coordinates → pixels | geoarray holds; geoops computes (geom, interp_at) | DimArray and CField hold no CRS |
| nodata | geoarray’s fill_value | CField uses gridax masks (wet = True = keep); DataArray uses NaN |
| stagger and C-grid stencils | gridax | GeoArray pixels are all cell-centred |
| grid metric: , , areas | gridax grids, passed to operators | never stored on a field |
| physical meaning, units | the model (sesmax State), geophysix | no 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 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 = GeoPoints at nadir and SWOT
GeoArray 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 → to | Call | Kind | Status |
|---|---|---|---|
GeoArray → DimArray | geoarray.to_dimarray(g); automatic when y, x are consumed | drop | today |
CField → DimArray | gridax.to_dimarray(f); automatic when no grid axis is left | drop | today |
DimArray → CField | CField(d.data, d.dims, loc="U") | assert | today |
GeoArray → A-grid CField | gridax.agrid_from(g.grid), then CField(g.data, g.dims) | assert; CRS stays on the GeoArray | today |
A-grid CField → GeoArray | g.with_data(f.data) on the source | exact on the same grid | today |
| C-grid U, V, X → A-grid T | gridax.collocate(f, cgrid, src=…) | lossy: the mode, warns | today |
| A-grid T → C-grid U, V | gridax.stagger(f, agrid, dst=…, bc=…) | exact for T, lossy for U, V | today |
T CField → GeoSwath | geoarray.to_geoswath(f, grid), duck-typed | assert; ghosts dropped; y x → row col; T only | today |
GeoArray / GeoSwath → GeoPoints | geoops.geom.interp_at (GeoArray only today) | interpolate: | today |
| any carrier → xarray | to_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_g | drop nothing xarray can hold | today |
DataArray → DimArray | pipekit_array.xarray.from_xarray(da) | drop non-index coords, attrs | today |
DataArray → GeoArray | GeoArray.from_xarray(da) | assert; raises past 10-9 px | today |
DataArray → CField | CField.from_xarray(da): an axis attr makes a grid axis, c_grid_axis_shift 0.5 / −0.5 a right / left face | assert; no grid, so coordinates are not checked | today |
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): at T, at U, at Vwrap, stagger
CField trajectory(240, 122, 162), one scanrun
GeoArray frames(240, 120, 160), ghosts trimmed, rows flippedunwrap
GeoPoints: nadir (obs,), gauges (time, obs)
DimArrayinnovation RMS per hour (time,)
The background’s path: DataArray, GeoArray, CField, GeoArray, GeoPoints, DimArray.
In the sketch, is the innovation, an observation’s hour and the observations of hour . 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, , 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.
| Carrier | Quantity | Value | Unit |
|---|---|---|---|
DataArray | GLORYS zos, one daily field, float32, 360 × 480 | 0.69 | MB |
GeoArray | GEBCO, 7 200 × 9 600 int16, read once | 138 | MB |
GeoArray | its georeference: the transform | 48 | B |
CField | one field with ghosts, 122 × 162 | 19 764 | values |
CField | the spherical grid’s metric, if a field carried it | 0.32 | MB |
CField | at 55°N and 25°N | 15.9 · 25.2 | km |
CField | trajectory of , 240 × 122 × 162 | 4 743 360 | values |
GeoPoints | gauge plan: weights per site, built once | weights | |
GeoPoints | nadir plan today: one frame and 4 cells per sample | weights | |
GeoPoints | gauge series, 240 hours | values | |
DimArray | innovation RMS, one per hour | 240 | values |
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):
gridax.CField,combineandStaggerMismatchError; the canonical functions takeCFields through@located, with the array path underneath (tests/test_located.pyholds them equal).geoarray.to_geoswath(f, grid), duck-typed on both sides, for a field at T on a lat–lon grid: ghosts dropped,y xrenamedrow col, latitudes and longitudes from the grid.A-grids from geo grids:
CartesianAGrid2D.from_affineandSphericalAGrid2D.from_affine, andgridax.agrid_from(obj)on top, duck-typed on.transform,.shapeand.crs.is_geographic;staggerandcollocatebetween collocated and C-grids.to_dimarray,to_right,CField.to_xarray(grid, name)andCField.from_xarray(da).A
CFieldbecomes aDimArraywhen no grid axis is left, or whendifforcoarsenmoves its values off its point.
Open:
on the model grid.
to_geoswathships, butinterp_atstill reads a regularGeoArrayonly. On a regular lat–lon model grid,geoarray.from_cfield(f, grid)(trim, flip, transform) would give aGeoArraythatinterp_atreads today; the sketch in section 9 uses it. Recommended: addfrom_cfieldfor regular grids, or a Tier-Ainterp_atthat takes an array and a transform, and teachinterp_atto read aGeoSwathfor curvilinear ones.Checking coordinates on the way in.
CField.from_xarray(da)takes no grid, so it reads positions from the xgcm attributes but cannot check that the coordinates match the model grid. A check with the grid (raise on a mismatch, never regrid) is still worth adding.
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¶
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.
| Design | For it | Against 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 stagger | Keeps 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 waits on a helper that does not exist yet. Three changes keep that seam narrow without merging the classes:
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.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_cfieldbecomes exact. (Open.)interp_aton aGeoSwath, for curvilinear and spherical C-grids that no affine transform can describe.
Sources and status
From the artifact “Carrier arrays: DimArray, GeoArray, CField and DataArray” (updated 1 December 2026), which explains the design doc “Carriers: DimArray, CField, GeoArray and xarray’s DataArray” (2026-11-21). Its facts cite gridax#522, #531, #532 and #545 (23 Nov 2026), refined in gridax#567 and #569, and geoarray #759. The artifact read its names in geotoolz at 543ad57 (the GeoArray contract, to_geoswath, interp_at), gridax at 92415e7 (_src/fields/: cfield.py, combine.py, located.py, convert.py, adapter.py; the spherical grids) and GeoStack’s docs/design/kinds_and_roles.md at 619f10f; they were not checked again against the pins for this page. today and proposed follow the design doc’s markers. The window is the one on the ocean ladder example; its numbers are illustrative but consistent with the roles and carrier trees pages. Distances use the IUGG mean radius, 6 371 km. The page has no notebook behind it.