This is the multi-page printable view of this section.
Developer documentation
- 1: Architecture
- 2: Why the format looks like this
- 3: Encoder pipeline (`xuebuild/`)
- 4: Sources
- 5: Point products
- 6: Frontend
- 7: Building a site on Xue
- 8: Delivery: stores, catalog, API, uploads
- 9: Publishing
- 10: The data API on a self-hosted origin
- 11: Releasing
- 12: Setup and local builds
- 13: Testing
How Xue is built, tested, published and released. For using the data, start at the README; for contribution rules, at CONTRIBUTING.md. Also published at https://xue.ringsaturn.me/docs/dev/.
| File | What it covers |
|---|---|
| architecture.md | The three implementations, the delivery contract, container and metadata versions |
| architecture-rationale.md | Why the format looks like this: the size comparison, container vs store |
| pipeline.md | The Python encoder (xuebuild/): registries, conversion, assembly |
| sources.md | Engineering notes per source: fetch stages, grids, quirks |
| delivery.md | Zarr stores, the STAC catalog, the data API, R2 uploads |
| api-origin.md | The data API on a self-hosted origin behind a Cloudflare Tunnel |
| frontend.md | The shell (web/src/): sessions, layers, rail, probe, compare page |
| building-on-xue.md | A site of your own on the shell: pinning, the Vite config, build-time variables, the data root, the overlay module |
| point-products.md | Tropical cyclones, airports, soundings and the station marks |
| setup.md | Requirements and building a run locally |
| testing.md | Test commands, what each suite holds, CI |
| publishing.md | Uploading runs, rolling windows, point products, STAC, showcase |
| releasing.md | Crate and wheel releases, the xuepy floor, deploy order |
Normative specifications (docs/README.md lists them all,
with the versions in use and the compatibility rules), which win over
anything here:
docs/zarr-profile.md: the Zarr store profiledocs/bundle.md: bundle metadata and codebooksdocs/format.md: the legacy.xuecontainerdocs/encoder.md: the native encoder and its parity ruledocs/stac.md: the STAC catalogdocs/satellite.md: the satellite fetch stage and producersdocs/api.md: the data API contract (its origin: api-origin.md)docs/river.md: river flow in a showcase casedocs/tc.md,docs/airport.md,docs/sounding.md: the point products
Rules for coding agents are in AGENTS.md and
.claude/rules/; agent skills are in .agents/skills/.
1 - Architecture
Xue packs weather runs and observation windows into per-variable Zarr v3
stores and plays them back in a static browser page. The layout began as a
single-file container, .xue: no longer published or written unless a
build asks for it (--xue, container=True), and read by every decoder
forever, since published runs and cases carry it and are never rebuilt.
Both encoders write each store straight from the codes they quantized.
Normative specs, which win over this page: zarr-profile.md, bundle.md, format.md, encoder.md, stac.md. Why the format looks like this: architecture-rationale.md.
Map
xuebuild/— Python pipeline and reference encoder (pipeline.md).sources.py/variables.pyregistries;feeds.pyper-family fetchers overfetch.py+idx.py+grib2.pyrange fetches;binconvert.pythe conversion, in stages overdiscover.py,grid.py,derive.py,ladder.py,metadata.py,poster.pyandreport.py(each beside itsencode/*.rs);quantize.py,temporal.py,binformat.pycodebooks, residuals, container I/O;observation.pyNetCDF ingest;model.pyshared shapes (SourceFrame,PlaneSource);manifest.pymanifest + pointer;zarrstore.pystore export (delivery.md);encoder.py/native.pyencoder dispatch;assemble.pysplit builds;stac.pycatalog;showcase.pycases;satellite/(sources.md);tc/,airport/,sounding/(point-products.md);gdal.py,eccodescli.py,om2nccli.py,jmacli.pytool wrappers;zstdcli.pyin-process zstd.rust/xue/— decoder (src/decode/), byte layout (src/format.rs), Zarr read geometry (src/zarr.rs), native encoder (src/encode/,encoderfeature).rust/xue-wasm/— wasm bindings, built intoweb/src/wasm/(generated).rust/xue-py/— thexuepywheel, imported asxue: native encoder, decoder,gdal_info.rust/xue-worker/— read-only data API (delivery.md).web/src/— frontend (frontend.md).tests/— Python tests, fixtures andprepare_*.pygenerators;tests/web/vitest,tests/e2e/Playwright (testing.md).
Three implementations, one format
Encoder, Rust decoder and TypeScript frontend must stay in agreement.
The order of change and the parity rule (the Python encoder is the
reference; the native encoder, rust/xue/src/encode/, linking GDAL,
grib-rs and zstd, writes identical bytes) are in
.claude/rules/cross-implementation.md
and encoder.md.
xuebuild/encoder.pyconverts through the wheel by default;XUE_ENCODER(auto|native|python) overrides, and which workflows pin it is inencoder.md.- The native encoder writes the stores itself (
encode/zarrstore.rs, held tozarrstore.write_store) but no pointer.native.pystamps the shared stores’ CRCs into the manifest and only then writes the pointer, whose CRC32 covers the finished manifest. - The
encoderfeature is off by default because it links GDAL and the decoder must not. Profiles inrust/Cargo.toml(Cargo reads them only from the workspace root):releaseis tuned for the wasm decoder,encoderinherits it atopt-level = 3.
Delivery contract
- The live pointer (
latest.jsonfor GFS,latest-<model>.jsonotherwise; schema v1) is the only mutable object per source. Uploading it takes a run live. - Everything it names,
manifest.json(schema v5) and every artifact under<model>.<run>/, is immutable and addressed with?v=<crc32>. The optionalcolumnsentry (the column store, the Zarr profile’s fourth branch) is cut by thecolumnsjob before finalize and named in the one manifest finalize writes (a run already live without it gets it by a second manifest and pointer write); a run without it reads exactly as before. - Manifest paths resolve relative to the manifest URL, so a run can be
served from the site or the bucket (
VITE_DATA_BASE_URL,web/.env.deploy). Production hostnames reach the frontend only throughweb/src/site/site.ts. - Shell first: a new shell accepts old manifests, an old cached shell
rejects new ones. When, and what counts, is in
releasing.md. - The bundle set is not schema. The three validators
(
xuebuild/manifest.py,rust/xue/src/encode/manifest.rs,web/src/data/manifest.ts) admit avariableby shape alone (^[a-z][a-z0-9]*$, unique). The only closed set is the source’s core (SourceSpec.core_bundle_ids, mirrored asMODEL_CORE_BUNDLESandcoreBundles), required on a live run. The shell draws an unknown bundle generically. numericId/variableIdis file-local: variables are numbered 1..n in bundle order (vector: 1 = u, 2 = v). Identity is the GRIB2parameterblock (plusaerosolwhere species share a triple,ensemblewhere a statistic of an ensemble shares its field’s), read byweb/src/data/identity.ts; the id string is only a naming convention. Never key across sessions bynumericId(web/src/data/sessionkeys.tsscopes keys per session).
Container versions
FixedHeader.version (format.md §“Container v2”):
- v1 plane-major: a payload is one plane of one frame (
IDX1+PlaneEntry). - v2 tiled: a payload is one tile × one temporal group × one variable
(
IDX2+ variable, group and chunk tables). Order group → tile → variable makes a group, a viewport’s tile row, and a cell’s series (one chunk per group) cheap range reads.
Tiling changes storage only, not metadata, codebooks or residual arithmetic. Encoders write v2; decoders must keep reading v1.
Bundle metadata schema versions
schemaVersion in the bundle metadata JSON is the lowest version a reader
must implement (separate from manifest v5 and pointer v1). v1/v2 are legacy
whole-hour axes; v3, written now, adds the parameter block and a
unit-neutral axis (unitSeconds + firstFrameOffset + frameStep |
frameOffsets).
unitSecondsmust be the coarsest unit that fits (3600 for forecasts, an observation’scadence_secondsotherwise). Decoders reject unimplemented and overdeclared versions, so each file has exactly one valid encoding.- Optional v3 blocks
band,producer,aerosol,ensembleare validated by all readers when present, raise no floor and are ignored by older readers, so adding such a block is one-sided. - A plane is keyed by frame offset, never forecast hour
(
PlaneEntry.frame_offset, the worker’sframeOffset,SourceFrame.lead_seconds). - Must agree:
metadata.py::build_metadata,binformat.py::_parse_metadata,rust/xue/src/decode/metadata.rs,web/src/data/manifest.ts::parseBundleMetadata.
Decoder
rust/xue/src/decode/: Bundle (whole file) and StreamingBundle
(structural prefix, payloads fed in as ranges arrive) in bundle.rs, over
metadata.rs → structure.rs → core.rs (residual replay; its
decode_chunk is also the Zarr decode path in browser and Worker). All
arithmetic on file values is checked; nothing is allocated from a file value
before validation.
rust/xue/src/format.rs holds the byte layout and nothing else. The decoder
unpacks and the native encoder packs through it, so fields cannot drift.
External tools
GDAL, zstd, eccodes and om2nc run as subprocesses; NumPy is the only Python runtime dependency. Exceptions and boundaries:
- zstd runs in process (
compression.zstd); there is no CLI path. Its bytes match the native encoder’s only for the same libzstd version. gdal.dataset_inforeads through the wheel’s GDAL (xue.gdal_info) when converting natively, the subprocess otherwise, followingXUE_ENCODER, so a run never mixes two GDALs and the scheduled workflows need no GDAL (tests/test_gdalinfo.pydiffs the two).gdal_translatehas no in-wheel path:XUE_ENCODER=pythonneeds a system GDAL.- om2nc (
XUE_OM2NC) is GPL-2.0-only: an executable on the PATH only; no om dependency may enterpyproject.toml,Cargo.tomlorweb/.
Errors the user must fix subclass XueError (xuebuild/errors.py); the CLI
prints error: … and exits 2. Any other exception is a bug.
2 - Why the format looks like this
The access pattern is continuous playback of a complete global forecast with free timeline scrubbing. A map tile pyramid stores every frame as its own set of precoloured images. For one GFS run, the same two variables:
| Delivery | Size |
|---|---|
| Per-frame raster tiles (PMTiles, zoom 0–4, precoloured) | 3,205.87 MB |
| Source GRIB2 | 137.73 MB |
Xue (tmp2m.xue ≈ 29 MB + prate.xue ≈ 36 MB) | ≈ 65 MB |
scripts/pmtiles_size_assessment/
rebuilds the tile baseline frame by frame and reports the totals.
A bundle stores each variable as quantized single-byte planes on the native forecast grid (no reprojection, no baked-in colours), with bounded temporal prediction (six-frame groups for smooth fields, independent frames for precipitation) and one Zstandard frame per chunk. Every frame is individually addressable, so the page paints a first-frame poster, then range-requests only the index and the chunks its viewport and playhead need, prefetching into a byte-budgeted cache. Adjacent frames blend on the GPU.
Container and store
The Zarr store (docs/zarr-profile.md) carries the
same codes in a layout any Zarr client reads: a container v2 bundle is, to
within its index format, a sharded Zarr uint8 array. Since 2026-09-15
every live run, round and case is published as stores alone (what
build-bin writes by default). The .xue container
(docs/format.md) remains:
- an opt-in output both encoders can still write beside the store, from the same codes, so the two carry identical codes by construction;
- the format every decoder keeps reading, for runs and cases published
before the switch and for builds asked for it (
--xue); - the format the golden fixtures and the size comparison above are stated in.
The delta chain swaps in the xue.delta codec (the container’s temporal
residual as a codec, xuebuild/zarrcodec.py for zarr-python), under which
a chunk’s compressed bytes equal the bundle’s wherever the two chunkings
coincide; the series store always takes it.
Four implementations
- Python encoder (
xuebuild/), the reference: a format change lands here first. GDAL and eccodes are CLI subprocesses. - Native encoder (
rust/xue/src/encode/, shipped in thexuepywheel): the same conversion with GDAL, grib-rs and zstd linked in, held to the reference by byte-identical output (docs/encoder.md). - Rust decoder (
rust/xue,rust/xue-wasm), built into the frontend. - TypeScript frontend (
web/src/): manifest resolution and tier choice, a decode worker with windowed prefetch, WebGL2 blend playback and wind particles.
3 - Encoder pipeline (`xuebuild/`)
The reference encoder (architecture.md): fetch exact
records → GDAL extract → crop, convert units → quantize → Zarr store
(zstd per inner chunk) → manifest → pointer. The .xue (temporal residuals
→ zstd → container) is written beside the store only when asked for, from
the same codes. Per-source
behaviour is in sources.md.
Registries
sources.py (SourceSpec) — one row per source: data location, time
axis as (last_hour, step) segments ending at horizon_hours (the
--hours default), cycle_hours, inputs, published bundles, grid, ladder,
fetch concurrency. Adding a model starts here; the native encoder reads
rust/xue/registry.json, and the shell’s mirror is FORECAST_MODELS in
web/src/data/manifest.ts.
variables.py — one entry per variable in GRIB2 terms (triple, surface,
label, unit) plus matching hints (.idx phrase, ECMWF param,
ecmwf_alternate_params for fields spelled differently along the axis) and
every rule the encoders apply to it, named out of the closed sets of
rules.py (docs/registry.md): conversion (the unit
rule: which spellings a record may carry and the arithmetic to the
published unit), gdal_rules (how its record is told apart among a GRIB’s
bands; derived from the identity by default_gdal_rules unless set),
predictor (delta / raw), decimation (sample / peak) and
companions (poster; video names the retired H.264 companion, which
no encoder builds). Nothing in the encoders selects behaviour
by a variable’s id: a new quantity sets the fields that differ from the
defaults and the rest follows. It feeds both record matching and the v3
parameter block; it assigns no container id.
- Another centre’s record matches a variable through
grib2_aliases(another triple, same surface) orgrib2_alternates(aRecordAlternate: surface, value, statistical process, GDAL unit). Both encoders match by GRIB2 header index and by GDAL band metadata (gdal_rules, evaluated ingdal.pyandinspect.rs); aliases are never written. - An ensemble product (templates 4.2/4.12 derived, 4.6/4.10 percentile,
4.5/4.9 probability) is accepted by a
template-ensemblerule alone, which compares the record’s statistic with the rule’sensembleblock; every other rule refuses those templates, so a deterministic source never picks up an ensemble record by its triple. A statistic of its own (a quartile, a spread, a probability) is a variable carrying anensembleblock (grib2_ensemble); a shared id read as an ensemble’s centre (tmp2mas the median) gets the block from the source (SourceSpec.ensembles,metadata.py), so GFS’stmp2mstays without one. GDAL converts nothing in a derived record that is not a mean and writes a label ([spread], …) in place of the unit (gdal.DERIVED_UNIT_LABELS, mirrored ininspect.rs): its values are in the parameter’s GRIB unit, read as the variable’sgdal_unit. - Input-only entries are read, never published: ECMWF
tp, sfluxprate_aveand the totals read asapcp(intoprate),dirpw,spfh<level>, and GFS’scrain/cfrzr/cicep/csnow(intoptype,derive.derive_ptype). - A source’s precipitation input becomes
prateone of four ways, by the flag it sets (derive.precipitation_mode, mirrored inconvert.rs): a run total differenced (accumulated_precipitation), a window’s mean de-averaged (averaged_precipitation), an interval’s total divided by its length (interval_precipitation), or a window’s total differenced within the window (windowed_precipitation, WOOF-NAM’s twelve hours). The two window shapes share a frame’s raw plane with its successor only inside one window. A run total is first put on one packing lattice (derive.align_packing_steps): a GRIB encoder at a fixed bit count doubles its step once the field’s range crosses a power of two (ECMWFtppast 0.5 m), and differencing across that frame would otherwise paint one fine step of rounding over every dry cell. - Isobaric families come from one table of twenty-one levels (
catuses only 300/250/200,isobaric_family_levels);isobaric_variable(id)returns(family, level).
bundles.py (BundleSpec) — every bundle that is more than the scalar
of the variable of the same id: a vector’s two members, a composite’s
members and producer, a volume’s levels, and a derivation (kind, inputs,
level_hpa) for the bundles the converter computes. The converter resolves
a bundle’s inputs and algorithm off the entry; the per-kind views
(VECTOR_BUNDLES, DERIVED_VECTORS, COMPOSITE_BUNDLES, VOLUME_BUNDLES,
DERIVED_SCALARS) are for readers that walk one kind.
registry.py — serialises the four tables as the registry document
(xue registry), the one description the native encoder reads; the
committed snapshot rust/xue/registry.json is held to the tables by
tests/test_registry.py.
Registration is not publication
SourceSpec.bundle_scalar_ids / bundle_vector_ids list what a source
ships, and a listed bundle ships only when its inputs were fetched:
- vectors (
wind10m,wind<level>, …): every input inbundles.vector_input_ids; - derived scalars (a
BundleSpecwith aderivation:theta-e, Bolton 1980 in a fixed operation order the native side must repeat;clear-air-turbulence, Ellrod TI1 projected onto EDR with the source’scat_calibration, the one derivation that reads neighbours, so_extract_planeshands it the uncropped planes and the crop is cut afterwards;precipitation-type) and derived vectors (vapour-flux:qflux= q·V/g;wave-vector:wave,windwave,swell= a height along its direction of travel in wind convention,(-h sin θ, -h cos θ)). Thepratebundle’sprecipitation-ratederivation takes whichever of its inputs the source lists, by the source’s precipitation flags (derive.precipitation_mode).
sources.COLUMN_STORE_SOURCES names the sources that ship a column store;
for each, sources.py sets SourceSpec.column_arrays (default (), a
fetch-only field: not in the registry document) with
columnarrays.column_arrays, as ColumnArraySpec(id, members), members being
(bundle id, variable id) pairs taken from the published bundle ids by
registry identity; levels come from each variable’s fixed surface. The store is cut by
build-columns from the codes already published, not from the GRIB, so
enabling a source changes no map bundle (publishing:
Column store).
Overlapping sources publish in GFS order so a model switch keeps the layer.
A variable empty at the analysis (optional_at_analysis) is listed by
discover.analysis_optional_ids (mirrored in convert.rs) and starts at
the first step. A variable a source writes only from some hour on
(SourceSpec.variable_first_hours: CMA-GEPS’s 24-hour probabilities, from
F024) is listed there too and starts at that hour: earlier frames are
neither asked for it (fetch.py, assemble.py) nor read, and a build
whose hours end before it leaves the bundle out with a warning. A variable
a source writes only every so many hours (SourceSpec.variable_step_hours:
ECMWF’s 24-hour probabilities, every 12 h from F024 on a 3/6-hourly run) is
asked of and required at the frames on that cadence alone
(SourceSpec.carries_input), never keys the run’s axis
(discover.cadenced_input), and its bundles take a time_<id> axis thinned
to those hours (discover.store_dimensions, binconvert._variable_offsets).
SourceSpec.interval_precipitation_pairs derives further rates from
totals exactly as interval_precipitation derives prate from apcp
(the precipitation quartiles).
Companion files and fill values
SourceSpec.companion_files: a second file family of the cycle (GFSgfswave.*, ECMWFwaveand the ensemble productsep, one object for the whole cycle). Its records are appended after the primary ones, so a frame stays one GRIB, and a run is complete only when they are up. A family is fetched in the packing it is published in: WAVEWATCH III is JPEG 2000, which the wheel’s GDAL reads through the OpenJPEGscripts/build-gdal-minimal.shlinks.VariableSpec.fill_values: GDAL nodata becomes the codebook bottom before unit conversion, in both encoders. The format has no bitmap.
Registry snapshots
rust/xue/registry.json is the whole registry document and
web/src/data/registry.ts the shell’s trimmed copy, both held to the tables by
tests/test_registry.py (regenerate with xue registry --output rust/xue/registry.json --shell web/src/data/registry.ts and say so in the
commit). Widening a source’s inputs means recutting its crop fixture
(gfs.*.crop.grib2 with the same run and -srcwin; the two-frame
ecmwf.* / aifs.* pairs) and regenerating the snapshots
(testing.md).
Modules
fetch.py→idx.py/grib2.py: byte-range fetches of exact GRIB records, one.idx+ range set per family. Which code fetches a source is itsSourceSpec.feed, looked up infeeds.py(sources.md, “Feeds”). A source whosepackingisccsds(ECMWF open data, ICON-EU, ARPEGE) orjpeg2000(CMA GRAPES GEPS) is repacked togrid_simplewithgrib_setat fetch time.The conversion, one Python module per module of
rust/xue/src/encode/, each mirrored by its namesake there:binconvert.py(convert.rs):convert_binas a run of named stages, plane extraction, units and fill, quantization, the container and the store writes;discover.py(discover.rs): which bundles a source publishes and their inputs, the frames of a run and the records each must carry (discover_series,discover_records), the store dimensions;grid.py(grid.rs):GridInfo,grid_info, the snaps,crop_grid;derive.py(derive.rs): the derived vectors and scalars and the precipitation-rate arithmetic;ladder.py(ladder.rs),metadata.py(metadata.rs),poster.py(poster.rs),report.py(report.rs): the resolution ladder, the bundle metadata, the first-frame poster, the build report and the manifest.
Rules mirrored in
rust/xue/src/encode/:- a global grid snaps to
360 / width(WAVEWATCH III’s last longitude is off, and wave bundles must share the pgrb2 grid;grid.rs); - ladder
SourceSpec.variant_factors((2,)default,(2, 4)on satellites and the 0.1° IFS grids): every f-th row and column of the codes, tile divided by f (ladder.py:variant_tier,variant_grid,bundle_tile);variantsare in ascending factor order and nothing keys on the suffix; - the chunk predictor and the ladder’s decimation are the variable’s
predictoranddecimation.
gdal.py(mirrored byinspect.rs):gdalinfoin,SourceFrames out. A band is a variable’s record when any of itsgdal_rulesaccepts it (one evaluator per rule name); the unit is checked by the variable’sconversion(rules.expression, the arithmetic alone, which the header index and the gdalinfo pass compare for identity).quantize.py/temporal.py/binformat.py: codebooks, modulo-256 residual prediction, the container writer and the bundle metadata validator (BundleMetadata, which the store writers and readers apply too). Nothing inxuebuilddecodes a container: a build that writes one reads it back through the wheel’sxue.Bundleand decodes every plane before reporting it.manifest.py: manifest and pointer, both validated on write.observation.py(mirrored byobservation.rs): NetCDF series into the sameSourceFramelist the GRIB path yields, plus aPlaneSource.showcase.py: cases → cropped bundles →showcase.json(showcase/README.md).title/summarycarry all thirteen locales (showcase.LOCALES, held toweb/src/ui/i18n/i18n.tsbytests/fixtures/locales.json). A case is a forecast (run+hours), a local-file observation (dataset, underXUE_OBSERVATION_ROOT) or a fetched window (run= first hour); a window the archive cannot fill is refused.showcase refreshrewrites a sidecar without a rebuild. A fetched case is built bylocalrun.build_local_runplus a catalog row.zarrstore.py: the store writers and NumPy readers. A run’s map stores are shared (zarr-profile.md, profile 2):convert_binwrites each bundle’s arrays and the coordinates its dimension names call for intobundles[.<tier>].zarr(write_bundle_arrays, concurrently), then the part over the build’s bundles (write_part,zarr.part.<first bundle>.json) and, unlesspartial, the group document from it (finalize_store), whose CRC-32 every entry naming the store carries. The dimension names arediscover.store_dimensions, a function of the source registry alone (time_<bundle id>for an analysis-optional scalar, including one with a first hour, or a static field,latitude_<family>/longitude_<family>off the primary grid), so a subset build writes the objects a whole build does. Series stores stay one-bundle (profile 1,write_store); the readers open both profiles, a shared one by bundle id (bundle_metadata). Every writer takes its codes from aCodesSource, the planes the build holds in memory; no store is derived from a finished.xue. The one exception to “in memory” is a series store’s widened variables (seriesQuantization,binconvert.series_widened_ids):_quantize_filequantizes each of them a second time, from the same float plane, under its sixteen-bit series codebook, and writes the codes straight into a per-variable spool file (_SeriesSpool, anp.memmapin a scratch directory under the work root, frame-major on the run axis); the series writer reads it back a block row at a time, and each spool file is removed once its store is written. Holding a whole run’s sixteen-bit codes beside its byte codes would add twice the byte codes’ memory for a handful of variables.assemble.py:publish.ymlfans a run out:bundle-groupspacks bundles into at mostmax_jobsjobs of similar cost; each job runsbuild-bin --bundles …(partial=True) intodata/raw/partial/<group>/and writesmanifest.part.<group>.jsonand each shared store’s part (never uploaded, no STAC); finalize runsassemble-run(each bundle once, core set required), which merges the parts into the manifest and each store’s group document and stamps its CRC-32 on every entry naming it, and writes the pointer. A top-up of a live cycle builds only missing bundles (--base-manifestagainstmake live-manifest,--base-storesagainstmake live-store-groups), rewriting the group documents under a new?v=;forcerebuilds all.tests/test_assemble.pyholds split and top-up builds byte-identical to a whole one, store and group documents included, so nothing cross-variable may enter a bundle’s arrays or its manifest entry: the group document is the one object several bundles share, and it is a merge of per-bundle parts. A merge onto a base keeps the base’scolumnsonly when no rebuilt bundle is a member of the column store and the source still lists columns; otherwise it drops it and thecolumnsjob builds it anew.columnbuild.py,columns.py,columnarrays.py(build-columns,column-inputs,columns-missing; the column store, run by thecolumnsjob after finalize):column-inputs --manifest Fprints the run-relative objectsbuild-columnsreads, so the job downloads only those;build-columns --model M --run Rcutscolumns.zarrfrom them and rewrites the manifest, pointer and Item;columns-missing --model M --base-manifest Fprintstruewhen the live run lacks its store, which is howresolveretries a failed job. The store is written by one of two implementations that must agree byte for byte: the Python reference (columns.py) and the native writer in the wheel (xue.write_columns), picked byXUE_ENCODERlike the map stores; the self-check, manifest, pointer and Item steps are Python for both.assemble-run --columns FILEtakes the descriptor ({run, stores, columns}) thecolumnsjob leaves and sets itscolumnsas the manifest’s, beating the one a top-up keeps from its base, only when it was cut for this run against the group documents just assembled and validates; otherwise (also for a source with no column arrays) it warns and the run has none, and the report carriescolumnsNotAttached.
Local and archived runs
build-local (localrun.py, make run-local) rebuilds one archived cycle
for local use, such as a backtest, and uploads nothing:
--runis aYYYYMMDDHHcycle;latestis refused, since the live cycle isbuild-bin’s.--hoursdefaults to the source’s whole axis,--bbox W,S,E,N(write it--bbox=…when west is negative) to the whole domain, and--bundlesto every bundle the source publishes. Only those bundles’ inputs are fetched.- The output,
data/local/<model>.<run>/, is the manifest and the shared Zarr storebundles.zarrholding every bundle, plus<bundle>.series.zarrfor the source’sseries_bundle_ids(--no-seriesdrops them) and the posters the manifest names. There is no.xue, reduced-resolution variant, live pointer or STAC. - Raw GRIB goes to
data/raw/local/<model>.<run>/, apart from the livedata/raw/<model>.<run>/, for the same reason the showcase and the fanned-out jobs keep their own: a narrowed record set must never pass for a full fetch of the run. Delete it once the run is encoded when replaying many cycles. - The encoder follows
XUE_ENCODERas everywhere else. The installedxuepywheel can lagsources.pyandvariables.pyby a release, so a bundle registered since the last release builds only withXUE_ENCODER=python.
4 - Sources
Engineering notes per source: what each one fetches, how its fetch stage
differs, and what the rest of the system relies on. What a source publishes
(grid, axis, cadence, variables) is in docs/sources.md.
xuebuild/sources.py (SourceSpec) is the registry; the native encoder
reads it as rust/xue/registry.json, and the shell’s mirror is
FORECAST_MODELS in web/src/data/manifest.ts. The conversion itself is in
pipeline.md, the delivery contract in
delivery.md, and the satellite fetch stage in
../satellite.md.
Overview
| id | kind | fetch stage | core |
|---|---|---|---|
gfs | forecast | .idx byte ranges, NOAA (Google mirror) | tmp2m, prate |
sflux | forecast | as GFS, surface flux files | tmp2m, prate |
ecmwf | forecast | ECMWF open data, repacked from CCSDS | tmp2m, prate |
ifs | forecast | ECMWF open data at 0.1°, -sfc/-pl objects reassembled | tmp2m, prate |
aifs | forecast | ECMWF open data (aifs-single) | tmp2m, prate |
hrrr | forecast (regional, on its own Lambert grid) | NOAA, two mirrors | tmp2m, prate |
rrfs | forecast (regional, on its own Lambert grid), with smoke and dust | NOAA, every hour proves a run | tmp2m, prate |
woofnam | forecast (regional, on its own Lambert grid) | NOAA’s .idx layout on Recast’s host | tmp2m |
gefsaero | forecast (aerosol) | GEFS chem files, Google mirror | aod |
cmadust | series-file forecast (dust, regional) | WMO WIS2 caches, NetCDF classic by byte range | dustsfc |
silam | series-file forecast (air quality) | FMI open data on AWS, whole NetCDF-4 day files | pm25 |
cfs | forecast (seasonal) | one object per variable per run | tmp2m, prate |
iconeu | forecast (regional) | DWD open data, one .bz2 field per parameter and step | tmp2m, prate |
arpege | forecast | Météo-France packages, whole objects cut by identity | tmp2m, prate |
gsm | forecast | GISC Tokyo, whole multi-field messages split and cut by identity | tmp2m, prate |
cmageps | forecast (ensemble products) | WMO WIS2 caches, message heads walked by Range against the registry’s template-ensemble rules | tmp2m, prate |
ifshres | series-file forecast | om2nc (Open-Meteo .om) | tmp2m, prate |
woof | series-file forecast, no feed (cases only) | xue wrf-series over a local WRF run | tmp2m |
efas, efaswb | series-file forecast, no feed (cases only) | xue efas-series over an EWDS GRIB | dis06 |
era5 | series-file reanalysis, no feed (cases only) | xue era5-series over a CDS NetCDF | tmp2m |
cams | series-file aerosol analysis, no feed (cases only) | xue cams-series over an ADS NetCDF | aod |
mrms | fetched observation | gzipped GRIB listed off the bucket | cref |
mrms3d | fetched observation (volume) | 33 gzipped GRIBs a frame, listed off the bucket | refl3d |
jma | series-file observation | jma-radar tool, frame cache | prate |
hkonowcast | series-file observation (a nowcast, one issue a window) | one CSV on DATA.GOV.HK, the newest issue only | prate |
cma | series-file observation (archived) | cmaarchive.py over a Zarr archive | cref |
cwa | fetched observation | one XML per slot on the CWA open data bucket at a path built from its time, frame cache | cref |
aurora | frame-cache observation | SWPC OVATION JSON, frame cache | aurora |
himawari, goeseast, goeswest | satellite | xuebuild/satellite/, frame cache | ir104 |
himawarijp | satellite (regional box) | xuebuild/satellite/, the tiles over its box, frame cache of its own | ir104 |
meteosat | satellite | xuebuild/satellite/ (EUMETSAT Data Store) | ir104 |
Each source publishes from .github/workflows/publish-<id>.yml. Forecast
workflows call the reusable publish.yml (one build job per bundle
group, then assemble-run; see publishing.md), whose model
case is an allow-list a new forecast source must be added to. Observation
workflows run rounds of scripts/window_rounds.sh. geo in
FORECAST_MODELS is not a source: it is a shell view composing the four
disks by longitude (mosaic.ts).
Shared mechanisms
Axis and cycles. A forecast’s axis is steps, (last_hour, step)
segments whose last boundary is horizon_hours (the --hours default);
first_hour moves the start off the analysis (CFS). cycle_hours is the
cycle cadence; a source carries one horizon, so a model whose short cycles
stop early publishes only its long cycles (ifshres, cfs: 12). The CLI’s
bound on --hours is MAX_FORECAST_HOURS, derived from the registry.
Rolling windows and rounds. An observation run is a window named by its
first hour (window_hours, the --hours default), and cadence_seconds
makes the window’s slots the axis, so unitSeconds is the cadence.
--run latest resolves (fetch.py::resolve_run, latest_observation_slot
asking the source’s feed, observation_window_start) to the window whose last
hour holds the newest frame. Where a window starts is the feed’s answer
(Feed.window_start): the plain rule is the hour hours - 1 before the
newest frame, and a feed whose window cannot reach that far back (the
aurora cache, an HKO issue) starts it at its first frame’s hour, since the
run id must be the manifest’s run time. The same run is rebuilt as frames arrive, so
each build takes --round HHMM and lands in <model>.<run>/<HHMM>/ with a
window.json (fetch.py::window_summary). A new round is a new
directory, because nothing is overwritten under an unchanged ?v=
(publishing.md). A round is: newest frame vs
the live window.json → build → make upload-r2 … ROUND= →
prune-r2-rounds, which keeps the live run’s newest two rounds in clock
order (a round is named by its build minute and a run’s rounds may straddle
midnight) and lists only the run directory the pointer names. The previous
run is left whole until superseded; prune-r2 KEEP=2 then deletes it, and
runs only on a run change. Each scheduled job runs one round (ONCE=true,
so no runner is held for an hour); a loop dispatch runs rounds to twenty
past the next hour and yields through scripts/successor_queued.sh. The
shell treats a changed manifestCrc32 on the pointer as a new run
(checkForNewRun in runpoll.ts, PageState.resume).
Feeds. SourceSpec.feed names the family a source is fetched
through, a key of xuebuild/feeds.py::FEEDS. Its fetcher answers the four
questions fetch.py asks of a source — the object of a forecast hour
(object_url), whether a run has landed (is_complete), an observation’s
newest frame (latest_slot) and the run’s download (fetch_run) — so
nothing in the fetch tests a source id. A family is an upstream service and
the shape of its objects: noaa-gfs, noaa-sflux,
noaa-gefs-aerosols and recast-woof-nam share the .idx byte-range path
under their own object names; noaa-hrrr, noaa-rrfs, ecmwf-open-data (ecmwf, ifs, aifs),
dwd-icon-eu, meteofrance-arpege, jma-gisc and cmageps are the other one-GRIB-per-hour
feeds (FrameFeed, whose frames fetch_frame writes); noaa-cfs,
open-meteo, cmadust and fmi-silam fetch series; noaa-mrms (mrms, mrms3d),
jma-nowcast, hko-nowcast, cma-archive, ovation and satellite
(every disk) are observation windows; local is a source nothing fetches (woof, efas,
efaswb, era5, cams). What a family needs to tell its sources apart
comes from their own fields (platform, open_meteo, companion_files)
or a table in the family’s code (ECMWF_OPEN_DATA_MODELS). The families'
code stays in fetch.py beside the request, range and index helpers;
feeds.py only says which of it serves which question.
Packing. SourceSpec.packing is published (GDAL reads the records as
they come), ccsds: CCSDS/AEC (DRS template 5.42), which GDAL builds
without libaec cannot decode, or jpeg2000 (DRS 5.40), which GDAL builds
without OpenJPEG cannot; fetch_frame repacks every frame of the last
two to grid_simple with eccodes’ grib_set before writing it. ecmwf,
ifs, aifs, iconeu and arpege are ccsds, cmageps is jpeg2000
(and its fetch rewrites each record’s template with grib_set too);
assemble.group_needs_eccodes flags every build job of a source that is
not published eccodes, which is all publish.yml reads to install the
tools. Both fields are the fetch’s
alone: the registry document leaves them out.
Frame caches. A feed without an archive deep enough for a whole window
(JMA tiles expire after days, the aurora feed keeps one grid, the satellite
scans are slow to list) caches each decoded frame under
data/raw/<model>-frames/<variable>/, mirrored on the bucket by make pull-r2-frames / push-r2-frames / prune-r2-frames (FRAME_CACHE=true
in the rounds script). The Makefile globs key on
<variable>/<name>_<YYYYMMDDHHMMSS>.<ext>, and the pull spans as far ahead
of the clock as behind it (aurora frames are named for future valid times).
A frame is one object: whatever a frame needs said about it (a satellite
frame’s packing and provenance) goes inside the file, never in a sidecar
beside it, since every object costs a write on push and a delete on
prune. Listing costs too (a Class A operation per thousand keys), so a
round pushes exactly the frames it wrote (newer than a stamp touched after
the pull) instead of syncing the prefix, and only the round that
supersedes a run, once an hour, prunes.
A showcase case can only be cut from what the cache keeps.
The series-file path. SourceSpec.series_file sources arrive as CF
NetCDF series rather than per-frame GRIB; convert_bin and convert.rs
branch on it, and observation.py (mirrored in observation.rs) ingests
them. With a cadence_seconds, each time is snapped to its slot and the
first slot’s whole hour is the run. observation.series_files accepts one
file per window (radar) or one per variable (<stem>.<variable>.nc,
satellites, ifshres). The fetch stage owns every projection on this path,
so neither encoder does reduced-Gaussian or geostationary arithmetic.
Grids. A global grid is snapped to 360 / width and a regional grid’s
steps to the thousandth of a degree or, failing that, the arc-minute
(grid.snap_regional_steps, mirrored in grid.rs), since GDAL derives the step
from the first and last coordinates and some producers write the last one
short; the arc-minute also keeps the two encoders on one double for EFAS’s
1/60°, which gdalinfo -json prints short of its seventeen digits. A downsample
(BlockReduction on the GridInfo) publishes coarser than the source,
applied in _extract_planes after the fill rules and before the crop. A file on
a Lambert conformal projection is published as it is: GridInfo.projection
replaces the regular fields, the bundle is schemaVersion 4, and
grid_relative_winds turns its wind pairs next to derive_vector (HRRR, below).
A regular Gaussian grid keeps the regular fields GDAL reports, and gaussian_n
adds what its rows really are (GridInfo.gaussian, the grid.gaussian block and
the store’s latitude coordinate). docs/encoder.md, “Native grids”, has the
arithmetic. fill_values fold
sentinels to the codebook bottom before unit conversion; the format has no
bitmap.
Native encoder dispatch. native.knows_source(model) asks the installed
wheel’s validate_build about the source’s whole published bundle set (a
wheel without it, an empty conversion); a wheel that predates the source
or one of its bundles refuses with UnsupportedRegistry, and the workflow
takes the reference pipeline with a ::warning::. Any other failure of
the question fails the job. The observation
workflows (jma, cma, aurora, the four satellites) resolve this way,
because a cron run cannot wait for a wheel release; the forecast
workflows pin the native encoder, so a forecast source cannot publish on
schedule before a wheel carries it. A source whose shape changes
takes a new id so an old wheel is not mistaken for a new one (radar →
cma).
Forecasts
gfs. The reference source and the full bundle set (133 bundles, the
height, temperature, relative humidity and wind on all twenty-one isobaric
levels, the clear-air turbulence cat300/cat250/cat200
with its own cat_calibration, the GFS-Wave companion gfswave.* beside
atmos/, read for the combined sea, the wind sea and the first swell
partition). The swell partitions sit on NCEP’s local surface 241, an ordered
sequence whose value is the rank; GDAL spells it 1-RESERVED(241), so the
matcher reads the rank off the assembled template. tmp2m, dpt2m, prate, wind10m and prmsl ship a <bundle>.series.zarr
companion (series_bundle_ids; see ../zarr-profile.md).
XUE_GFS_BASE_URL overrides the mirror.
sflux. GFS’s native-resolution surface flux files on the ~13 km Gaussian
grid (3072 × 1536, gaussian_n 768); prate_ave is a window mean de-averaged into prate.
tmp2m, prate, dswrf and wind10m ship series companions.
ecmwf. ECMWF open data; CCSDS packing is repacked to grid_simple with
grib_set at fetch time. Of the three mirrors (XUE_ECMWF_BASE_URLS) the S3 and
data.ecmwf.int ones answer bursts with 503 and are paced; Google’s is not. The wave stream is a
companion beside oper. Publishes what the open data carries, in GFS order,
so a model switch keeps the layer — all but GFS’s 975 / 950 / 900 and
800 / 750 / 650 / 550 / 450 / 350 hPa, which the open data lacks; the gust is analysis-optional and spelled
10fg to 90 h, 10fg3 beyond (ecmwf_alternate_params). The cat bundles carry a fit of
their own (cat_calibration): on the same runs IFS’s ln TI1 mean sits about
0.25 below GFS’s at every level.
The cycle’s ensemble products are a second companion, ep: not an object
per step but one per cycle, enfo/<cycle>-240h-enfo-ep.grib2 with its
.index, written for the 00 and 12 cycles about an hour after oper
(fetch.py::ecmwf_ensemble_products_url; the run waits for it, since a
companion object is part of completeness, and its index is read once per
process). Records are picked by the line’s type and step as well as its
param (idx.py::ecmwf_ensemble_selector): es at the frame’s hour for a
spread, ep with the 24-hour window ending at the frame for a probability.
Published beside the deterministic fields: prmslsd, hgt500sd,
tmp850sd (each after its centre, on the run’s axis from the analysis) and
apcp24gt1 … apcp24gt100 (after prate), whose windows end every 12
hours from F024 (variable_first_hours + variable_step_hours), so each
probability bundle is on a time_<id> axis of 19 frames. ECMWF writes the
spread as code-table-4.7 code 2, the sea-level pressure spread as 0/3/0
and the probabilities on 0/1/52 with an unscaled limit: each is one more
template-ensemble rule on the id cmageps already publishes, so the two
centres share the ids and the published identity. The 0.1° ifs has no
ensemble products at its resolution and carries none of this.
ifs. The same cycle’s records as ecmwf at the model’s full 0.1°
regular grid (the 0p1 objects beside the 0p25 ones, published since
the 2026-10-20 06z cycle), landing about two hours after the 0.25° set.
The registry entry is ecmwf’s less the ensemble products — inputs, companions, bundles, axis rules
and, pending a refit on 0.1° runs, the cat_calibration — at ifshres’s
grid, tile and two-rung ladder. What differs is the fetch: at 0.1° the
oper stream is split into a -sfc object (every surface and soil
record) and a -pl one (the pressure levels), and the wave stream is
one object suffixed -sfc (fetch.py::EcmwfOpenData, split). The
fetcher picks each record’s object by its level type
(ecmwf_object_part), loads each .index once per frame and assembles
one GRIB per step in source order, so the converter sees the same frame
as for ecmwf; a run is complete only when all three objects are at
both ends. The 06/18 cycles reach 144 h here (90 h at 0.25°,
short_cycle_hours), so latest skips them only past that.
aifs. ECMWF’s AIFS Single, fetched by the IFS path under another model
directory (fetch.py::ECMWF_OPEN_DATA_MODELS, aifs-single beside ifs),
landing ~5.5 h after each cycle. Its open data encodes five fields unlike
IFS, each a RecordAlternate under the GFS identity: tp as WMO 0/1/52 in
kg/m² (mm) rather than local 0/1/193 in metres (the
precipitation-accumulation rule’s millimetre spellings, mirrored in
inspect.rs), tcc as
WMO 0/6/1 in percent, and the three layer clouds on the ECMWF layer
boundaries (ground, 800 hPa, 450 hPa). No isobaric r, gust, CAPE, ice
thickness or peak wave period. tests/test_aifs.py.
hrrr. Computed on a Lambert conformal grid and published on it, 1799 × 1059
cells cut into 64 × 64 tiles. grid.grid_info reads the projection from GDAL’s
WKT (reproject.py; the wheel’s gdal_info reports coordinateSystem.wkt). The
records’ winds are along the grid’s axes (grid_relative_winds), so
_quantize_file turns every vector pair to east and north. tests/test_hrrr.py
holds the two encoders identical, so the operation order is fixed. Mirrors lag each other
per frame, so a frame comes from the first mirror that has it and a cycle is
complete only when one mirror has every hour (XUE_HRRR_BASE_URLS). Runs and
cases published before the native grid are resampled onto a regular 0.03° grid,
and the shell clips those to the footprint (FORECAST_MODELS[].domain,
web/src/data/domain.ts), by the bundle’s metadata, never the id.
wind80m is the 80 m U/V pair wrfsfc writes for wind power (0/2/2–3 on
surface 103 at 80 m). The 00/06/12/18Z cycles run to F48: long_cycles
lets a build that names one of them ask for --hours 48, while the
published axis, the --hours default and the live runs stay at F18.
rrfs. NOAA’s Rapid Refresh Forecast System, operational since the 2026-11-03
12Z cycle (SCN 26-48), from its NODD bucket (noaa-rrfs-ops-pds,
XUE_RRFS_BASE_URL, also holding the parallel feed back to 2026-08-12). The
deterministic run’s CONUS output is on HRRR’s grid to the last digit of the
origin, so projection, tile and grid_relative_winds are HRRR’s and no
projection code is new. The 3 km North America output (polar stereographic)
carries only eighteen records and the 13 km one is on a rotated grid neither
encoder reads. A frame comes from two objects, 2dfld and the prslev
companion, about 47 MB of ranges together, and the bucket fills them out of
order, so a run is complete only when every hour of both is there with its
.idx. RRFS-SD is no separate product: smoke and dust are records of 2dfld.
Near-surface concentrations are template 4.48 MASSDEN (0/20/0) at 8 m in
kg/m³, hence the mass-density-to-micrograms rule, smoke as particulate organic
matter under 2.5 µm (62010) and dust as two size cuts (62001). Total PM2.5 and
PM10 are hour means in template 4.46, whose records GDAL names unknown and no
matcher reads, so they are not published; column masses (COLMD) would need a
second rule. AOTK is template 4.0 on surface 200 with no species or wavelength,
so it is aotk rather than aod. Three spellings differ from HRRR’s: PRATE
has a maximum beside it (excluded), REFC is WMO 0/16/5 on surface 200 (an
alternate), and the sea level pressure is MSLET, accepted under prmsl as
MSLMA is. tests/test_rrfs.py.
woofnam. WOOF-NAM by Recast, a GPU port of the retired NAM (NMMB) run
from the GFS analysis four times a day, from Recast’s own host
(XUE_WOOFNAM_BASE_URL), which keeps a run seven days: one awphys object
per hour with a wgrib2 .idx, some 66 MB and 450 records, of which a frame
takes twenty-seven ranges (about 4.7 MB): the terrain at the analysis, the
precipitation total at every later hour.
CC BY 4.0, credited “WOOF-NAM by Recast”,
and not a NOAA forecast, which the STAC prose and the credits say. The files
follow NOAA’s NAM layout under NCEP’s centre number with generating process
254, so every record is read by the rules the NOAA sources are and the feed
is NoaaGrib under another object name; the hours land in order, so both
ends prove a run. The grid is NCEP 218, tangent at 25°N and centred on 95°W
(614 × 428 at 12 191 m), read out of GDAL’s WKT like HRRR’s; the tile is
16 × 16 cells, the 195 km an HRRR tile covers. TCDC is on NCEP’s surface
200, an alternate CFSv2 already needed. Both PRMSL and MSLET are there
and the first phrase wins. The files carry no PRATE. APCP is the total
since the start of a window that restarts every twelve hours (0-5 hour acc at F05, 12-13 hour acc at F13; an empty 0-0 hour acc at the
analysis, which is not read), the fourth way precipitation arrives
(windowed_precipitation): each frame is differenced against the previous
one of the same window and a window’s first frame against zero, in both
encoders (dewindow_precipitation), so prate is the hour’s mean and its
series starts at F001. Where an hour is a multiple of three and more than
three into its window, the file holds a second APCP, the last three hours'
total (3-6 hour acc beside 0-6 hour acc). The field and surface name
both, so the fetch adds the phrase of the window the hour falls in
(fetch.window_index_qualifier) and a frame holds the one record; GDAL
calls it APCP01 to APCP12 by its length, which is what the apcp entry
lists, and nothing in a band says where its interval begins, so a file with
both totals is refused rather than guessed at. The rate is in the core set,
as on the other forecasts: a run without it is not a complete one. REFC
is NCEP’s local 0/16/196 on surface 200 (HRRR’s is 196 on surface 10, RRFS’s
5 on 200), an alternate of cref of its own; the layer cloud covers and
CPOFP are not in the files.
tests/test_woofnam.py.
gefsaero. GEFS-Aerosols, the chem/pgrb2ap25/ a2d_0p25 files
(XUE_GEFS_BASE_URL). Nine scalars: 550 nm AOD total
and by species (aod, aoddust, aodsalt, aodsulf, aodorg, aodbc;
WMO 0/20/102, entire atmosphere) and surface PM in µg/m³ (pm25, pm10,
pm10dust; NCEP-local 0/13/193 and 0/13/192). Every record is template
4.48: grib2.py / gribindex.rs parse it (the 24-octet shift),
gdal.py / inspect.rs match on GRIB_PDS_PDTN +
GRIB_PDS_TEMPLATE_ASSEMBLED_VALUES, and identity is parameter + the
aerosol block, since the six species share one triple. The .idx spells
the species after the hour, so VariableSpec.index_qualifier is a second
phrase, matched case-insensitively (Google capitalises Dust Dry).
Codebooks are parameterised log1p (PrecipitationCodebook), pinned with
the identities by the registry snapshots (rust/xue/registry.json,
web/src/data/registry.ts).
cmadust. CMA-CW v1.0/DUST, the China Meteorological Administration’s
sand and dust storm forecast for the WMO SDS-WAS Asian Center, exchanged
through WMO WIS2 as core data (WMO Unified Data Policy: free and
unrestricted). One NetCDF per lead time,
Z_NAFP_C_BABJ_<YYYYMMDDHH>0000_P_CEMC-CMA-CW-DUST_15KM_ASIA-<HHH>00.nc
(the last five digits are hours × 100), 105 per run, about 112 MB each,
landing about 07:15–07:30Z (00Z) and 19:15–19:20Z (12Z); the caches keep a
few days. Two WIS2 global caches carry them and neither is complete on
its own: the Met Office/NOAA cache (XUE_CMADUST_NOAA_CACHE_URL, the
name under a fixed prefix) and JMA’s (XUE_CMADUST_JMA_CACHE_URL, the name
under a directory of the same name and an upload stamp, so a key is known
only from a listing). xuebuild/cmadust.py lists the run’s prefix on
both, ignores keys that are not a whole .nc (partial uploads carry a
numeric suffix), and reads each lead time from the first cache that lists
it, NOAA first; a run is complete when the two listings together name
every lead time (fetch.py::_run_is_complete), and a lead time neither
names fails the fetch rather than leaving a gap. A file is NetCDF3
classic, uncompressed: one Range read of 16 KB holds the header (about
2 KB, parsed with struct; a longer one is read again at the length the
parse asks for) and the lon / lat coordinates behind it, which are
checked against the grid; then one Range read per wanted surface field
(sconc_dust → dustsfc, aod550_dust → aoddust, big-endian float32,
1 MB each). The four pressure-level fields, nearly all of the file, are
never read. A file whose header describes another length than the listed
size is a cut-off upload and falls back to the other cache. Each variable’s
run becomes one NetCDF classic series, cmadust.<run>.<id>.nc, written by
the same module (no netCDF4): time in hours since the cycle,
forecast_reference_time beside it, latitudes ascending as the file has
them (GDAL turns them north-up), a NaN fill. The grid is the model’s own,
835 × 301 cells of 0.15° from 25°E to 150.1°E and 15°N to 60°N, published
as is: a tile of 56 × 43 cells, no ladder. dustsfc is a
quantity of its own, every particle size the model carries (not
pm10dust, GEFS-Aerosols’ dust under 10 µm): WMO 0/20/0 on the ground with
a dust aerosol block of no size or wavelength interval, a log1p
codebook to 50,000 µg/m³ (a storm core passes 30,000). aoddust keeps
the GEFS-Aerosols identity and codebook, maximum 5, although CMA-CW’s dust
optical depth exceeds 5 over strong dust events: 5–15 is common in a storm
core, with occasional isolated single-cell spikes up to about 1500. Those
cells take the overflow code, which the map draws at the top colour and a
point read answers as null. Negative surface concentrations from the model
are coded 0. tests/test_cmadust.py.
silam. SILAM v6.1, the Finnish Meteorological Institute’s global
air-quality forecast, from FMI’s AWS open data bucket
(XUE_SILAM_BASE_URL, https://fmi-opendata-silam-surface-netcdf.s3.amazonaws.com,
CC BY 4.0). One NetCDF-4 file per field and forecast day,
global/<YYYYMMDD>/silam_glob_v6_1_<YYYYMMDD>_<FIELD>_d<N>.nc, N 0–4,
24 hourly frames each from +1 h of the day, about 35 MB of deflated HDF5;
the whole run lands at once, about 05:07Z, and the bucket keeps a few
days. The bucket carries total PM2.5 and PM10 (and gases), no dust of its
own. xuebuild/silam.py lists the folder (a run is complete when it holds
every published field’s day files through the horizon), fetches each day
file whole and reads it with netCDF4, the silam dependency group:
publish.yml syncs it in the build job for this model only. Each file is
held to the product: the lat / lon of the 0.2° grid (float32, so the
tolerance is 1e-3°), a time axis in seconds since a UTC instant (FMI counts
from two days before the folder’s date; only valid times are compared),
the field in ug/m3 and float32. Both the _FillValue and the
missing_value become NaN. The file’s longitudes run -179.8° to 180°; the
fetch rolls the 180° column to the west edge, so the series run from -180°
like the GFS grid. Each variable’s run becomes one series,
silam.<run>.<id>.nc, written by cmadust.write_series with this
product’s names and unit: 570 MB a variable, so publish-silam.yml builds
the two bundles in two jobs. Every value is the hour’s mean ending at its
time, a 3-hourly frame included, so no statistical process is declared,
and there is no analysis: the axis starts at F001. The grid is 1800 × 897
cells, tile 60 × 69 (30 × 13 tiles, no clipped edge) and the half tier.
The quantities, identities and codebooks are GEFS-Aerosols’ pm25 and
pm10. tests/test_silam.py.
cfs. NCEP CFSv2 member 01, nine-month runs on the T126 Gaussian grid
(384 × 190, gaussian_n 95, on the surface family only), 1092 frames. The bucket (noaa-cfs-pds, XUE_CFS_BASE_URL) is
the transpose of every other source: one object per variable holding the
whole run (time_grib_01/<name>.01.<run>.daily.grb2 with an .idx),
written as the model runs. The fetch reads each variable as a few large
ranges and cuts them into the frame-per-file layout the converter reads; a
run is complete (_cfs_run_is_complete) only when every sidecar names the
F6552 record with a successor and the object is that long. The series carry
no analysis and the flux files’ :anl: records are instantaneous, so
first_hour = 6 (both encoders) and f000 is never fetched. The flux
quantities are declared means (statistical_processes) although encoded as
instantaneous. The pressure
family (CFS_PGB_IDS) is a companion file on its own 1° grid (360 × 181).
The shell’s manifest ceiling on forecastHours is 8760 for this axis.
tests/test_cfs.py.
iconeu. DWD’s ICON-EU, the European nest of ICON, on its regular 0.0625°
grid (1377 × 657, centres 23.5°W to 62.5°E and 29.5°N to 70.5°N), so
nothing is resampled and the power-of-two step passes the regional snap
unchanged; the shell has a region for it and no domain. DWD’s open data
server (XUE_DWD_BASE_URL) writes one bzip2-compressed, CCSDS-packed GRIB2
field per parameter and step under icon-eu/grib/<HH>/<param>/, with no
index, and keeps only about a day of cycles. The fetch names each field by
the registry’s dwd_param (VariableSpec.dwd_param, the document’s
dwdParam), decompresses and joins a frame’s fields in source order and
repacks the frame to grid_simple with eccodes, as for the ECMWF open data;
a run is complete when every input is there at both ends. The 00/06/12/18Z
cycles run to F120 and land about 3.5 h after the cycle (the 03/09/15/21Z
ones stop at F30 and are not published). A basic set: TOT_PREC is the
run total as the WMO 0/1/52 in kg/m² (AIFS’s tp alternate), VMAX_10M
the maximum gust over the step on the 10 m surface (ECMWF’s gust
alternate; an empty interval at the analysis, so optional there) and
CLCT the WMO 0/6/1 in percent on the ground surface (AIFS’s tcdc
alternate) and the terrain HSURF the geometric height 0/3/6 in metres
(the orog alternate beside ECMWF’s geopotential), one time-invariant
object per cycle (icon-eu_europe_regular-lat-lon_time-invariant_<run>_HSURF)
fetched at the analysis alone. tests/test_iconeu.py.
arpege. Météo-France’s ARPEGE on its 0.25° GLOB025 grid, the GFS grid,
from the data.gouv.fr dataset “Paquets Arpège - Résolution 0,25°”
(Licence Ouverte 2.0). A cycle’s surface package SP1 is four multi-field
GRIB2 objects on an OVH S3 bucket (XUE_METEOFRANCE_BASE_URL), one per
range of steps (000H024H, 025H048H, 049H072H, 073H102H, about
740 MB together), CCSDS packed, parameter-major, with no index. The fetch
downloads the packages the frames still to cut reach into SP1/ under the
run’s raw directory (which the converter’s frame listing does not
descend), indexes each package’s records (grib2.index_messages zipped
with grib2.message_spans) and cuts each frame by the records’ identities
(the header matcher’s own test) and valid time, then repacks it like any
CCSDS frame; a run is complete when every package its axis reaches is on
the bucket, since an object appears whole. Every build job downloads the
whole packages, so publish-arpege.yml asks for two jobs. Every cycle runs
to F102, hourly to 48 and three-hourly after; the 00/12Z packages land about
3–4 h after the cycle, the 06/18Z ones about 5 h. The packages carry no
precipitation total at the analysis, and an accumulated source differences
its first step against the analysis plane, so the fetch writes that record:
the first step’s tp restamped to an empty interval at the run time with
every value zero (eccodescli.zero_accumulation_at_analysis, grib_set -d 0 -s endStep=0) — the shape ICON-EU’s TOT_PREC has at step 0. Same
encodings and basic set as iconeu; the gust is the maximum over the hour
ending at each step, three-hourly steps included. The terrain (0/3/6 in
metres, as DWD’s) is in no SP1 package: the first SP2 package
(000H024H, about 430 MB) writes it once, at the analysis, so the fetch
walks that object’s messages over Range, a 512-byte head each
(grib2.message_head), and reads the one matching record whole; a run is
complete only once that package is on the bucket too. tests/test_arpege.py.
gsm. JMA’s Global Spectral Model on the 1.25° grid JMA exchanges
through WMO, from GISC Tokyo’s open data directory
(XUE_JMA_GISC_BASE_URL, /d/o/RJTD/GRIB/Global_Spectral_Model/…, no
registration; the GISC terms make the low-resolution GSM products public
and restrict only the high-resolution GSM service). The directory keeps
five days and answers HEAD with the length. A cycle is two objects,
…_GSM_GPV_Rgl_Gll1p25deg_L-all_FD0000-0512_grib2.bin (F0 to F132,
six-hourly, about 140 MB, every cycle) and …_FD0600-1100_grib2.bin
(F144 to F264, twelve-hourly, about 70 MB, the 00/12Z cycles alone), the
FDddhh range in days and hours. Each object is one GRIB2 message of
thousands of fields (sections 4 to 7 repeated, 2322 fields in the
first), which index_messages and message_spans would read as one
record, so after the ARPEGE-style download into packages/ the fetch
rewrites each object one message per field (grib2.split_fields: the
indicator with the new length, section 1, the sections 2 and 3 in force,
the field’s 4 to 7, a reused bitmap written out) and cuts the frames out
of that file with the ARPEGE cut (fetch._package_records). Simple
packing, so no eccodes. JMA writes an isobaric surface as hectopascals
with the scale factor -2, octet 0x82: GRIB2’s signed octets are
sign-and-magnitude, which the header index reads as such (GDAL does too).
Only the 00/12Z cycles are published (cycle_hours 12), so every run
reaches F264; the second object lands about 6.4 h after the cycle, the
first about 3.6 h. The precipitation is the run total under the WMO 0/1/8
(statistical process 1, template 4.8, kg/m²), which GDAL names
APCP<hours> (APCP06 to APCP264): apcp’s rule (APCP01 to
APCP12) is for a window’s total, so tp reads it through a rule of its
own, accumulation-from-start (template 4.8 and a forecast time, the
interval’s start, of 0), and through a 0/1/8 alternate in the header
index; the converter de-accumulates it into prate as it does ECMWF’s.
The objects carry no record at the analysis, so the fetch writes one the
ARPEGE way but in pure Python (grib2.zero_accumulation_at_analysis: the
first step’s record with the interval emptied to end at the run time and
the data packed as a constant 0 in no bits). The height, temperature and
wind are read up to 10 hPa (the registry’s STRATOSPHERE_LEVELS_HPA).
GDAL reports that surface’s pascals as 1000-ISBL, the short name 1000 hPa
takes in hectopascals, so the isobaric rule reads the surface off
GRIB_PDS_TEMPLATE_ASSEMBLED_VALUES (type 100 and the scaled value, in
whole pascals) wherever the driver assembled a template of the 4.0 layout,
and falls back to the short name and the prose only where it did not. The
relative vorticity (relv<level>, 0/2/12 on 925, 700, 500 and 250 hPa,
GDAL’s RELV in 1/s) is published in 10⁻⁵ s⁻¹ through a unit rule of its
own, per-second-to-1e-5, rather than in s⁻¹: a codebook step fine enough
in s⁻¹ is under 10⁻⁴, which json.dumps and the wheel’s writer spell
differently (1e-05 against 1e-5), and 10⁻⁵ s⁻¹ is the unit a vorticity
chart is read in anyway. Its codebook is ±127 at a step of 1, zero at code
127. The grid
is small (41,760 cells a plane), so there is no ladder; a 48 × 29 tile cuts
it into 30. tests/test_gsm.py.
cmageps. CMA GRAPES GEPS v1.3, the China Meteorological
Administration’s global ensemble (30 perturbed members and the control), as
WMO WIS2 exchanges it (urn:wmo:md:cn-cma:data.core.weather.prediction.forecast.medium-range.probabilistic.global,
core data). CMA exchanges no members: one GRIB2 file per lead time,
Z_NAFP_C_BABJ_<YYYYMMDDHH>0000_P_CMA-WIPPSGEPS-GLB-<HHH>.grib2, about
80 MB of JPEG2000-packed ensemble products, three-hourly to +78 h and
six-hourly to +360 h; only the six-hourly files are read (61 frames). A
file’s 87 messages are the mean and spread (template 4.2,
derivedForecast 0 and 4) of the 500 hPa height and the sea-level
pressure; the 0/25/50/75/100th percentiles (4.6) of the 2 m and 850 hPa
temperature, the 10 m, 850 hPa and 250 hPa wind speeds, the instantaneous
10 m gust (i10fg, 0/2/22 at 10 m), the total cloud cover, the CAPE and
two wind shears; the percentiles (4.10) of the precipitation over the six
hours ending at the step and over a longer window, and of the six-hour
snowfall; and exceedance probabilities (4.5, 4.9). What the source reads
is registry data: every input names its product in a template-ensemble
GDAL rule (the template’s shape, the parameter on CMA’s surface, the
statistic, and for an interval its length and process, docs/registry.md),
and the walk, the header index and the GDAL pass all match a record against
those rules alone, so the fetch holds no list of products. The centre of
each quantity stands in for the deterministic field under its id — the
mean where it is the only statistic (height, pressure), the median
elsewhere, the shared variable taking the rule beside its own and the
source naming the block it writes (SourceSpec.ensembles). Beside it: the
25th and 75th percentiles of the six median fields (tmp2mq25, …), the
spread of the two mean fields (prmslsd, hgt500sd), and the
probabilities of more than 1, 5, 10, 25, 50 and 100 mm in the 24 hours
ending at the step (apcp24gt1, …), which the files carry from +24 h
(SourceSpec.variable_first_hours: not asked of an earlier frame, and the
bundles on their own time axis from 24). The precipitation is the median
total of the window of six hours ending at the step (the rule’s hours;
the run-long window beside it is the same percentile), and its quartiles
are the 25th and 75th percentile totals of the same window, each divided
by six as the median is (SourceSpec.interval_precipitation_pairs,
apcpq25 → prateq25). The files have no index, so a frame is a walk of
the message heads over Range (512 bytes each: section 0 gives the
message’s length, sections 1 and 4 its identity, read by
grib2.product_identity), stopping once every input is found — about
eighty reads — and one Range read of each record, written as CMA wrote it,
templates 4.2, 4.6, 4.9 and 4.10 included. The gust is CMA’s at 10 m,
matched by its rule on that surface and published on the ground-surface
identity GFS’s instantaneous gust has. A band of an ensemble template is
accepted by a template-ensemble rule alone: the other rules read the
element and the surface, which do not tell a spread from the mean GDAL
spells the same way. The frame is then repacked to grid_simple
(packing="jpeg2000"). It is the interval-precipitation path, as on
Open-Meteo’s series, but on GRIB frames: the rate is the total over six.
The analysis file has no precipitation, and its gust and cloud cover are
fields of zeros, so all three and their percentiles are
optional_at_analysis and never read at +0. The grid is the 0.25° grid
without the pole rows (1440 × 720, first centre 89.875°N, 0°E), which the global snap takes as it is; tile 48 × 48
(30 × 15, no clipped edge), the half tier. The caches are data
(cmageps.CACHES, xuebuild/wis2.py): the Met Office/NOAA one and JMA’s
are listed, and a run is complete when their listings together name
every lead time (neither does on its own, and the NOAA one carries
partial uploads under a numeric suffix, which are skipped); CMA’s own
cache (XUE_CMAGEPS_CMA_CACHE_URL) cannot be listed but serves a file by
Range under the UTC day it arrived, so the cycle’s day and the next are
tried, last, as a fallback (it keeps files for days, KMA’s and DWD’s,
which work the same way, about one). The caches take a run in batches: a
00Z run’s leads to about +72 h at 05:20Z and the rest at 18:04Z, a 12Z
run’s between 18:01Z and 19:01Z (20:01Z some days, a few leads now and
then held to 03:02Z the next day). tests/test_cmageps.py.
ifshres. ECMWF IFS HRES (~9 km) as Open-Meteo forwards the real-time
archive. The fetch stage is om2nc (xuebuild/om2nccli.py, XUE_OM2NC): it
reads the .om files under SourceSpec.open_meteo’s directory
(ecmwf_ifs) by byte range and resamples the reduced Gaussian O1280 grid
onto the regular 0.1° grid (3600 × 1801, nearest neighbour), one NetCDF per
variable. om2nc is GPL-2.0-only: it stays a subprocess on the PATH, and
no om dependency may reach pyproject.toml, Cargo.toml or web/. On the
series-file path as a forecast, the run time is the epoch in the time
unit and an optional_at_analysis variable may lack lead 0.
VariableSpec.open_meteo is the Open-Meteo spelling of a variable.
Precipitation is the total since the previous step, divided by the step
into prate (interval_precipitation; its input apcp is read, never
published). A NaN nodata is a fill (PlaneSource.fill_nan), which is how
sea ice thickness over land arrives. publish-ifshres.yml installs the
pinned om2nc release.
woof. A WRF-ARW run commissioned on Recast Systems’ WOOF service
(gpuwm), nested 12 → 3 → 1 → 0.5 km from the GFS and read on its 500 m
innermost domain over Mount Fuji. There is no feed: latest_filename is
None, so the source is the first forecast that is not fetched (a forecast
is fetched only through a live pointer, an observation only through a
window_hours), it is absent from fetch / build-bin, require_complete
refuses it, and it is reached only through showcase cases naming a
dataset directory under XUE_OBSERVATION_ROOT
(showcase/README.md). The xue wrf-series tool (xuebuild/wrf/, the
wrf dependency group: netCDF4) owns every WRF particular — destaggering,
rotating the grid-relative wind to earth-relative, the dewpoint, the
layered cloud maxima by MSL height (0–2 / 2–6 / >6 km), differencing the
run-total precipitation into the hour’s apcp, the 80 m wind (U and V
destaggered onto the mass points, read linearly between the two model
levels that bracket 80 m above the ground in each column, then rotated),
the sea level pressure (PSFC reduced hypsometrically over HGT with the
2 m virtual temperature warmed down the standard lapse rate to half the
height — the plain reduction, not WRF’s slp, because a nest a few tens
of kilometres across carries it as a background field; the series is in
pascals, which the converter turns into hectopascals as it does a GRIB
record), interpolating QCLOUD linearly in height onto the 24 altitudes
of the clw<m> family (each column’s mass-level heights from PH + PHB;
the lowest level’s value between the ground and it, zero above the top,
NaN under the model terrain), and the bilinear regrid from the Lambert
conformal nest onto the regular 0.005° grid inscribed in it (79 × 61; a
coarser nest takes --step) — and writes woof.<run>.<variable>.nc, one
CF series per variable, so both encoders take the ifshres series-file
path unchanged. Published are eleven surface scalars and prmsl, the
wind10m and wind80m pairs and the cloud3d volume.
Frames start at f001 (first_hour = 1: f000 is the GFS analysis on the
nest, dropped by the tool) and apcp is on every frame, so nothing is
analysis-optional; prate is the interval rate (interval_precipitation).
The 24 cloud water levels ship as one volume bundle, cloud3d
(a volume in bundles.py, after MRMS’s refl3d), in g/kg on the linear clw
codebook; the NaN under the terrain is filled as 0 g/kg, so the volume
carries no nodata code and the viewer hides the ground by occlusion.
No ladder: a plane is under 5000 cells. tests/test_woof.py.
efas, efaswb. The Copernicus Emergency Management Service’s European
Flood Awareness System (EFAS v5, LISFLOOD, run by ECMWF): efas is the
forecast driven by the ECMWF high-resolution run (EFAS-v5 / hres,
00Z and 12Z cycles), efaswb the water balance, the same model forced by
observed meteorology that the forecasts start from (EFAS-v5-WB /
water_balance). Both are on the EFAS grid, 4530 × 2970 cells of 1/60°
from 25.25°W to 50.25°E and 22.75°N to 72.25°N (cell centres half a step
in). The Early Warning Data Store releases them thirty days after the
cycle, so there is no live feed: as for woof, latest_filename is
None, nothing fetches them, require_complete refuses them, and a run is
requested by hand (ewds.climate.copernicus.eu, one queued request per
dataset) and reached only through a showcase case naming the dataset
directory. The xue efas-series tool (xuebuild/efas/, the efas
dependency group: the eccodes bindings with eccodeslib, and netCDF4;
uv sync --group efas --inexact) owns every EFAS particular. It reads one
GRIB with eccodes — every message dis06, WMO 1/0/7 “discharge from
rivers or streams” on the ground or water surface, product template 4.72
with statistical process 0 over 6 h, which GDAL decodes without any of
its metadata — and holds each message to that identity and the grid.
A forecast’s run is the messages’ reference time and each frame the end of
its six-hour interval. The water balance has no cycle: --start names
the run, and each message is valid at its own validity date or, where the
store wrote no real date, six hours after the previous one from the start.
Frames are kept on the source’s axis, f006 … --hours (120 by default).
A cell off the rivers is the GRIB’s bitmap; eccodes would hand it back as
the message’s missingValue, 9999, which a large river’s discharge
reaches, so the reader sets missingValue to the series fill −9999
(EFAS_SERIES_FILL) first. Beside the discharge it derives two
fields, stamped producer_id = xue, producer_version = 1
(PRODUCER_VERSION): the return-period class disrp of each frame
against EFAS v5.1’s flood thresholds
(flood_threshold_efas_v5.1_rl_{1.5,2.0,5.0,20.0}.nc from the CEMS
auxiliary data page, --thresholds is their directory) — 1 below the
1.5-year level, then 2, 3, 4, 5 at or above the 1.5-, 2-, 5- and 20-year
levels — evaluated, as EFAS evaluates it, only where the upstream area
exceeds 50 km² and the 1.5-year level 1 m³/s, the fill elsewhere; and the
upstream area upstream from the v5 static map (ec_upArea, m² with
no unit attribute, written in km²), the same plane on every frame so a
viewer reads it at any frame and the delta codec makes the repeats nearly
free. It writes <model>.<run>.<variable>.nc, one CF series per variable
in write_series’s shape, so both encoders take the series-file path
unchanged. The whole grid by default (a 120 h HRES run is 159 MB of
dis06, 36 MB of disrp and 368 MB of upstream); --bbox keeps only
the cells whose centres lie inside, which the converter accepts because a
series-file build takes its grid from the file and holds it to
production_grid only when a complete run is required. The identities are
dis06 1/0/7 on surface 1 with typeOfStatisticalProcessing: 0
(statistical_processes), log codebook (0.1 m³/s trace, 10 knee,
100 000 top); disrp 1/192/1 under producer xue, a class codebook 0–5
whose code 0 is “not evaluated”;
upstream 1/192/2 under producer xue, log codebook (1 km² trace, 100
knee, 10⁷ top) — pinned by the registry snapshots. The series carry
no NaN: every series declares _FillValue −9999 and every river
variable names it as its one fill_values entry with value_range[0] 0,
so both encoders fold it to the codebook bottom twice over, through the
file’s declared fill (observation._plane_source) and the registry’s
(binconvert._fill_missing), as the soil layers’ 9999 is folded to “no
soil”: no river is zero discharge and zero area, and an unevaluated cell
class 0, apart from every class. No ladder: a case
is a box of a few thousand cells. The STAC prose carries the CEMS-FLOODS
licence, the credit “Contains modified Copernicus Emergency Management
Service information 2024” and the licence’s caveat that EFAS data are for
information only and do not constitute a flood warning.
tests/test_efas.py.
era5. ECMWF’s ERA5 reanalysis for the Copernicus Climate Change
Service (ERA5 / reanalysis-single-levels): what the weather was, hourly
on the 0.25° regular grid, for a case that should show the observed
situation rather than one forecast run. A reanalysis has no cycle and the
Climate Data Store releases a day about five days late (ERA5T, replaced by
the final ERA5 two to three months later), so there is no live feed:
as for efaswb, a window is named by its first hour (--start, any hour,
cycle_hours 1), and the axis is hourly from F0, every hour an analysis,
to at most 1,440 hours (sixty days), so one case can hold a whole
episode that lasts weeks. The xue era5-series tool (xuebuild/era5/, the
era5 dependency group: cdsapi and netCDF4, uv sync --group era5 --inexact) asks the store for reanalysis-era5-single-levels in NetCDF
over the --bbox padded by a cell (whole days; the key is CDSAPI_KEY or
the key: line of ~/.cdsapirc, which one Copernicus account shares
across the CDS and EWDS) and saves the answer beside the series, or reads
one given with --input. The store sends a zip of one file per step type
when a request mixes them: data_stream-oper_stepType-instant.nc (t2m,
d2m, u10, v10) and …-max.nc (fg10), all on valid_time in
seconds since 1970 with latitudes north first. The tool holds every field
to the 0.25° grid, keeps the hours of the window and the cells whose
centres lie in the box, turns the two temperatures from kelvin into degrees
Celsius and writes era5.<start>.<variable>.nc in write_series’s shape,
so both encoders take the series-file path unchanged and learn nothing
ERA5. fg10 is the 3 s gust maximum over the hour ending at the frame
(“since previous post-processing”, hourly in ERA5): published as gust
with typeOfStatisticalProcessing: 2, the way ECMWF’s open-data gust is.
No ladder: a case is a box of a few hundred cells. The STAC
prose carries CC-BY-4.0, the credit “Contains modified Copernicus Climate
Change Service information” and the dataset’s DOI as cite-as.
tests/test_era5.py.
cams. The Copernicus Atmosphere Monitoring Service’s global
atmospheric composition system at ECMWF (CAMS /
global-composition-analysis): the IFS with aerosol and chemistry,
assimilating satellite aerosol optical depth and emitting fires from GFAS,
on the 0.4° regular grid, for a case that should show where smoke or dust
was rather than where one forecast run sent it. It publishes
GEFS-Aerosols’ own quantities (aod, aodorg, pm25), so the shell and
both encoders know them already; CAMS’s organic matter optical depth is
the component aodorg names. The Atmosphere Data Store holds the system’s
analyses and forecasts from 2015 (cams-global-atmospheric-composition-forecasts)
and no reanalysis reaches the present (EAC4 trails by a year or more), so
the tool asks for every 00Z and 12Z cycle at +0, +3, +6 and +9 h: the
frames run back to back every three hours, each the newest word the
system had at its valid time, and where two cycles reach the same hour the
shorter lead is kept. No live feed, as for era5: a window is named by
its first hour (--start, any 3 h mark, cycle_hours 3) and runs to at
most 1,440 hours. xue cams-series (xuebuild/cams/, the era5
dependency group; the same account key as the CDS, but the ADS’s own terms
must be accepted once on its site) asks for the window as one date range
over the --bbox padded by a cell, saves the store’s netcdf_zip beside
the series, or reads one given with --input. The store’s data_sfc.nc
lays every field out (forecast_period, forecast_reference_time, latitude,
longitude), latitudes north first, coordinates with float noise the tool
rounds off; PM2.5 comes in kg m**-3 and is written in µg/m³, the optical
depths as 1, and the series reuse ERA5’s Window and write_series.
The codebooks are GEFS-Aerosols’ (optical depth to 5, PM2.5 to
1000 µg/m³), so the core of a dense plume is drawn at the top of the scale.
No ladder. The STAC prose carries CC-BY-4.0, the credit
“Contains modified Copernicus Atmosphere Monitoring Service information”
and the dataset’s DOI as cite-as. tests/test_cams.py.
Observations
mrms. Frames listed off the bucket (fetch.py::mrms_window_frames: a
slot is kept only when every product has it) and re-keyed onto the window’s
axis (discover.py::snap_observation_frames,
mirrored in convert.rs). Records match under cref / prate through
RecordAlternates for the MRMS-local discipline 209 (the template-mrms
rule in their gdal_rules), and under rqi through its own MRMS-local
identity, as the volume’s levels do;
the -999 / -99 / -3 / -1 sentinels are fill_values. The quality
index is stamped on the mark like the rate, so it shares the composite’s
slots; its codebook starts a tenth below 0 so the filled no-coverage cells
are a code of their own. downsample factor
2; MRMS writes its last coordinate short, hence the step snap. The
workflow’s --hours 4 covers three whole hours plus the hour in progress. pickBundleVariant scales the needed width by the bundle’s
longitude span, so a regional grid can take its half tier zoomed out.
mrms3d. The same mosaic’s reflectivity on its 33 constant-altitude
levels (REFLECTIVITY_LEVELS_M, 500 m to 19 km MSL), each a product of its
own on the bucket and an id of its own (refl<metres>), published as one
refl3d bundle (a volume in bundles.py, after the composites in
manifest order; no poster). The levels are scanned every two
minutes and published every ten: SourceSpec.object_cadence_seconds (120)
is the bucket’s interval, cadence_seconds (600) the axis’s, and
fetch.py::mrms_object_slot snaps an object down to the former and keeps it
only on a multiple of the latter. A frame is therefore the scan stamped in
[mark, mark + 120 s), every level from that one scan, and a mark any level
lacks is a gap; the window listing, the live slot and the completeness check
all go through it (both sources are the noaa-mrms feed, and exactly the
sources SourceSpec.mrms marks).
The levels share one GRIB element, so the template-mrms rule compares the
level too (template 4.0’s assembled surface, or the <metres>-GPML short
name);
the identity written is the MRMS-local 209/9/0 on surface 102, since no WMO
parameter names a reflectivity on an altitude surface. Codebooks and the
RAW predictor are cref’s. Thinned five to one by block maximum onto 0.05°
(1400 x 700, tile 50). A full-resolution frame is about 26 MB of GRIB and
33 planes of 7000 x 3500: the native encoder reads and thins one band at a
time, while the Python reference holds them all (fine on crop fixtures,
gigabytes on a real frame), which is why its workflow pins native.
jma. The JMA precipitation nowcast over Japan. The fetch is the
jma-radar tool (xuebuild/jmacli.py: python -m jma_radar window --json,
or XUE_JMA_RADAR), which reads targetTimes_N1.json (the last three hours
of five-minute analyses), decodes the palette tiles and writes one series
per window at 0.005°, the finest grid the zoom-8 tiles support (constants
beside fetch.py::_fetch_jma_run).
The agency publishes intensity classes, not dBZ, so the source ships prate
alone at each class’s representative rate (all nine distinct codes).
hkonowcast. The Hong Kong Observatory’s gridded rainfall nowcast,
Gridded_rainfall_nowcast.csv on DATA.GOV.HK (xuebuild/hkonowcast.py):
one CSV of about 2.7 MB holding the newest issue alone, replaced every
twelve minutes or so and some ten minutes after the issue time, with no
listing and no archive. The live slot is a 512-byte Range read of its head
(the first row names the issue); the fetch reads the whole file and refuses
anything but one issue, four accumulations ending exactly 30, 60, 90 and
120 minutes after it, and every point of each once. Times are Hong Kong
time (UTC+8) in the file and UTC everywhere after. The 121 × 121 points are
evenly spaced in spherical Mercator at the longitude step (0.01946°), so
their latitude spacing shrinks northwards from 0.0181° to 0.0178° and a
regular latitude axis through the end rows misses the middle ones by up to
a quarter of a row. The series path reads only regular latitude/longitude
grids and leaves projections to the fetch, so the fetch samples the points
onto 0.019° × 0.018° (whole thousandths, which grid.snap_regional_steps
recognises, so both encoders read the same doubles) by nearest point along
each axis: every row is its own point, three columns in 124 repeat one. An
accumulation becomes the mean rate over its half hour (millimetres times
two, mm/h; statistical_processes marks prate a mean). The series is
written by cmadust.write_series with time in hours from the issue, which
half hours keep exact. A window is the issue alone, published under the
hour its first frame falls in (HkoNowcast.window_start; a three-hour
window reaches the last frame from any issue minute), so every frame lies
ahead of the clock and the shell reads it as a nowcast (leadsClock).
Issues land on twelve-minute marks, so valid times sit on six-minute ones,
the cadence_seconds; the fetch refuses one off them rather than snap it.
A round is all-new frames, so neither a frame cache nor segments save
anything, and only the run the newest issue falls under can be fetched.
cma. The CMA level-3 composite reflectivity mosaic over China, read out
of an archive rather than decoded live. A private sync job keeps the
six-minute mosaics as one Zarr v3 store per UTC day (240-slot time axis
plus slot_status). Never name that job’s repository or bucket in this
repo, its docs or published metadata; the archive is named only by
XUE_CMA_ARCHIVE (no default; an s3:// prefix read with the R2_*
credentials, or a local directory; it must be the prefix above the product
directory). xuebuild/cmaarchive.py reads it with zarr-python over s3fs
(the cma dependency group, imported nowhere else) and writes the NetCDF
series the observation ingest reads. Grid: the portal’s zoom-5 plate carrée tiles
(CMA_ZOOM, 0.0439°, 1792 × 1024; the power-of-two step passes the snap
untouched). No frame cache. The portal is 15–20 min late and the archive
syncs every 10 min, so the live window ends 20–30 min behind real time. A
showcase case names a window by run, or a local file by dataset. The id
was radar; the manifest identity CMA-RADAR and its cases are unchanged.
cwa. The Central Weather Administration’s composite reflectivity over
Taiwan, dataset O-A0059-001 (xuebuild/cwaradar.py). The agency serves
its open data behind an API key on opendata.cwa.gov.tw and the same files
anonymously on its S3 bucket cwaopendata (ap-northeast-1); the source
reads the bucket. Observation/O-A0059-001.json is the newest mosaic
alone, but history/Observation/ keeps every one of the last two weeks or
so, an XML document of about 9 MB per ten-minute slot named
<YYYYMMDDHHMM>compref_mosaic.xml in Taiwan time, written some seven
minutes after its time, with no gaps (two weeks checked on 2026-11-27).
Nothing is listed: a slot’s path is built from its time
(cwaradar.history_url), and a 404 is a slot not written yet or aged out.
The live slot is found by HEAD requests on the marks at and before the
clock, newest first (normally one or two). The fetch walks the window’s
slots, GETs each the frame cache lacks, refuses a document off the
published grid (check_grid), short of points or under another slot’s
path, and keeps each as one int16 NetCDF of about 50 KB under
cwa-frames/cref/, mirrored on the bucket, so a round downloads only the
newest slot or the ones a skipped round left; the window then starts by the
plain rule. Values are dBZ in scientific notation; -99 (no echo) and
-999 (no coverage or removed by quality control) both become NaN, the
codebook bottom, as the CMA series writes missing. The grid is 921 × 881
points at 0.0125° on TWD67, the product’s stated datum: the WGS84 positions
of the 2,576 stations in O-A0001/O-A0002/O-A0003 (the station tables
give both) lie 0.0081° east and 0.0018° south of their TWD67 ones, standard
deviations 0.0005° and 0.0009°, so the fetch moves the axes by that one
offset (DATUM_SHIFT) and resamples nothing. The axes are whole
ten-thousandths divided out, and GDAL reads the 0.0125° step back exact; it
is neither a whole thousandth nor an arc-minute, so the snap leaves it
alone. The cron runs every five minutes, twice the mosaic’s cadence, so a
new mosaic is published soon after it lands; a round GitHub drops costs
nothing, the next one fetches what it missed. Needs the cwa dependency
group.
aurora. NOAA SWPC OVATION, the percent chance aurora is visible
overhead, on a 1° global grid. The feed carries only the newest grid, so
each round adds it to the frame cache (xuebuild/aurora.py, one NetCDF per
five-minute slot) and _fetch_aurora_run assembles the cached frames. A cold cache cannot reach a whole window
back, so observation_window_start anchors the window at the hour of the
earliest cached frame (the pointer requires the run time to equal the run
id); the window lengthens as the cache fills. Valid times lead the clock by
about ninety minutes. force never clears the cache (past grids cannot be
re-fetched). Needs the aurora dependency group.
Satellites
himawari, himawarijp, goeseast, goeswest and meteosat are
series-file observations whose fetch stage is xuebuild/satellite/;
registry, readers, projector, frame cache, producers, the Dust RGB and the
dust confidence are specified in ../satellite.md. What
the rest of the repo must keep in mind:
- The source id is the role (orbital slot); the spacecraft is the
bandblock on each variable (SourceSpec.bandsfromPlatform.bands). - The reference pipeline and every satellite workflow need a system GDAL
with
gdalwarpwhichever encoder converts: the wheel’s GDAL has no GeoTIFF driver. Workflows installgdal-binand thesatellitegroup. - A regional box is a source of its own.
himawarijpis thehimawariplatform withSourceSpec.regionset (24–46°N, 122–148°E) and a finergrid_step: the frames are warped onto the box, and the ISatSS reader fetches only the tiles whose footprint reaches it (ISatSSReader.tiles_covering). The frame cache is keyed by the source id (<source>-frames), so the box and the disk never share a frame; a full-disk source’s id is its platform’s role, so the disks’ cache directories kept their names.regionis mirrored insources.rs. - Meteosat is hourly. FCI scans every ten minutes, but EUMETSAT releases
only the cycle on each hour as Core data under CC-BY-4.0; the cycles
between are under a licence that does not allow this use. So
cadence_secondsis 3600 against the platform’s 600, the window is 24 h, and the attribution “Contains modified EUMETSAT Meteosat data” is required. It needs theEUMETSAT_CONSUMER_KEY/EUMETSAT_CONSUMER_SECRETsecrets (the workflow warns and builds nothing without them) andhdf5pluginfor FCI’s JPEG-LS filter. - Composites (
dustrgb,dustcf,zhouye,truecolor) are computed in the fetch stage by producers, not by the converter.bundle_input_idsasksProducer.inputs_for(platform), andconvert.rs::composite_input_idsmust answer the same per source (the Dust RGB dropsir112on FCI, the true colourvis051on the ABI). The registry knows a producer’s id (VariableSpec.producer_id), never its version, which comes from the series file’s stamp. Code 0 is no data in every gun. truecoloris Xue’s own recipe (TrueColorProducer, producer idxue): its version isproducers.TRUE_COLOR_VERSION, bumped by hand when a recipe constant changes, because a cached slot is recomposed when the version differs and must not be on every package release. Its inputs are the solar bands for the day side, which cost a round some 500–600 MB of downloads over the windows’ 140 (the 0.5 km red band alone is 200–430 MB a slot), andir039andir104for the night side, which every satellite source fetches already. Reflectance frames are warped as block means (fetch.resampling_for), brightness temperatures bilinearly. The night constants are one set for every imager, so thegeomosaic’s seams do not show after dark; only the day side’s green differs by imager.dustcfships on the three NOAA-redistributed disks only (Meteosat’s hourly cycle is not published); its ancillaries needANCILLARY=truein the rounds script. The CAMEL months are staged byxuebuild/satellite/staging.py(make stage-ancillarythenmake push-r2-ancillary;stage-ancillary.ymlon the 25th and the 1st, thestaginggroup, Earthdata credentials in~/.netrc, no GDAL). Its region table (one row,global: the whole granule) decides where the confidence is defined over land, which is every disk’s land; a bad subset is fixed by restaging, which overwrites.dustcf(DEBRA) andzhouye(ZHOUYE, shachen ≥ 0.4.0) are two bundles from one producer:Producer.bundle_idslists both,PRODUCERSkeys both to the same object, and the fetch runs it once. A source listing only one still gets both frames cached; the converter reads what is listed.- Frames are kept
FRAMES_KEEP_HOURS(8; 26 on Meteosat): a day of twenty variables on a NOAA disk is ~10.5 GB. - They ship two lower rungs (
variant_factors(2, 4)): a 3000 × 3000 plane does not fit the shell’s cell budget zoomed out. No eighth: it cost a quarter of a disk’s bucket objects; the coarsest zoom plays the quarter. - The registry snapshots (
rust/xue/registry.json,web/src/data/registry.ts) pin variables and bundles across the three implementations.
Adding a source
Most recent additions to copy from: aurora (an observation) and cfs (a
forecast).
- Registry. A
SourceSpecinxuebuild/sources.py(axis or window, cadence, inputs, published and core bundles, grid, tile, ladder, fetch concurrency). New variables inxuebuild/variables.py— the identity plus, where the defaults do not fit, theconversion,gdal_rules,predictor,decimationandcompanionsfields — and their codebooks inxuebuild/quantize.pyfor every profile; a new bundle that is not a plain scalar inxuebuild/bundles.py. Regeneraterust/xue/registry.json, and a new family’s fixture undertests/fixtures/. - Fetch. The source’s
feed(andpacking="ccsds"if its records arrive CCSDS packed; see “Feeds” and “Packing” above). On a known service, name its family. A new service is a fetcher inxuebuild/feeds.pyregistered inFEEDS— frame URLs or the fetch tool, the completeness check, and for an observation the latest-slot resolver — over functions inxuebuild/fetch.py. An external tool stays a subprocess (*cli.py) and an optional dependency goes in its ownpyproject.tomlgroup. Add the model to the CLI help inxuebuild/cli.py. - Native encoder. It has no table of its own: it reads the
regenerated
rust/xue/registry.json. Rust changes only for a rule the closed sets lack (units.rs,inspect.rs,convert.rs,observation.rs), plus a line indocs/registry.mdanddocs/encoder.md; see theadd-sourceskill. - Tests. A small crop fixture (
tests/fixtures/<id>.*, described intests/fixtures/README.md) andtests/test_<id>.pyrunning it through both encoders. - STAC. Licence and provider prose in the
sourcesentry ofxuebuild/stac_prose.json(tests/test_stac.pyholds it to the registry). - Shell. A row in
FORECAST_MODELS(and theForecastModelIdunion) inweb/src/data/manifest.ts, withdomain/regionfor a regional grid; any new quantity inweb/src/data/variables.ts,identity.ts,palettes.ts; copy in all eleven locales (en.tsfirst); the static metadata inweb/index.html;tests/web/manifest.test.ts. Widen any manifest limit the source exceeds (asforecastHourswas for CFS) in all three validators anddocs/bundle.md. - Workflow.
publish-<id>.yml: a forecast callspublish.ymland is added to its model allow-list; an observation copies the nearest rounds workflow (publish-jma.ymlshape) withFRAME_CACHEset if it caches frames and itsResolve the encoderstep onnative.knows_source.publish.ymlpins the native encoder, so a new forecast source publishes on schedule only once the wheel carries it. - Discovery and docs.
web/public/llms.txt, the README sources table (with its run badge), and this page. - Deploy order. Deploy the Pages shell before publishing any data:
an older
FORECAST_MODELSdoes not know the model id. Then release thexuepywheel carrying the source so the native path (and the pinned forecast workflows) can take it.
5 - Point products
Seven products sit beside the gridded runs: tropical cyclone tracks
(xuebuild/tc/), airport METAR/TAF (xuebuild/airport/), radiosonde
soundings (xuebuild/sounding/), surface stations (xuebuild/synop/),
air-quality stations (xuebuild/aq/), weather warnings
(xuebuild/alerts/) and active fires (xuebuild/fire/). Schemas are
normative in ../tc.md, ../airport.md,
../sounding.md, ../synop.md,
../aq.md, ../alerts.md and
../fire.md; STAC in ../stac.md.
Shared contract
- Pointer → index → payload.
latest-<product>.json(read no-cache) is the only mutable object; it names an immutable<product>.<issue>/index.json. Airport and sounding issues are two objects: the index and one JSONL (one line per station, sorted by id) whoseoffset/lengththe index rows carry, so a browser reads one station with one Range request and an analyst streams one file. The tc index names one<storm id>.jsonper system. A synop round has one JSONL and one stations file per network, so a network’s files stay the size of a network and a map loads only the networks it shows (aq has the same shape); an alerts round one JSONL per warning service, one warning per line, with area codes resolved against boundary sets published once per upstream release underalerts-areas/(PMTiles for drawing, a.bbox.jsonof every code’s box that gives an area-coded warning its index box) and a monthly archive underalerts/archive/that the publisher feeds from a journal in its state directory, since the rounds last three hours; a fire round one JSONL per sensor with one line per UTC hour, so the index addresses hours rather than stations. - One object per issue, never per station: many small files hurt bucket traversal and analysis.
- The previous issue is input.
make live-<product>-indexruns before each build: tc carries identities forward, airport, synop and fire merge history, sounding carries forward stations without a new ascent (after checking the JSONL’s CRC32). - Sources fail alone into
sources[]; the pointer is withheld only when nothing contributed, so the last good issue stays live. - One skeleton, in
xuebuild/pointproduct.py. A minute-round product (airport, synop, aq, alerts, fire, nexrad) bindsRoundProduct(PRODUCT, <its error class>, cadence_minutes=…, archived=…)in itsschema.pyand re-exports its methods under the module-level names (parse_round,floor_round,round_directory,raw_directory,pointer_directories,local_round_directory,build_pointer,validate_pointer, and the_time/_number/_integer/_optional_*/_crc_fileprimitives). Fire and nexrad are unarchived: flat round directories, a whole-hour cadence for fire. The hourly-issue twin (tc, sounding) bindsIssueProduct. A product’sschema.pykeeps only its line validators and constants.published_sourceis the one way aSourceStatusenters an index, andxuebuild/http.pythe one paced GET (custom User-Agent, 404 and, withmodified_since, 304 as answers;compressed=Truefor a gzip-on-the-wire service). Network tables (Network) and station metadata (StationMeta) stay per product: their fields differ. - Shapes are JSON Schemas. Each file a product publishes has one
draft 2020-12 schema under
docs/schemas/(pointer.schema.jsonis every product’s pointer), referenced from its spec as the normative shape. The three implementations meet it differently:tests/test_schemas.pyholds every golden to it with the referencejsonschema(adevgroup dependency; the publishing image syncs--no-dev), so the writers’schema.pyvalidators keep only what a schema cannot say — order, byte spans, sums, file names, the version gate — and refuse a file without the schema’s shape throughpointproduct.shaped(fire, aq and alerts; tc, sounding, airport and synop still check the shapes inschema.pytoo); the shell’s checks are generated plain TypeScript (make schemas,web/tooling/schemagen.ts→web/src/schema/generated/, held to a fresh run bytests/web/schemagen.test.ts), and a product’sschema.tsruns its version gate, the generated check, then the same invariants; the API worker reads the same goldens in its tests, and each of its readers ties the fields and columns it takes by name to the committed schema (include_str!). Positional rows name their columns in acolumnsarray (airport and alerts indexes, aq and synop stations files, the alerts archive’s month indexes), which their readers take by name with a positional fallback for files from before it. The generator implements a closed subset of the vocabulary (noif, and a point product’s objects stay open: a reader admits a field a later revision adds) and refuses a schema that leaves it. The grid contracts (the manifest, bundle metadata, a store’s documents) use the same harness; their schemas$refone another by file name, and bundle metadata closes the blocksbundle.mddeclares closed. So do the tc archive (docs/tc.md§8–9) and the alerts archive (docs/alerts.md§12), whose goldenstests/test_schemas.pybuilds with the archive and score writers, the alerts one folded from the alerts goldens’ rounds. - Parsers import no other parser and convert to SI themselves;
build.pyis the only place sources meet;schema.pyvalidates on write. - Goldens.
tests/fixtures/<product>/is a fetched issue (two rounds for airport),expected/the output including STAC Items, regenerated bytests/prepare_<product>_golden.py. tc and sounding needbufr_dump. - Upload payload → index → pointer (
make upload-r2-<product>);prune-r2-<product>trims old issues. - Layout. tc and sounding file an issue under its UTC day,
<product>/YYYY/MM/DD/<product>.<hour>/(pointproduct.archive_directory,point_dirinmk/products.mk), so retention can grow to years without a flat root of thousands of prefixes; airport, synop, aq and alerts do the same with their minute rounds,<product>/YYYY/MM/DD/<product>.<round>/(pointproduct.archive_round_directory). Every validator, the API, the shell’s pointer schemas, the STAC Item and the prune accept both layouts, nested and the flat<product>.<id>/issues were published under before. Raw fetch directories stay flat underdata/raw/.
Tropical cyclones
Parsers: atcf.py, tcw.py, bufrtracks.py, ibtracs.py → track.py.
identity.py keys on the ATCF id; invests and model-found systems get
x-<basin>-<hour>-<n> ids carried forward from the previous index by alias
and proximity. web/src/products/tc/agencies.ts reads registry.py’s agency
table out of the shell’s registry (web/src/data/registry.ts).
Airports
A round is a UTC minute floored to ten. The fetch reads the Aviation
Weather Center’s three cache files and must send the custom User-Agent and
stay under a hundred requests a minute; the station table is refetched at
most daily with If-Modified-Since. A value outside the contract’s ranges
is written null, not raised. history.jsonl holds each station’s last 24 h
of METARs and current TAF; each round merges new reports by (station, time),
newest winning, drops what is older than 24 h, and removes stations whose
window empties. The pointer is withheld only when both METARs and TAFs
failed. AIRPORT_KEEP rounds are kept.
Surface stations
- One product, many networks.
networks.pyis a fixed tuple; each network is an adapter module withfetch(raw_root, round, since, …)andread(raw_root, statuses)that converts its own format into the elements ofdocs/synop.md§2. Adding a network touches that tuple, a new module, adocs/synop.md§9 subsection, a fixture and the STAC prose — not the schema and not the shell. sinceis the network’slatestin the previous index, so a round asks only for what is new and a gap refills as far as the network keeps data.- The stations files’ element values are each element’s newest non-null value within the hour (accumulations only at the newest time): some elements arrive less often than the station reports.
- A network whose report for one time arrives in pieces (DWD’s templates
and batches, HKO’s one file per element) sets
Network.partial, and the merge lays new values over old element by element instead of replacing the time whole. - AMeDAS reads the agency’s map-page JSON (no API, no SLA); the quality
rule and the 16-point wind code come from that page’s own script. Its
codes ride with the values under
station.QC_KEY(not an element key) through the merge whenNetwork.quality_codesis set; a line writes aqccolumn only where the codes say more than the values, and the next round reconstructs the omitted ones from the values. - Each adapter’s
readstoressha256of the bytes it read in its source’s status; the index addselementTableandbuilder(XUE_BUILD_REVISION, set by the workflow, null offline). - DWD is BUFR through
bufr_dump -j f; values are picked by key plus thetimePeriod/ sensor height in force, never by template position, since one batch mixes four templates. HKO’s files name stations only in English, sohko_stations.json(built from the Observatory’s station page plus the rain and tide gauges its feeds name, aliases by hand) places them. Its regional CSVs, hourly rainfall and tide file are three sources of one network (hko.FEEDS), so one failing does not fail the others.
Active fires
- FIRMS publishes no API worth the name for a whole-world feed; the
last-24-hour CSVs (
<product>/csv/*_Global_24h.csv, no key) are the input. The 7-day ones are 35–60 MB each and timed out once in testing, so the window is ours: each round merges the 24 h files onto the previous round’s sensor files, keyed by (time, lat, lon) in the integer encoding, and drops what is older than seven days. sensors.pyis two fixed tuples: the FIRMS files (sources) and the sensors they feed. MODIS is one file for Terra and Aqua, split by thesatellitecolumn; a row whose satellite is not the file’s is rejected.firms.pyreads numbers asDecimalso a 5-place coordinate lands on the same 1e-4 integer everywhere. MODIS confidence is classed with FIRMS’s own thresholds (30, 80).- The previous sensor file is used only when its CRC32 matches the previous index; a mismatch restarts that sensor from the 24 h file.
- Measured 2026-10-12: about 180 000 detections a day (VIIRS 55–58 k per satellite, MODIS 9.5 k), so the seven-day files are about 30 MB in total (9.5 MB gzipped) and the index a few tens of kilobytes.
Single-site radar
xuebuild/nexrad/:level3.pyreads N0B / N0G (bzip2 packet 16) itself — no MetPy — and refuses any codebook but the spec’s;store.pywrites the polar store (docs/zarr-profile.md, “Polar store”);build.pybuilds a round from the sweeps newer than the window’s newest per site and product, andcatch_upfills a late or missed schedule with ordinary five-minute rounds, so a site’s inner chunk never holds more than one round’s sweeps.- The index is the window manifest. It is rewritten every round from the previous one; the stores never are.
- Cases (
showcase/nexrad-cases/*.json,xue nexrad-case) take the same rounds over a past interval but write one window store per product (build_case): a closed interval needs no per-round directories, and a store per round per product was ~35 objects a round.replaystill builds the live layout over a past interval, for the golden. - Level 3 N0B / N0G exist from 2022-02 on; earlier events have N0Q / N0U only.
- The live view publishes nothing (
docs/nexrad.md§7): the shell lists and reads the source bucket itself, andrust/xue/src/level3.rsportslevel3.pyfor it. A change to the reader changes both, andtests/prepare_nexrad_golden.pyre-pinsexpected/level3.json.xue nexrad-sitesrewrites the shell’s site table.
Soundings
The fetch lists the two GTS→WIS2 gateway directories of the public
wis2globalcache bucket and downloads only objects newer than the previous
index’s per-gateway watermark. bufr.py decodes with bufr_dump (one
Sounding per subset, -32768 missing, nominal time from <ddhhmm>) and
thins each ascent to the classical TEMP set (THINNING_RATIO, keeping the
original count as reported); derive.py runs in a fixed operation order.
Identity is the WMO number; one sounding survives per station-hour, by
temperatures, then levels, then the latest (a correction). Most centres
that still send TEMP send it in parts, or in halves with the lower one
under IUK; the headings do not say which is which, so content_part
tells them by their levels and merge_parts puts them together. What the
previous issue published is read back as a Sounding (_sounding_of) and
takes part, which is how a part an hour late is merged. The workflow needs neither GDAL nor
the wheel. TEMP BUFR names no station, so stations.json (WMO number →
name, cleaned once from IGRA2’s station list and checked in) names them; a
station that starts reporting later stays null until the table is
rebuilt.
tgftp.py decodes the text TEMP of the countries the BUFR sources lack
(COUNTRIES: Canada and India) into the same per-part Sounding, merged by
the same rule. A text report has no position, so a country is added with its
stations in positions.json. Canada’s native BUFR is on the MSC Datamart,
whose usage policy forbids polling directory listings and asks for its AMQPS
queue, which an hourly job does not keep.
In the shell
Marks (web/src/products/tc/, web/src/products/stations/) take no session, fetch nothing
per frame and never gate the playhead; a showcase case hides them, and
main.ts polls their pointers with the runs.
products/stations/fetch.tsresolves a 404 to null (a data root without the product costs nothing) and reads one station withRange: bytes=<offset>-<offset+length-1>; a 206 must answer exactly that span, a 200 is sliced at the same offsets.- The playhead only sets a paint expression fading stations observed more than 3 h (airports), 2 h (surface stations) or 15 h (soundings) away: paint properties, no feature rebuild.
- Below zoom 6 only airports with a TAF are drawn; soundings are hollow when the ascent never reached 500 hPa.
- Surface stations thin by
rank(principal always, automatic from zoom 5, gauges from 7) and are filled by their current temperature. - Active fires (
web/src/products/fire/) are not stations but ride the same switch and poll. They show the 24 h ending at the playhead, read per sensor as one range over consecutive hour lines with a margin, so a playing run does not refetch; age colour and the after-playhead filter are expressions, and a clustered GeoJSON source keeps the world view cheap. - Air-quality stations (
web/src/products/aq/) are station marks on the same layers (products/stations/layers.ts), filled on fixed PM2.5 steps in µg/m³ — never an index, which AirNow’s terms forbid deriving — and hollow without PM2.5; they fade 3 h from the playhead. Every network’s stations file loads with the index; the card reads the station’s window by one range request when it opens, for the day’s range and the network’s own spelling of the name, and says “preliminary” for such networks. - Warnings (
web/src/products/alerts/) are areas, not marks, and a snapshot of now: the playhead never touches them. The index is polled with the rest; the network files (one GET each) are read only while the tile is pressed, once per round. A polygon warning is a feature of one GeoJSON source; an area-coded one is drawn from its boundary set through thepmtiles://protocol (thepmtilespackage’s, registered inproducts/alerts/pmtiles.ts), one vector source per set and a fill and an outline layer per set layer, filtered to the codes in force and coloured by the highest level on each code. NWS fire weather events go to thefirelayer, the rest to the others. A MeteoAlarm warning can have both a polygon and codes, for different parts of its area, and both are drawn. A click inside an area opens the card of every warning there, each with its issue time, and a second click on the same warnings closes it and pins the probe; JMA’s card carries the boundary set’s 出典 and 加工 lines and folds the survey notice, CMA’s and HKO’s (both drawn bycma-areas) carry the Amap outline credit, CWA’s the MOI town boundaries’ credit, and MeteoAlarm’s links its credit to meteoalarm.org and carries the disclaimer its terms require. - URL state:
?tc=<id>|off,?tcagency=,?tcmodel=,?tcmembers=,?stations=snd,apt,syn,fire,aq,alerts|off(link only, never stored).
In the probe panel
A pin reads the station products whether or not their tiles are pressed:
products/stations/nearest.ts takes the nearest ascent within 150 km, airport
within 40 km, up to six surface stations within 20 km, and the nearest
air-quality station with PM2.5 within 20 km, whose value is a chip beside
the airport’s. The warnings are read off the rendered areas, so the
highest one under the pin is a chip only while the warnings are drawn.
- Skew-T (
web/src/products/sounding/): behind a disclosure, which on a wide window opens a card beside the map and on a narrow one is a page of the panel (frontend.md); open on its own only above phone width, with the sounding marks on. Opening it fetches the station’s line and opens probe sessions for the run’s isobarictmp/rh/ wind bundles (products/sounding/model.ts,probeBundleIds). The model column is read at the frame nearest the ascent’s nominal time, within 12 h, else the legend says there is none; from 6 h the legend warns that the gap is weather as much as error, and levels under the station’s own surface pressure are dropped (clipBelowSurface). One job per module:skewt.tsdraws and owns no word and no unit;analysis.tsis arithmetic on aProfile(the mixed-layer parcel with LFC, EL, CAPE and CIN on plain temperature, so the number is the area shaded; moist layers; inversions; the strongest wind; andprecipitationReading, what those add up to for precipitation — whether a moist layer with its base within 3 km of the ground is 2 km thick, whether the air under it is dry enough to evaporate part of what falls, and the phase at the ground by the temperatures under the cloud top: snow, a mixture under less than 500 m of air above freezing, freezing rain or ice pellets under a warm layer over a frozen surface. These are conditions, not a forecast: a profile holds no lift, and the summary’s sentences say “if anything falls”. Depths are measured from a ground whose height is filled in by the hypsometric equation where the surface level was filed without one, and an ascent filed without any height at all gets them fromheights.ts: up from the station’s elevation by virtual temperature, with the derived heights, where the lowest level is flagged as the surface — a reading of the viewer’s, the product publishes what was reported);section.tsowns the DOM beside the chart — the reading under the pointer, the legend, a summary in sentences (the precipitation lines among them, after the line on stability, and none where the profile is dry and stable), the indices and a folded guide — and formats everything in the viewer’s units. The plot’s bottom edge follows a high station’s surface, and the skew gives way in a box taller than it is wide (fittedSkew) so the trace cannot leave through the side. An isotherm is named at its foot on the bottom scale and again where it leaves through the top: the skew brings every isotherm colder than the bottom-left corner in through the left-hand edge, and above the middle of the chart those are the ones the ascent runs along.SkewTInkis read from--skewt-*at every draw so a theme switch repaints in place. The finished chart is kept, and the pointer’s crosshair (drawSkewTCursor) repaints over that copy, so hovering never re-integrates the pseudoadiabats. The full chart is the section’s own body moved into the sheet (enterSheet/leaveSheet), not a second chart; the skew-T / emagram switch lives there and only changes the skew and the temperature range. - Model column as the profile (
products/sounding/column.ts,model.ts::modelColumnPossible): on a run with the ground fields and at least five levels of temperature and height, three of them with humidity, the section shows on every pin, and where an ascent is near a switch chooses between the two. The column is read at the playhead, so it is a forecast sounding that moves with the transport; the ascent keeps its own time. Its lowest point is the 2 m / 10 m fields at a surface pressure read off the levels’ heights, the sea-level pressure andorog, and levels under it are dropped. It is drawn with its levels marked and analysed as what it is: the 2 m air is the parcel, no inversion is looked for, nothing is shaded, and CAPE / CIN are the run’s own fields. It stays folded on a pin with no ascent until the viewer opens it, because opening it reads four bundles per level. - Airport (
products/stations/observations.ts): each METAR is a mark at its own lead seconds (axisPosition), the TAF atafrow of bands hatched forTEMPO/PROB, and readouts gain the nearest report within 90 minutes. None of it moves the playhead. - Surface station (
products/stations/synopobs.ts): the nearest candidate within 300 m of the DEM height under the pin (the nearest outright until the DEM answers) replaces the airport on the temperature, wind and pressure rows; its temperature goes on the terrain row when there is one. Its window is one range request, made the first time a render picks the station. The rows reach back only to the run’s first frame, so the whole window is also drawn under them (products/stations/obssection.ts, the cards’ charts fromproducts/stations/sparkline.ts).
6 - Frontend
The shell is a static Vite build of web/ (index.html, showcase.html,
compare.html, typhoon.html, metrics.html, api.html) over MapLibre
and WebGL2. Data layout:
delivery.md, ../zarr-profile.md.
Storms, soundings and airports: point-products.md.
web/src/wasm/ comes from make wasm; nothing typechecks without it.
Module map (web/src/)
Nothing but style.css sits at the top of web/src/; every module is in a
directory, and a new one goes into the directory of the layer or feature it
belongs to.
| Directory | What goes there |
|---|---|
app/ | The live viewer (index.html): the composition root main.ts, the page’s state, sessions, caches and polls, and the controllers of its own chrome (rail, legend, level row, field sheet, track, transport, data card). |
data/ | What the published data means, shared by every page: the manifest and pointer, the registry copy, identities and keys, the variable, level and chart tables, grids and domains, fetch helpers. |
decode/ | The decode channels: the .xue worker, the Zarr store reader (decode/zarr/), the column source, the first-frame poster. |
render/ | WebGL layers and what they draw with: the raster layer, contours and their labels, palettes, projection, tiles. |
derive/ | Fields computed in the shell from published planes (the setup, fire fields, lapse, thickness) and the controller that draws them. |
map/ | The basemap and the tools on it: ground and ink, relief, peaks, the view tile, the ruler; map/terrain/, map/shadow/, map/grid/ (coordinate grids). |
ui/ | Interface parts every page shares: sheets, cards, Escape, DOM helpers, formats and units, theme, time zone, the timeline and playback arithmetic; ui/i18n/ with its locales. |
features/ | The viewer’s features, one directory each, its arithmetic beside its controller (*view.ts): particles/, volume/, mosaic/, precipphase/, totals/, case/, probe/, export/, crosssection/ (the vertical section along a line, which the workbench borrows). |
products/ | The data the viewer reads beside the model runs, one directory each (index, marks or layer, cards, panels, schemas): radar/, river/, fire/, stations/, aq/, alerts/, tc/ (with the typhoon page, tc/typhoon.ts), sounding/, airports/, gibs/. |
pages/ | The other pages, each entry beside its parts: compare/, showcase/, metrics/, apiconsole/, workbench/ (the typhoon page is products/tc/typhoon.ts). |
site/ | Hostnames, site paths, page and dataset metadata. |
schema/ | Generated validators (web/tooling/schemagen.ts) and their helpers. |
| Module | Role |
|---|---|
app/main.ts | Composition root: sessions, slots, playback, rail, polling. Feature controllers are factories it wires up with their state as explicit Deps. What an open resets (teardown), how a run is found (openRun: a case, a mosaic or the live pointer, then the composition and the rail) and what committing a primary means (applyVariable) stay here; when they happen is primaryswitch.ts’s. |
app/pagestate.ts | PageState, what the page has loaded and is showing (the run, the primary session, the playhead, the case, the lifecycle counters and flags, among them switching while the primary swaps and resume, where the next open puts the playhead), as the one object main.ts owns and writes; the run poll writes resume too. A controller’s Deps.page is a Pick of the fields it reads, read at the point of use; ViewState stays what the visitor chose. |
app/loadstatus.ts | The page’s loading and error state (createLoadStatus): the status line, the body’s loading class and the data card’s busy flag, the error card, the transport, and the lock on the layer switches (rail, level row, field sheet, model rows) with its flag read by whatever builds a switch while a run opens. markLoading / markReady are what an open and a field switch share; the transport is enabled before playback starts, because the loop does not run on a disabled slider. |
app/rasterslot.ts | RasterSlot (a raster layer and the session, grid and planes it shows) and MosaicMember; makeSlot builds an empty one. |
app/levelrow.ts | The level row (createLevelRow): its groups for the composition on screen (the fill’s surfaces, statistics, the setup’s flow, the lines and ALONE, thickness) and the precipitation’s rate, window and range buttons, rebuilt on each change and scrolled to the press that rebuilt it. What a total does to the frames stays in totalsview.ts::setAccumulation. |
app/fieldsheet.ts | The field sheet behind the rail’s MORE tile (createFieldSheet): every field the run publishes as rows grouped like the variable table, the chart presets first and the bundles no tile stands for last. |
app/railview.ts | The variable rail (createRail): the field tiles the run ships and the one on screen, a generic tile for a field the shell has none for, the overlay and mark tiles’ pressed states, the density the tiles take to fit and the fade at a clipped end. |
app/legendview.ts | The headline and legend (createLegendView): the code, title and buffer title, the unit, ticks and bar or swatch key (a total’s, the setup’s, a fire field’s, a radar’s), the page meta, the dataset’s eyebrow and credits. variableUi and legendGradientFor read one session alone. |
app/session.ts | The VariableSession and DecodedFrame types the controllers share. |
app/sessions.ts | The session registry (createSessionRegistry): the run’s sessions by bundle id and the mosaic members’ by member and bundle, opening one (tier pick through the page’s policy, channel choice, whole-bundle download, identity) with concurrent opens of a bundle folded into one, stream progress routed by streamKey (kept when it beats registration), and ending sessions. Readers reach a session through drawable (never a pin’s series store session, which holds no frames) or resident (any session, for a point read or an identity check); the map itself is not exported. The channel handshake (channelHandshake) settles on ready and rejects on every other way a channel can end first (an error reply, the channel’s onerror, a minute without any message (HANDSHAKE_SILENCE_MS, restarted by each one), a page that moved on, or endRun, which aborts every handshake still pending), so load always ends a channel that never opened. Also the helpers that read one session alone (sessionOffsetForLead, sessionCoverage, the vector and composite fields). The channel binding stays in main.ts. |
app/planecache.ts | The decoded-plane (frame) cache (createPlaneCache): planes by cacheKey in LRU order under a byte budget sized to the primary’s frame, eviction that spares what the frame selection reports on screen (displayedKeys) and recycles a container’s buffers into its worker, and the windowed prefetch (sendPrefetchWindow) with its per-session memo. |
app/decodequeue.ts | The decode request queue (createDecodeQueue): requests in flight by id (one per key), the newest request held back at the inflight cap (twice the planes a frame of the view needs) with its tiles and sent when a slot frees (a plane lands, a request fails, a session is dropped), the key the primary frame waits on, landed planes filed into the plane cache, and the decode timings the stats graph reads. What a landed plane changes on screen, and which planes to ask for, are the frame selection’s (frameselection.ts). |
app/frameselection.ts | The frame selection (createFrameSelection): a primary frame goes on screen only once every plane it needs (the u/v pair, a composite’s guns) is decoded and covers the view (cachedFrame), otherwise the picture stays and the missing planes are asked for with the first as the queue’s desiredKey; a landing (frameLanded) shows only the frame asked for and restarts playback’s cadence in the same task; the overlays follow the frame on screen by lead time, hidden where their axis has no frame and kept while theirs decodes; the derived layers and the frames ahead of a playing playhead follow; displayedKeys for eviction; the blend between two frames and the packed wind planes it reuses (four held). main.ts keeps the readout, the marks and the sweep of the reaches and fires, and hoisted forwarders of the entry points for the controllers built before it. |
app/primaryswitch.ts | The primary session’s lifecycle (createPrimarySwitch): opening a run (initialize), switching the field (activateVariable) and the retier (scheduleRetier, retierPrimary). Each takes initializeSequence before its first await and drops its result once a newer open has bumped it, so an overtaken open neither commits, shows an error nor unlocks the switches; an open takes resume before that await too, so a resume goes to one open alone. The page is marked ready before the commit, the generation moves before the linked time or the resume places the playhead, and the transport is enabled before playback starts. A field switch clears switching in its finally and unlocks the switches only while it is current and the page ready. A retier is skipped while a field switches, coalesces requests made while it runs into one re-run, disposes the old session only once the registry holds the replacement under the id, and commits only while the primary is still the one it weighed. A refused live manifest or store reloads the tab once per manifest crc (reloadForNewerShell). main.ts passes in the teardown, openRun, the commit, the tier arithmetic (wantedTier) and what follows an open, and keeps hoisted forwarders of the entry points for the controllers and listeners built before it. |
app/stats.ts | The data card’s “stats for nerds” rows and decode graph, the debug copy and the map’s context menu (createStats). |
app/budget.ts | What a view may spend: the connection and device probes, the grid width a zoom can show, the cell budgets pickBundleVariant weighs a bundle’s, a volume’s and a mosaic’s tiers against, and the Zarr worker’s chunk budget. Pure apart from navigator; main.ts passes the view bounds. |
data/manifest.ts | Pointer/manifest validation, FORECAST_MODELS, bundle metadata, tier picks. |
data/identity.ts, data/sessionkeys.ts | Variable identity from the GRIB2 parameter block (and the band, aerosol, producer and ensemble blocks beside it); session-scoped keys. |
data/statistics.ts | An ensemble block folded into one statistic key (q75, mean, spread, p3:10:), which statistics chart as their quantity, the spread families, and the probe’s note. |
data/variables.ts, data/levels.ts, data/pressure.ts | Variable table; family registry; contour intervals. |
app/viewstate.ts, app/urlstate.ts, data/modelpaths.ts | ViewState; path, query and camera-hash parsing; the dataset ids, their spellings and the old-?model= mapping. |
decode/worker.ts, decode/zarr/ | The two decode channels (.xue, store). |
decode/columnsource.ts, decode/zarr/columns.ts | The run’s column store (columns in the manifest) as a pinned point reads it: decode/zarr/columns.ts reads the group once and a cell’s index and chunk per array on a hub worker, columnsource.ts serves per-bundle series from it as point sessions. A manifest without columns, or a failed open or read, leaves the per-bundle path as it was. |
data/gridmap.ts | The one parser of a bundle’s grid block and the one way between a point and a cell (gridMapFor, GridMap): regular, Gaussian and Lambert. See “Native grids” below. |
render/tiles.ts | Viewport to tile rectangles. |
render/layer.ts, features/particles/particles.ts, render/isolines.ts + render/labels.worker.ts | Raster layer, wind particles, contour labels. |
render/contourlabels.ts | The contour labels’ controller (createContourLabels): the labels worker, their two symbol layers, and when the lines on screen are traced again. |
render/projection.ts, map/terrain/terrain.ts, map/terrain/terrainprotocol.ts | Plane / globe projection and terrain draping for the custom layers; DEM readout; the mapterhorn:// tile protocol that goes past z12 only inside Mapterhorn’s regional archives (terraincoverage.ts, regenerated by scripts/build_terrain_coverage.py). |
map/viewcontrol.ts | The view tile under the zoom tile: globe and relief switches, reset north / tilt. |
map/peaks.ts | Named peaks over the 3D relief, from public/peaks.json. |
map/relief.ts | The altitude correction’s controller (createRelief): opens the run’s orog and the isobaric column for the view and hands the primary layer its LapseCorrection. |
map/terrain/terraincontours.ts | Elevation contour lines (?contours=on, the view tile’s switch): maplibre-contour traces isolines from the Terrarium tiles in a worker and serves them as vector tiles; a line and a label layer kept directly under the forecast anchor, inked per ground. |
map/grid/gridlayer.ts, map/grid/mgrs.ts, map/grid/gars.ts, map/grid/bng.ts, map/grid/coordinates.ts, map/mapprefs.ts | The coordinate grids (?grid=): MGRS and UTM (UTM/UPS, zone exceptions, 100 km letters), GARS, the British National Grid (OSGB36 by Helmert, good to a few metres) and parallels and meridians, as GeoJSON recomputed per viewport on moveend from each zone’s own projection and cut to its cell, finer levels skipped past a line budget; one source, three layers (coordinate-grid-casing, -lines, -labels) under the basemap’s first symbol layer, inked per ground and per grid. coordinates.ts::formatCoordinate is the one reference formatter the pin and the storm cards use. |
map/shadow/shadowlayer.ts + map/shadow/shadow.worker.ts, map/shadow/shadowgl.ts, map/shadow/shadow.ts, map/shadow/shadowtypes.ts | Terrain cast shadows: the main-thread controller, the worker that ray-marches the DEM, its GPU marcher, its pure functions, the message contract. |
features/export/gifexport.ts + features/export/gif.worker.ts | The GIF export, and the capture loop both exports share (prepareCapture, captureFrame, deliverFile): up to 48 frames, each captured off the map canvas in its render event, caption and credits burnt in, one palette for the loop (gifenc, in a worker); a share sheet on touch screens, a download elsewhere. |
features/export/mp4export.ts | The MP4 export (1080P, 1440P or 4K as the canvas offers), offered only once VideoEncoder.isConfigSupported accepts an H.264 configuration (High, Main, then Constrained Baseline at level 4.0, hardware first). Same host and captions as the GIF, up to 240 data frames at the canvas size capped to 1920 wide (even sides), but sampled on a 30 fps clock: mp4Schedule gives each data frame the span frameHoldMs holds it for on screen, and every tick inside the span captures the shader blend swept that far toward the next frame (GifHost.blend → main.ts::blendFrames, the sweep playback itself runs), so the file keeps the rate chosen for it and the motion the viewer sees rather than a stepped loop. The bitrate is mp4Bitrate (9 Mbit/s at 1080p30, scaled by pixels^0.9 and fps^0.6, clamped to 1.5–45 Mbit/s); one key frame only, because a periodic I-frame re-seeds the particle trails and reads as a pulse; mp4-muxer writes a fast-start MP4 in memory, bundled as a chunk of its own loaded with the first cut, never from a CDN (the bucket’s CORS is a whitelist). |
features/export/stillexport.ts, features/export/printmap.ts | The frame on screen as a PNG (the caption and credits as the GIF has them, the legend painted off its laid-out boxes) and as a printed chart on a paper ground. A print is prepared first, and a phone drops window.print() once the tap that asked for it has expired (navigator.userActivation), so the button then asks for a second tap and prints in it. |
features/export/exportsheet.ts (createExportSheet, #export-sheet) | Both exports start here, off the timeline capsule so its row stays the level chips, the rate and play: a round trigger in the top-right row (heading the right-hand column on phones, the view tile a slot lower) opens a sheet with format, size, rate (the playback ladder; follows the playback rate until one is picked) and a FROM/TO span (default from the frame on screen, clamped to the format’s ceiling), a size estimate (MP4 from mp4Bitrate, GIF from a rough bytes-per-pixel mean) and EXPORT/Cancel. Format, size and rate are kept in localStorage; the span is kept while the axis keeps its length. A long press on the trigger saves with the settings as they stand; progress fills a ring round the trigger and a bar in the sheet. |
features/volume/volume.ts, features/volume/levels.ts | The volumes (refl3d, cloud3d): a 3D texture per frame, raymarched in a Mercator box, the transfer function chosen by the levels’ parameter, stopped by the terrain’s depth. levels.ts is what the page reads of a volume bundle without drawing it (its levels, a close-up’s cells); the layer is loaded with the first volume drawn (see “First load”). |
render/palettes.ts, ui/units.ts, data/domain.ts | Ramps, display units, Lambert conformal arithmetic and the footprints of resampled regional runs. |
map/basemap.ts | The basemap style: Protomaps flavor per theme, the grounds (GROUND_TONES), hillshade (under the land detail, and again over the filled fields on the flat map: RELIEF_OVER_FIELDS_LAYER, which the fills insert under) and coastline layers, and the property diff syncBasemapStyle applies. |
ui/playback.ts, ui/timeline.ts | Frame-rate ladder and dwell; transport geometry. |
app/playbackloop.ts | The transport (createPlaybackLoop): PLAY and PAUSE, the chosen rate and its storage, and the animation-frame loop stepping the playhead on each frame’s hold and sweeping the blend between steps at 30 Hz. What a step and a blend draw is the frame selection’s (frameselection.ts). |
app/timelineview.ts | The track’s controller (createTimelineView): ticks and the day or month strip from timelinePlan, the now mark, the range a total is drawn over (dragged on the track, drawn as a band), and the placeholder track before a manifest. The plan on screen is PageState.timeline. |
app/frameaxis.ts | The primary axis (createFrameAxis): index, offset, lead and valid time memoized on the time block, the hold each frame plays for, the kind of dataset reading it (forecast, observations, nowcast, daily record, a case replaying a forecast) and the readouts (F058, a clock stamp, a UTC day). |
features/probe/probe.ts, features/probe/meteogram.ts | Point probe and its rows. |
features/probe/probepanel.ts | The probe panel’s controller (createProbePanel): the pin, series requests, probe sessions, rows, terrain column, station chips, skew-T sheet. |
features/probe/probelayout.ts | How the panel shares the screen with the map (createProbeLayout): the sounding’s card beside the map on a wide window, one page at a time under tabs on a narrow one, a phone’s half height, and the pin kept out from under both. See “Probe panel” below. |
features/precipphase/precipphase.ts | The precipitation by phase: classes from ptype, ptypeec and cpofp, the freezing line from fzlvl and orog, the weights ForecastLayer.setPhase paints by, and where the chart writes its labels. Plain arithmetic on decoded planes. |
features/precipphase/precipphaseview.ts | The phase’s controller (createPrecipPhase): its four overlay slots and the freezing line’s layer, opening them after the primary, the rebuild once a frame’s planes have landed, the labels (held to one move a second while playing) and the legend’s key. |
features/mosaic/mosaic.ts, derive/composite.ts | Geostationary mosaic by longitude bands; the precipitation setup’s derived fields and stepped keys. |
features/mosaic/mosaicview.ts | The mosaic’s controller (createMosaic): reading the members’ runs, the primary member, the bands, a slot per other member opened on the primary’s rung for the primary’s bundle, the member the pin reads, and the members’ pointer poll. The mosaic on screen is PageState.mosaic. |
derive/derived.ts | The derived-layer controller (createDerived): opens the input sessions of the precipitation setup and of the fire fields, waits for their planes, computes and draws each field on a layer of its own. |
features/totals/accumulation.ts | Precipitation totals (?accum=) over a window or a dragged range, from the published rate frames; see “Precipitation totals” below. |
derive/hotspot.ts, derive/firewx.ts | The fire fields (one at a time, drawn alone on an anchor input’s session, never in the URL): the 3.9 µm contextual hotspot test on ir039 + ir104, the Fosberg index and the dry-and-gusty alert from tmp2m / dpt2m / wind10m / gust. Plain arithmetic on decoded whole planes like composite.ts, run through the setup’s derived-layer machinery in derived.ts (fireDerived). |
products/gibs/gibs.ts | NASA GIBS daily corrected reflectance, a dataset of its own (/gibs?gibs=): one raster source and layer, tiles straight from GIBS’s WMTS. |
products/gibs/gibsview.ts | The imagery’s controller (createGibsView): the colour tiles, the platform chips, the headline, a case’s picture in place of its field, and the raster drawn under the field on the playhead’s day. main.ts::openImagery opens the dataset. |
ui/i18n/i18n.ts + ui/i18n/locales/, ui/theme.ts, ui/timezone.ts | Locale, appearance, display zone. |
site/pagemeta.ts, site/site.ts, site/modelpage.ts | Per-view metadata; the only place production hostnames appear; a dataset page’s head (title, description, Dataset). |
app/embed.ts | The embed API, window.xueViewer (see “Embedding”). |
pages/compare/compare.ts + pages/compare/, pages/showcase/showcase.ts | Comparison page; case list page. |
products/tc/, products/stations/, products/sounding/ | Point-product marks, cards, skew-T. |
app/marks.ts | The marks controller (createMarks): loads and polls the storm, station, fire, air-quality and warning indexes, draws their layers under the basemap labels (firstSymbolLayerId), follows the playhead, opens their cards, and the fire wind of a case. |
products/aq/, products/alerts/ | Air-quality station marks (on the station layers) and the warning areas, with their cards; products/alerts/pmtiles.ts is the pmtiles:// protocol the boundary sets are read through (point-products.md, “In the shell”). |
features/case/casemarkers.ts | A case’s markers (showcase-catalog.ts ShowcaseMarker, showcase/README.md): one GeoJSON symbol layer on top of the map, a canvas-drawn icon per kind (place, event) and a haloed label in the UI locale, inked from the ground like the basemap’s labels. An event’s time dims it until the playhead reaches it, as a paint expression. A click opens its card (note, time, https source links) in the station card’s slot. The banner lists the same markers as buttons so the text is reachable without the map. A marker the shell cannot read is dropped on its own; the rest still draw. |
features/case/casecaptions.ts | A case’s captions (showcase-catalog.ts ShowcaseCaption, showcase/README.md): the one whose valid-time span holds the playhead, found by binary search over spans the catalog keeps ordered and disjoint. caseview.ts::syncCaseCaption shows it in #case-caption over the capsule on every frame mark sync and on a locale change; gifexport.ts draws the same line over the stamp strip of each exported frame (GifCaption.subtitle). |
features/case/caseview.ts | A case on screen (createCaseView): the banner (title, summary, region, parts, the caption at the playhead), the markers and their cards, the camera held to the case’s region, the relief and volume its view names, the legend moved beside the card, and a regional model’s framing. |
features/volume/volumeview.ts | The radar volume (createVolumeView): its layer, the overlay over a 2D field opened after the primary and following it by lead time, the box and section tools, the close-up a box focuses the decode on, and the volume tile. The frame selection (frameselection.ts) shares its VolumeState. |
features/particles/particlesview.ts | The wind particles (createParticles): the layer made on first use and the grid it is configured for (WindState, shared with the frame selection), the ink over a field, a picture or the setup’s flux, and the overlay’s switch kept between visits. |
render/contourstyle.ts | contourStyleFor: the contour lines a pressure surface is charted with (interval, emphasis, named values, widths, ink, smoothing by the grid’s step), as a chart of its own or over another field. |
features/totals/totalsview.ts | The precipitation total on screen (createTotals): the windows a rate offers within the plane cache, the frames a window or range sums, the running sums (TotalsState, shared with the frame selection), the palette swapped with its plane, selecting a total’s or a range’s frame, and RANGE’s default span. |
app/runpoll.ts | The live pointer poll (createRunPoll): rescheduled on the dataset’s cadence (two minutes for an observation window, five otherwise), re-opening onto a new manifest with the playhead kept by time where the axis allows, or adopting in place a republished manifest whose column store alone moved. |
map/mapdecor.ts | The basemap under the data (createMapDecor): the ground tones and the ink of its names, borders, coast and rivers for that ground, syncBasemapStyle’s property diff, and the relief’s shadows, contours and the coordinate grids built once the style loads. What else takes the ground’s ink is main.ts::inkOverlays. |
app/livecopy.ts | say, sayText and resayAll: long-lived status copy that keeps its message key, so a locale switch rewrites it in place. |
app/preloadcard.ts | The data card’s download readout (createPreloadCard): the frame count, the bar of cells (at most 120, filled in proportion on a long axis), the bytes, the percentage and the state line. |
features/case/casecontext.ts | A case’s context lines (showcase-catalog.ts ShowcaseContext): one GeoJSON file of borders, protected areas, watercourses, roads, tracks, the story’s route, lines read off imagery and measured distances, read once per case at its ?v=. One source, a layer per way of drawing (a reserve’s tint, solid lines, dashed tracks, dotted traces, the dash-dot border, the dashed measures, the cased route, and the features’ labels midway along them on top), styled by kind through expressions and inked from the ground; widths follow the zoom. The layers go right over the field’s anchor and the basemap’s lines, under the first label or app layer there (contextBeforeLayer), so fire, river and marker layers draw over them whichever comes first. A feature of an unknown kind or geometry is dropped on its own. Its credit stands on the credit line while the case is open; another case opened in place takes both off. |
map/measure.ts | The ruler and the area tool on the view tile: armed by a press, every map click is a vertex (the click handler hands it over before marks or the probe, and double-click zoom is off meanwhile), so the map still pans between vertices. A click back on the last vertex ends the shape (a double click does), on the first ends an area; Escape ends, a second Escape or press puts it away, Backspace takes a vertex back. Lengths are WGS84 ellipsoid geodesics (geodesy.ts, Vincenty; the horizontal sea-level distance), areas the line-integral form on the authalic sphere over the ring densified along great circles (≤ 50 km steps), and the edges are drawn along those same great circles with longitudes unwrapped across the antimeridian. A finished distance reads its ground off the Mapterhorn DEM (terrain.ts::demElevationsAt, one read per tile): one sample a DEM pixel at the finest zoom within 4,000 samples and about 24 tiles, a missing tile read as the sea surface, giving the length along the ground, the climb and the descent, and the Earth-centred straight line between the two ends at their heights; the label names the sample spacing because a surface length depends on it. One GeoJSON source on top of the map, inked like a case’s measures. |
features/crosssection/ | The vertical cross-section along a line of the map; see “Cross-section” below. |
pages/workbench/, pages/workbench/workbench.ts | The workbench, a page of its own (/workbench) that shares the section’s and the sounding’s parts and nothing of main.ts; see “Workbench” below. |
data/rangeprobe.ts | Whether an object’s origin answers byte ranges, asked once per object. |
ui/escapestack.ts | What an Escape closes: the surface opened last, one a press. Sheets, cards (cardpopup.ts), the probe and section panels, the map’s tools and the context menu put themselves on it as they open, and each says for itself whether it is open; none hears the key on its own. |
products/fire/ | Active fire marks (docs/fire.md): one clustered GeoJSON source of the 24 h ending at the playhead (pinned to the window’s end past it), read per sensor as one range over consecutive hour lines with a ±12 h margin so a playing run does not refetch; rebuilt only when the playhead’s hour moves inside the window, age colors and the after-playhead filter are paint/filter expressions. Rides the stations’ poll, card style and ?stations=fire. A case’s round is drawn as its story instead (setHistory): the whole window is read once and every detection up to the playhead stays, colored by overpass burst (detections more than PASS_GAP_MS apart start a new pass) — the newest pass yellow, the one before red-orange, older ones a dark burnt-red stipple — and the playhead sweeps it between frames (sweep, from blendFrames, as the exports sample it), rebuilding the features only when it crosses a detection time. products/fire/windarrow.ts draws the mean 10 m wind at the newest pass’s detections from that pass’s start to the playhead, downwind at ARROW_KM_PER_MS, off a series request to the case’s own wind10m session or the one its wind block borrows (fireWind in marks.ts, opened like a mosaic member; a borrowed wind also runs the particles over the case’s own fields, by valid time). |
products/river/ | A case’s river data (docs/river.md): the index and gauge lines (index.ts), the reaches’ GeoParquet read by range (parquet.ts, wkb.ts), the network store (store.ts), the line layer (layer.ts, palette.ts), gauges and extents on the map with the case-panel controls (case.ts), the gauge’s hydrograph in the probe panel (gauge.ts, hydrograph.ts). See “River layer” below. |
app/overlays.ts | The overlays controller (createOverlays): the single-site radar (feed, overlay, title, chip, legend, site and product switches) and a case’s fire, river and context layers. |
products/radar/ | Single-site radar overlay (docs/nexrad.md): two feeds behind one session (feed.ts) — a case’s window manifest, one unit per round, and the live source bucket (live.ts, §7), one unit per Level 3 object, over the static sites.json — a worker that range-reads a round and decodes it with the WASM decodeChunk (RAW) or reads a live sweep whole and decodes it with decodeLevel3, a session that streams units outward from the playhead, a live site’s newest first (≤ 6 in flight, byte budget 384 MB desktop / 96 MB narrow, farthest rounds evicted first), the polar R8UI shader on the projection prelude, and radome site marks with ICAO labels. A chosen site is drawn alone (ForecastLayer.setSuppressed holds the field off screen; its slot keeps running), its scale takes the field legend (legend[data-radar]), REF / VEL are a radio pair on the rail under the radar tile, shown while a site is open, and the level row’s radar group carries the sweep time and the site as a pressed chip whose ✕ closes it. Follows the playhead, never holds it; not draped on terrain. |
First load
What main.ts imports statically is what every reader downloads before
the first frame: Vite writes it as the entry script and its
modulepreload links. A feature the default view does not draw is loaded
with import() the first time it is wanted, memoized, behind a static
part that keeps its controller’s shape:
| Loaded on demand | When | Static in its place |
|---|---|---|
| Locale dictionaries other than English | the page’s language, before the first render | i18n.ts |
features/crosssection/ (control, source, panel, worker) | a line is drawn, the tool is taken up, or ?section= names one | shell.ts |
features/volume/volume.ts (the raymarching layer) | a volume is the field or is drawn over one (?volume=, a case’s view) | volumeview.ts::withVolumeLayer, and levels.ts for what sessions read of a volume bundle |
map/measure.ts (with measureprofile.ts, geodesy.ts) | the ruler or the area tool is first pressed | main.ts::loadMeasureTool |
mp4-muxer | the first MP4 cut | the rest of mp4export.ts, whose sizes and rates the sheet reads |
features/export/stillexport.ts | the first PNG saved | exportsheet.ts |
A late layer is configured by the call that asked for it only if what it
was asked for is still on screen, and then re-selects the frame. A module
that fails to load is asked for again next time: the volume’s failure is
reported like a layer’s (showError), a tool’s or a file’s is logged.
The probe panel and its skew-T section stay static: their state (the pin,
its sessions, probe.sample on every decoded frame, the sheet trigger)
is read synchronously throughout main.ts and marks.ts.
CI’s web job holds the total to a budget after npm run build:
node web/tooling/entrysize.ts reads dist/index.html and dist/gfs.html
(the pages in web/tooling/size-budget.json), sums the entry script and
every modulepreload raw and gzipped, prints the table (and the job
summary), and fails when a page’s gzip total is over gzipBytes.
Workers, WASM, fonts, CSS and data are not counted. When a change moves
the number for good, set the budget to the measured total plus about 5%.
Sessions and delivery
A session is one bundle in its own worker with its own grid, tiles and
tier. Every channel speaks one protocol (booted → init / init-stream
→ ready, then decode → frame, series, prefetch-window), so
main.ts holds any of them in the same field.
sessions.ts::load (loadVariable in the controllers’ deps) picks, in order: the Zarr store over ranges
(whenever the bundle or tier has a zarr descriptor, unless
?backend=xue), .xue over ranges, .xue downloaded whole, the store by
whole objects (only when no container ships). Probe sessions are
streamed or nothing.
Store channel: a session opens a bundle by (store, bundle id),
ZarrSession.open(store, codec, { bundle }): a run’s map stores are shared
(zarr-profile.md, profile 2: every bundle of a tier
in bundles[.<tier>].zarr), so decode/zarr/documents.ts::readGroup(codec, text, bundle?) takes the bundle’s metadata out of the group’s xue_bundles
(or a one-bundle store’s xue, profile 1, which published runs and cases
still are) and checks grid and axis against that bundle alone. codec is
the WASM module: the store’s format is read by rust/xue/src/zarr.rs
(parseZarrGroup, one WasmZarrArray per variable), the reader the data
API uses, and documents.ts adds the generated schema validators and
parseBundleMetadata in front of it. Caches keyed
by store path (PayloadPool, the store) are shared by the tier’s bundles,
so the group and coordinates are fetched once per tier. The array’s reader
verifies each shard’s CRC-32C-checked index once (setShardIndex) and maps
time chunk and tile to a span (chunkRange; a time chunk is six frames
and may straddle container groups); decode/zarr/store.ts appends ?v= and
merges one shard’s ranges issued in one microtask (gap ≤ 64 KB). A frame is
assembled in the reader: the session hands it the compressed chunks not yet
decoded for the frame’s time chunk (undecodedTiles, feedChunk) and takes
the plane (assembleFrame) with no await in between. The plane is a new
array each time, so concurrent decodes never share a buffer, and the worker
posts it as it is; a store’s planes are not recycled. A cell’s series is one
call, series, over its tile’s chunk in every time chunk. Compressed chunks are an LRU
under payloadBudgetBytes (zarrPayloadBudgetBytes: 192 MB, 96 MB on a
≤ 4 GB device, 64 MB on a constrained connection), so memory follows the
window ahead of the playhead, not the axis; a decode re-fetches what was
evicted between fetch and assembly.
A streaming session fetches only its viewport’s tiles (u_cover in
layer.ts clips to what a partial plane holds); the data card then reads
“Viewport fully buffered”.
numericId is file-local (1..n per bundle): never key across sessions by
it alone. sessionkeys.ts scopes cache and probe keys, and each worker is
bound to its session by closure.
A tab whose validator refuses a live manifest (ManifestRejectedError) or
cannot open a live store (StoreRejectedError) reloads once per manifest
(primaryswitch.ts::reloadForNewerShell, crc32 in sessionStorage). It is insurance, not a
substitute for deploying the shell before the data
(publishing.md).
New runs: a changed manifestCrc32 on a polled pointer is a new run; a
rolling observation window keeps the playhead by observation time, or
follows the end if it was there (checkForNewRun, PageState.resume).
Composition and tiers
ViewComposition {fill, lines}: two slots, each a ForecastLayer with its
own session. The primary (fill, else lines) drives timeline, legend, data
card and ground, and alone gates the playhead. The lines overlay follows by
lead seconds on its own axis: an undecoded frame keeps the last one up, a
missing lead time hides it. Prefetch runs on the primary at the
connection’s concurrency, on overlays at one. A ?type= is a composition
with one slot.
A volume can be an overlay too (ViewState.volume, ?volume=cloud3d):
over a 2D field, the overlay section’s volume switch (#volume-tile,
shown on a run that ships a volume bundle) opens the volume’s session at
the overlay tier (volumeview.ts::applyVolumeOverlay) and feeds the volume
layer the way the lines slot feeds its ForecastLayer: by lead seconds,
every level of a frame or none (trySelectVolumeOverlay), blended on the
primary’s clock (blendVolumeOverlay), its shown levels kept from
eviction, whole planes always. It never gates the playhead. It is not a
RasterSlot (those own a ForecastLayer); a volume as the field is the
primary and takes the layer itself, and the overlay empties.
manifest.ts::pickBundleVariant chooses the rung from viewport, connection
and the bundle’s longitude span, then a cell budget
(budget.ts::planeCellBudget: 2.5 M cells, halved on ≤ 4 GB, quartered on a
constrained connection) against rung cells × visibleGridShare. A full
satellite disk thus plays at lower rungs zoomed out but full on a storm.
?res=half|full pins. Overlays take the half tier unless ?res=full;
overlays and mosaic members never re-tier.
When the camera rests (400 ms), retierPrimary (primaryswitch.ts, with the budget arithmetic passed in from main.ts) asks settleBundleVariant
(a 20 % dead band so a boundary does not flap), opens the new rung beside
the old with sessionRegistry.load(…, { replace, tier }), keeps the old frame up
until the new lands, then disposes the old session. The plane cache grows
with frame size to hold the prefetch window (cap 256 MB, 128 MB on ≤ 4 GB)
and the window shrinks to fit it.
Rendering
layer.ts: one quantized R8 plane, inverse Web Mercator, palette lookup in the fragment shader, two frames blended byu_mix. Never animate raster opacity.- Sampling (
setSampling, fromVariableSpec.sampling): scalars are reconstructed bicubically, except a field whose cells are features rather than samples of a surface. The EFAS river fields are one cell wide with no data around them, sodis06andupstreamread the nearest texel (nearest), and the return-period classdisrpalso steps between frames atu_mix = 0.5instead of mixing codes (classes), since the code halfway between two classes is a third. - Vectors:
setVectorFielduses RG8 (u red, v green, the packingparticles.tsneeds, interleaved once per frame) and colours bymagnitude / levels.ts::vectorMaxMagnitude. Only the wind pair is packed; a composite’s guns stay three R8 textures (FramePlanes). - Contours:
setContoursfinds lines per pixel from the dequantized value and its screen gradient. It depends on an encoder rule: every pressure codebook puts each standard contour half a code off, so a line never sits on a plateau.prerenderfirst smooths the plane in grid space (Gaussian, coverage-renormalised, 16-bit RG8; widthpressure.ts::contourSmoothingCells). Filled fields are never smoothed. The codebooks and intervals are the registry’s (web/src/data/registry.ts). - Labels are the one CPU step:
isolines.tscrops the plane to the view and smooths it the same way,labels.worker.tsruns marching squares and an extremum search, two symbol layers place values and H/L. Throttled to 1 Hz during playback; stop, step or pan refreshes at once. - Particles: on by default,
?particles=off/localStorage, off underprefers-reduced-motion. With them off, wind narrows to the viewport; on, the session takes the whole plane because particles respawn anywhere. - Projection and relief (
projection.ts): the custom layers draw through MapLibre’s projection prelude (projectTile), compiled pershaderData.variantName, so the same Mercator-addressed field lies on the plane (a pole-to-pole mesh, three world copies) or the globe (one copy). Withmap.setTerrainon, MapLibre does not drape custom layers, so the field, the particles and the river reaches draw once per terrain tile (Map.terrain, internal but typed; read structurally, flat fallback) with that tile’s DEM and the terrain’s own mesh size and diagonal, so the depth test against the terrain is an equality (polygon offset breaks the ties, nothing is written). The field shades its own relief (the hillshade under it is hidden); particles hide behind ridges through the terrain’s packed depth texture. Tile meshes carry skirts for LOD seams. The terrain uses its own copy of the Mapterhorn source (MapLibre renders hillshade and terrain worse from one). The terrain camera is MapLibre’s own (6.12 or later: a gesture holds the center elevation and lands it with the camera still). With relief on, the globe hands over to the plane between z9 and z10 instead of MapLibre’s z11–12 (globeProjection): the globe’s controls ignore terrain, so the ground grabbed did not follow the cursor and the center never landed. The zoom floor is z0 on the plane and MapLibre’s z−2 on the globe (syncMinZoom, told the projection by the globe switch): the globe keeps its size by lowering the zoom as the center moves poleward, so a whole globe centred near a pole sits below z0, and at z0 a drag north stalled near 75°. Setting a projection constrains the camera to it without a move event, so the switch jumps to where the camera landed and the layers and the address bar follow. A#map=link on the globe is applied again once the projection is set, since the plane the map opens on clamps a low-zoom center (85° opened at 49°). The zoom ceiling is z16 for every view: in relief, real detail where a regional archive reaches it (Japan’s does), the z12 tile overzoomed elsewhere. The switches and the way back to north and to a flat camera share one tile under the zoom tile (viewcontrol.ts); the two resets show only while the camera is turned or tilted, and the rail’s box starts under the column wherever it ends (--controls-bottom). Phones drop only the zoom tile (pinch zooms; nothing switches the globe or the relief). - Named peaks (
peaks.ts): Protomaps tiles carry OSM peaks only from z11–14, so with relief on a symbol layer draws the Wikidata peaks inweb/public/peaks.json(prominence ≥ 300 m, about 5,500). Prominence sets the zoom each peak first shows at and wins label collisions. The file is regenerated by hand withscripts/build_peaks.pyand committed. It is fetched the first time relief turns on. The layer sits above the basemap POIs, so a tile’s OSM copy of the same summit loses the collision. The badge is drawn in code because thewhiteflavor’s sprite has no peak icon. - Volumes (
volume.ts;/?model=mrms3d, or awoofcase’scloud3d): a volume bundle’s levels (one quantity on GRIB2 surface 102, ascending) are the session’s variables, every one decoded per frame, the session whole (a ray can cross any of it) and its tier weighed for the stack (five planes’ worth of the cell budget, the view’s share measured on the session’s own grid since the bundle has no poster, floored at a quarter): CONUS opens on the half tier and a close view re-tiers to the full one. The levels go into an R8 3D texture per frame (two, blended byu_mix; halved by block maximum pastMAX_3D_TEXTURE_SIZE) and are raymarched front to back in a Mercator box from sea level to half a step over the top level, its height exaggerated by?vexag=or else by the grid’s width (1 under two degrees of longitude, 10 over), times the terrain’s exaggeration while the relief is on. The camera comes from the projection matrix’s x, y and w rows (its depth row is not invertible); each pixel’s ray runs from the camera to the box face it lies on, and only the exit face draws. A 1D lookup takes altitude to the uneven level spacing. The transfer function is the levels’ parameter’s (volumeTransfer). Reflectivity: the cref palette, opacity rising from 25 to 55 dBZ, per voxel, so the step count does not change the picture. Cloud water (0/1/22): Beer–Lambert extinction,1 − exp(−σ·q·stride)with σ = 16 per g/kg per voxel — a fifth of the physical extinction of a 500 m voxel of cloud, so a 0.2 g/kg layer one level thick is already a deck and a 0.05 g/kg wisp a half-veil — coloured from the theme at draw time (a cool blue-white over a slate shade on paper, where the fills under it are warm; warm white over grey on dark), one shadow sample two voxels towards a fixed south-west sun at 45° weighed as 0.75 voxels of path (σ·path ≈ 12: 0.05 g/kg up-sun halves the light, 0.1 g/kg leaves a third, 0.3 g/kg almost none, so a cloud’s interior grades from lit to shade rather than turning flat shade past its first voxel), and a silver lining where that sample is clear and the view looks into the sun. With terrain on (plane only), each sample is projected by the layer’s matrix and the march stops once MapLibre’s packed terrain depth (projection.ts::terrainDepthTexture, the same test the particles use) says the relief is in front: the cloud below a ridge is hidden by it. Below the model ground a cloud volume is 0 g/kg, so nothing grows out of the mountain. On the globe the same march runs in MapLibre’s unit-sphere space (the prelude’sprojectToSphere: y to the north pole, a height scales the radius by1 + h / 6371008.8) through a shell over the box: a closed mesh with outward normals, only the faces a ray leaves through drawn, the ray stopped by the planet (the floor taken on the near half of a ray’s way through it, since its chords sag under the sphere), its own program so the plane’s is untouched, nothing mid-transition; it draws reflectivity only and has no terrain occlusion. Two drag tools in the view tile (volumetool.ts; a volume’s while one is on screen, armed by a press, then the next drag — mouse or finger — through a clear sheet over the canvas): a box is a close-up, the camera flies to it, the session’s viewport tiles become the box’s (so only their chunks are read by range) and the tier is weighed on the box’s share with no floor, and the layer holds just those cells (setRegion: textures sized to the region, uploaded withUNPACK_ROW_LENGTH/SKIP_*andUNPACK_IMAGE_HEIGHTset to the plane’s height — a 3D upload refuses skipped rows otherwise, and every volume upload runs underwithPlainUnpack, because MapLibre leavesUNPACK_PREMULTIPLY_ALPHA_WEBGLon after its own image uploads and WebGL2 then rejects a 3D texture from a typed array without an error, leaving the volume empty); a line stands a vertical section, a wall from sea level to the top painted from the same 3D textures, over the march veiled to a third. Pressing a tool again clears what it holds. - Precipitation totals (
accumulation.ts,?accum=): the depth over the window ending at the playhead, a weighted sum ofprateframes the session decodes anyway; no bundle carries a total. A rate whose parameter block hastypeOfStatisticalProcessing(de-accumulated or de-averaged: ECMWF, GFS sflux) is the mean over the step ending at its frame and is weighted by the part of that step inside the window; an instantaneous one (GFS pgrb2, the radar windows) is integrated by the trapezoid rule, with no line across a gap of more than four steps. A forecast offers 3–72 h, an observation window 10 min–3 h, each only if it is at least one step and at most the axis, and only if its frames fit the plane cache’s cap beside playback (offeredWindows): gathering a window that does not fit would evict its own planes. The window’s planes are kept from eviction while shown (totalShownKeys), asked for newest first, and named in the prefetch window behind the playhead; the cache budget, the prefetch window and the in-flight cap all count them.WindowTotalsholds a running Float64 sum and applies only the change in each frame’s weight when the playhead steps (two to four frames of any window), starting over on a re-decoded or recycled plane, a change touching most terms, or every 64 updates. The sum is written into its own log1p codebook (0.1 mm–1 m) and drawn through a banded key sampled from the rate ramp; the palette swaps with the first plane it colours (syncPrimaryPalette), so neither picture is ever drawn in the other’s colours. The level row carries RATE and the windows while the precipitation is the field; the probe sums the same series over the same plan (seriesTotals) and says how much of a window the axis could fill (6H/24H). A total is drawn on the full tier (primaryResolutionPreference, unless?res=pins one): a reduced tier keeps every second or fourth cell, not their mean, so a total on it drops narrow bands and peaks and would change each time a zoom moved the tier. Turning a total on or off reweighs the tier (scheduleRetier), and the cache cap that decides which windows are offered is the full grid’s. A typed window (the level row’s field:9h,2h,20m, a bare number is hours) passes the same test as a preset (windowFitsand the cache cap,offeredWindows().frames) and sits among the presets while shown. A range (?accum=<from>-<to>, UTC valid times snapped to frames; RANGE on the level row, then a drag on the track — on a band end it moves that end, inside the band it slides the range keeping its hours, elsewhere it starts a new one) is one total whatever the playhead. It keeps nothing resident:RangeSumadds each frame once as it lands (any landing inrangeWanted, not only the desired key) and starts over for another range, run or view tiles, so a range can span the whole axis. The band over the track fills as its frames are summed; the probe reads the range total and keeps the rate chart. While a total is on, the meteogram’s precipitation row draws it over the rate’s bars on a scale of its own (“PRATE · APCP 24H”): the window ending at each frame (seriesTotals), or across a range the depth since its first frame (runningTotals). It is summed over the rate’s own frames, so a column the rate’s axis lacks is a gap, not a frame it waits for. - Altitude correction (
layer.ts::lapseCodes, formula inlapse.ts, controller inrelief.ts): with relief on, a 2 m temperature is moved from the model’s ground (the run’sorogplane, decoded whole once and uploaded on its own grid) to the DEM’s, in the fragment shader, faded in as a model cell grows past ~24–64 px on screen (lapseWeight). Below the model ground it is 6.5 K/km; above it, the free atmosphere at the DEM’s height plus the model’s departure from it at its own ground, faded with the height climbed (exp(−dz / H), H = 2500 m where the ground is warmer than the free atmosphere, 800 m where it is colder). The free atmosphere is the run’s owntmp<level>/hgt<level>on 1000–500 hPa, whichever pairs it publishes: for the frame on screen they are decoded over the view’s tiles one request at a time, cut to a cell window around the view, and each cell’s column sorted by height into three RGBA32F textures the shader reads withtexelFetch(bilinear by hand; an undecoded cell means no column). The last column shown stands in until the next lands; a run with fewer than two pairs keeps 6.5 K/km. The pin carries the same correction as a meteogram row of its own (TERRAIN_ROW_SPEC, “TMP 2M · DEM”, under the model’s temperature) whenever it has both heights, relief on or off, opening the column’s sessions only once the pin stands above the model ground; frames without a column fall back to 6.5 K/km with one console line, never a mark on the row. The DEM readout samples the pinned point, never the cell centre.- Sources. Splitting the 2 m temperature into the free atmosphere at the
site plus a surface departure carried from the coarse ground is
REDCAPP’s (Cao, Gruber & Zhang 2017, GMD 10:2905,
doi:10.5194/gmd-10-2905-2017). Its free atmosphere — pressure-level
temperatures interpolated in their geopotential heights — is
TopoSCALE’s (Fiddes & Gruber 2014, GMD 7:387,
doi:10.5194/gmd-7-387-2014), and taking the column instead of the 2 m
temperature above the model ground follows Gao, Bernhardt & Schulz
(2012, HESS 16:4661, doi:10.5194/hess-16-4661-2012). The weight
exp(−dz / H)is this project’s: it depends ondzand the sign of the departure alone and needs no terrain indices or per-site fit. H was chosen by leave-one-week-out and station-grouped validation against mountain and lowland stations from NOAA’s Integrated Surface Database (gaps filled from GHCNh and the Iowa Environmental Mesonet), with GFS and ECMWF IFS open data (CC BY 4.0) 0.25° forecasts over four seasonal weeks, 2024-10 to 2025-07: 800 m is within 0.01 K of each model’s own best under one H, and the warm departure (daytime, 77–81 % of daytime cells) faded at 2500 m halves the daytime cold bias on stations more than 300 m above the model ground (GFS −0.58 → −0.31 K, ECMWF −0.60 → −0.27 K) at no cost at night. Reading the column above the model ground only was measured and rejected: 0.02 K RMSE on 99 % of the cells, 1–2 K worse on the 1 % over a model ground above 700 hPa, and 0.1–0.4 K colder nights. The 6.5 K/km below the model ground is the ICAO standard atmosphere’s lapse rate. Exposed summits stay colder than the free atmosphere at their height in winter (Sheridan, Vosper & Smith 2018, JAMC 57:1907, doi:10.1175/JAMC-D-17-0140.1), which the method does not remove; the terrain row reads 1–4 K warm there.
- Sources. Splitting the 2 m temperature into the free atmosphere at the
site plus a surface departure carried from the coarse ground is
REDCAPP’s (Cao, Gruber & Zhang 2017, GMD 10:2905,
doi:10.5194/gmd-10-2905-2017). Its free atmosphere — pressure-level
temperatures interpolated in their geopotential heights — is
TopoSCALE’s (Fiddes & Gruber 2014, GMD 7:387,
doi:10.5194/gmd-7-387-2014), and taking the column instead of the 2 m
temperature above the model ground follows Gao, Bernhardt & Schulz
(2012, HESS 16:4661, doi:10.5194/hess-16-4661-2012). The weight
- Particles: speed halves per zoom level past z4 (
zoomPace) so the pace on screen holds; positions are RGBA32F whereEXT_color_buffer_floatallows (16-bit positions are 600 m steps). From z5 on the plane they are seeded on the ground under a 9x9 screen lattice (map.unproject, so on the terrain too; refreshed onmoveend, never inside a render: unproject rebinds the default framebuffer), interpolated in homogeneous coordinates so density is even per pixel, all reseeded when the camera settles, and respawned when they leave the screen. On terrain their height follows the terrain mesh’s own triangles, so the depth test against the terrain’s packed depth is about ridges, not facets. The point pass weighs each particle’s clip w against the screen centre’s (u_depth_ref, the main matrix at the centre’s ground; 0 on the globe): under a pitch the foreground draws up to 1.6× wider and the far ground down to 0.6× and half as bright, and a fast particle a quarter wider and brighter than a slow one; flat, every w is the centre’s and only the pace tells. There is no density pass: the lattice seeding already spreads the budget evenly per pixel. - Terrain contour lines (
?contours=on, a switch on the view tile):terraincontours.tswraps maplibre-contour’sDemSourceover the same Mapterhorn Terrarium template the hillshade reads (the planet’s z12; the regional archives are not asked, the plugin overzooms instead), and adds a vector source whose tiles the plugin’s protocol answers from a worker: three tiers a rung, set by the zoom’s map scale on the sparse side — faint 500 m under 1000 m index lines from zoom 9, 250/500/1000 at 11, 50/250/500 at 13, 25/50/250 at 15 — where each rung’s middle tier is the rung before’s fine one, so zooming in adds lines without reweighting any; the fine tier is drawn faint, fading in across its rung and without a casing, so a steep slope reads as a tone, and only the index tier is labelled in metres along the line. The two layers go directly under the forecast anchor so they draw over every field and line slot but under the coast and the basemap labels; a field attaching later lands above them, so astyledatalistener moves them back (only when out of place, sincemoveLayerfires the event too). Ink follows the ground withapplyBasemapInk. Nothing is published for this: every dataset has the lines, on the plane and the globe. - Terrain shadows (
?shadow=on; no switch on the view tile until the feature is finished): a worker (shadow.worker.ts) fetches the Terrarium tiles the hillshade uses and ray-marches toward the sun at the playhead’s valid time (now, before a run) into a sunlit mask over a Mercator rectangle, the view plus a margin sunward, at most 2048 px a side (1280 on the CPU); it also inks the mask for the ground into anImageBitmap, so the main thread does no per-pixel work. The march runs on the GPU in the worker’s own WebGL2 context (shadowgl.ts, the same arithmetic asshadow.ts::marchLit); without WebGL2 in workers, or after a shader or context failure, it falls back tomarchLiton the CPU for good (backendin the request forces one, for comparison).shadowlayer.tsgives the mask three consumers: animagesource andrasterlayer directly above the hillshade (MapLibre drapes it onto the terrain and the globe, which it never does for a custom layer); the field layers, which darken by it (setFieldShadow,u_shadow_strength0 when off, no extra variant) and shade their 3D relief from the sun (u_light); and the hillshade’s illumination, changed only in 2° steps since a paint change redraws every draped terrain tile. None of it is in the built style, sosyncBasemapStyle’s diff leaves it alone. Recomputed on frame step,moveend, a ground change and the switch, one request in flight. Nothing is cast while the timeline plays (a march per frame competes with the frame decoders, and a late mask is on the wrong side of the hills) or belowMIN_SHADOW_ZOOM(9), where a mountain’s shadow is a few DEM pixels; the switch stays on and the shadows return on the frame playback stops at, or when the camera comes close. - Derived fire fields (
hotspot.ts,firewx.ts): each is a field tile, one at a time. Pressing one makes its anchor input the view’s field (FIRE_FIELD_ANCHOR:ir039,tmp2m), which keeps the timeline and the lines but is held off screen (syncFillSuppressed, shared with a radar site drawn alone); any other field press drops it. It opens the layer’s input sessions beside the composition (applyFireDerived), each decoding whole planes while a layer that reads it is on, and the plane is recomputed on the CPU for every frame shown, into aForecastLayeradded under the lines the first time it draws. The hotspot’s two channels open at the rung the field on screen reads (fireInputTier), since the test compares a cell with its neighbours; its day/night split is the sun’s elevation at each cell (shadow.ts::solarEphemeris). The hotspot is a CPU pass, not a fragment shader, so it can be unit-tested and shares the setup’s input plumbing: separable box sums keep it linear in the cells whatever the window. - NASA GIBS (
gibs.ts,/gibs?gibs=): a dataset in the model switch beside the models and the disks, and the only one whose tiles do not come from our bucket. It has no pointer, manifest or session (ForecastModelInfo.imagery):initializebranches toopenImagery, which sets a synthetic day axis (the lastGIBS_DAY_COUNTUTC days) asmetadata, so the timeline, transport and marks run unchanged, andtrySelectFramejust moves the playhead (imageryMode). The rail shows two field tiles (true colour, fire false colour) and the level row the platforms. GIBS’s WMTS (epsg3857/best,GoogleMapsCompatible_Level9, no key,Access-Control-Allow-Origin: *) serves one picture per platform per UTC day; a day change swaps the source’s tile URLs (setTiles). The layer sits under the coastline, outside the built style, sosyncBasemapStyleleaves it alone. If GIBS is down the map is blank and nothing else is affected. The credit line names it while it is on (body[data-imagery]). A day an orbiter has no picture comes back black, not as an error, so the shell cannot detect it; a case names those days inimagery.daysandsyncGibsdraws the stand-in’s platform there (gibsLayerOnDay). playback.tsdwells per frame so a mixed-step axis plays at one speed.- A regional run the encoder resampled clips raster, particles, probe and
labels to
FORECAST_MODELS[].domain(domain.ts). The clip goes by the bundle (gridmap.ts::clipDomain): a bundle with aprojectionis its own footprint, sohrrrkeeps itsdomainfor older runs and cases.
Native grids
No trigonometry per pixel on a raster. GLSL does not bound the error of
sin, tan or pow, and 5e-4 on a radius of 8,000 km is 4 km: half a cell of
a 3 km grid, different on every GPU, which CI caught at 1.3 km on SwiftShader. A
Lambert raster reads its projected metres from an RG32F table computed in
doubles over the grid’s Mercator rectangle (gridmap.ts::gridTable,
domain.ts::GRID_TABLE_GLSL, 512 x 256, within 4 m on HRRR’s domain), by
hand-written bilinear. The particle shader keeps the analytic form: where it
samples the wind moves by a fraction of a cell at most, and nothing is drawn
from a single cell. tests/e2e/shader.spec.ts holds the raster to 120 m.
A bundle’s grid block (docs/bundle.md) is read in one place,
gridmap.ts::parseGrid (through geoGrid(metadata), memoized on the metadata;
parseBundleMetadata runs it too, so a bad block never reaches a session). It
throws on a malformed block. Published regular grids may leave fields out, which
take bundle.md’s values; a projected grid never may. GeoGrid is a union, so the
regular fields cannot be read without grid.projection having been ruled out, and
the compiler finds what assumes them.
GridMap (gridMapFor(grid)) answers lonLatToCell, cellToLonLat, bounds,
coverOfBounds and nominalStepDegrees, the last for whatever wants a scale
rather than a coordinate.
- Gaussian (
grid.gaussian): the regular fields stay what the shaders and the tile covers read, up to 0.014 of a row from the truth and below any filter’s resolution. Only cell lookups and reported cell latitudes take the true Legendre roots, computed on first use, pern, by the iteration indocs/zarr-profile.md. - Lambert (
grid.projection, schemaVersion 4):GRID_GLSL’sgridCellis the shader’s way to a cell, the cone’snof 0 meaning a regular grid. A layer’s own grid, the orography, the column and the phase weights each carry their own cone, because each can be on its own grid. Filtering stays in texture space.coverOfBoundswalks the view’s edges, with latitudes held short of the poles (a globe’s bounds can hold one) and the meridian opposite the cone’s centre walked too, since the projection is cut there, and adds a cell for the filter. - Anything taking a row for a latitude and a column for a longitude had to change
rather than swap accessors.
precipphase.tsreads a second field one axis at a time whenaxesAlignholds (two tiers of one projection, two regular grids) and by a per-cell table, kept per grid pair, when not.hotspot.ts::dayMaskkeeps its per-column hour angles for a regular grid and works per cell on a cone.composite.ts::thermalFrontZonemeasures its gradient over the ground by the map factor.volume.tstakes only a regular grid;main.ts::volumeGridOfrefuses the rest. Contours are marching squares in cell space, each vertex throughcellToLonLat, so they follow the projection.
Wind on these grids is east and north already, because the encoder rotates it, so particles move by it as they do anywhere.
Tests: tests/web/gridmap.test.ts, the shader against the CPU in
tests/e2e/shader.spec.ts, and a whole run of each shape in
tests/e2e/nativegrids.spec.ts.
Precipitation by phase
A rail switch (?phase=on, off by default) paints the rate view of prate with
one ramp per class and marks the 0 °C line and the freezing rain zones. Nothing
loads until it is pressed. It is computed in the browser from published bundles
(precipphase.ts), using only what the model reports:
ptype(GFS, from NCEP’s flags) andptypeec(ECMWF’s own record, a longer book) give freezing rain and ice pellets. NCEP’s flags never overlap in a cell, so on GFS the mix comes fromcpofp, the model’s percent frozen: between 10 and 90 % a cell is a mix. ECMWF’s type names a mixture itself. A cell neither names is on the plain ramp.- A run with neither field has no switch, and the key lists only the classes the run’s fields can name. No class is inferred from a temperature.
- The freezing line is where the 0 °C isotherm meets the ground:
fzlvlis a height above sea level, sobuildFrostPlanesubtractsorogand the contour path draws the result at 0 on a layer of its own. A run withoutfzlvl(GFS and HRRR have it, andsfluxborrows it) has no line. - A model names a type far beyond what reaches the ground, so the freezing rain zone’s hatch, outline and name appear only where the rate says it is falling.
- The phase’s sessions are overlays and never gate the playhead, and their own layers are never added to the map, only their planes are read.
buildPhaseFieldwrites RGBA weights (snow, mix, freezing rain, ice pellets; rain is the remainder).ForecastLayer.setPhasesamples them bilinearly and looks each class up in a palette row, and draws the zone’s outline and hatch from the freezing rain weight. The class steps with the frame while the rate blends throughu_mix.
Precipitation setup
A field tile (?type=precipsetup, beside the rate) draws prate with what
makes it: the rate on a stepped key (composite.ts), the sea level pressure
lines, particles run by a flow, and two fields computed in the browser — the
warm moist inflow (qflux850 × thetae850) and the frontal zone (the
thetae850 gradient). It is drawn on the rate’s own session, so the timeline,
the probe and the phase switch are the rate’s; ViewState.setup holds it and
setupInView says when it applies. The tile shows on a run that ships prate,
prmsl, qflux850 and thetae850 (derived.ts::setupPublished); elsewhere a
setup link opens the plain rate.
- The flow is the 850 hPa vapour flux unless
?flow=names another flux or wind surface; the level row lists the offered ones the run ships under FLUX and WIND. A wind runs the particles in the wind’s ink, a flux in the inflow’s. - The lines are the view’s own: a bare setup link draws
prmsl,lines=nonenone, and the level row changes them as over any field. - The two derived layers are switches in the overlay section, remembered on
the device (
xue-setup-layers), not in the link. - No total is made of it: the level row’s Total group hides and a stored
?accum=gives way. - The phase switch stacks on it:
steppedPhasePalettebands each class’s ramp as the rain’s, so the key stays stepped.
Borrowed bundles
sflux publishes no pressure level and no phase. Once its manifest is read, the
shell lists the isobaric bundles, prmsl, ptype, cpofp and fzlvl of the same cycle’s
gfs manifest beside its own (borrowBundles, BORROWED_BUNDLES), with their
paths made absolute. From there they are ordinary bundles of the run: the rail,
the level row, the lines and the probe read them from GFS’s 0.25° stores, and
nothing is copied. A cycle GFS has not published leaves sflux without them.
River layer
A showcase case whose catalog row carries a river block
(showcase-catalog.ts::riverBlock) plays its river directory
(docs/river.md) beside the field. overlays.ts::loadCaseRiver
fetches river/index.json?v=<crc32> once per case and validates it
(products/river/index.ts::parseRiverIndex, the writer’s rules); a refused index or
a failed request is one console warning and the case plays its field alone.
products/river/case.ts::RiverCase then owns everything on the map:
- Geometry (network case).
products/river/parquet.tsreadsreaches.parquetthrough hyparquet over anAsyncBufferwhose everysliceis one Range request (rangeAsyncBuffer; a 200 answer is kept whole): the footer first (16 KB suffix), then, on everymoveend, the geometry column of the row groups whosebboxcovering statistics meet the view — all of them when the view holds the case’sbbox. The parquet reader is a lazy chunk, loaded only on a network case. WKB is decoded byproducts/river/wkb.ts(hyparquet’s own GeoJSON conversion is off). Row groupgis the store’s feature chunkg, so a row’s index is its feature. - Values.
products/river/store.ts::NetworkStoreopens a track’s store with the grid reader’s pieces:decode/zarr/store.ts(range coalescing,?v=), and the WASM module’sparseShardIndexanddecodeChunk(products/river/decode.tsloads it on the main thread; a frame is two 24 KB chunks). The group must carryxue_networkversion 1 and repeat the index’s geometry; the array isuint8 [time, feature], one shard, inner chunk[6, rowGroupRows],[xue.delta, bytes, zstd]or[bytes, zstd], and is read against the group by the module’sparseNetworkArray(rust/xue/src/network.rs), from the group’s consolidated metadata when it is there. A frame is its time chunk’s chunks for the row groups in hand, issued in one microtask (one merged range); a reach’s series is one chunk per time chunk. Codes go through thelog1ptable (codebookTable: 0 → 0, 254 → the maximum, 255 → NaN).timeandbasefloware read whole at open. - Time. The playhead’s valid time comes from
updateFrameReadout(the frame asked for) and fromblendFramesduring playback (the sweep’s fraction, so the reaches move with the field’su_mix).framePairtakes the latest track frame at or before it and the next; before the track’s first frame nothing is drawn; past its last the last holds. The two frames are blended linearly per reach on the CPU (blendValues). - Drawing (
products/river/layer.ts, a custom WebGL2 layer). Every segment is an instance of a four-vertex strip carrying its two ends in Mercator and its feature; geometry goes up once per row group. Per frame only an RG32F texture of (flow, usual flow) changes, read withtexelFetch. The vertex stage projects both ends through MapLibre’sprojectTileprelude (plane with three world copies, or globe) and extrudes across the segment in device pixels. Colour: ratioQ / max(baseflow, 1)in four classes, < 2 grey, 2–10 yellow, 10–100 red, ≥ 100 purple, theDISRP_CLASSEShues; width1 + log10(Q)device pixels, 1 to 5; no value is a faint 1 px grey (products/river/palette.ts, the same arithmetic in TypeScript for the tests). A row whose block namescolorcolours by flow instead:overlays.ts::syncRiverRamphands the layer that bundle’sbuildPalette(a page’s declared palette included) and codebook once its session is open, the texture’s second channel carries the flow’s code (reachCode), and the vertex stage reads the 256-texel palette at it; the reaches wait for the palette, the zero code is clear, and the case panel shows a note in place of the ratio key. The layer is added before the first symbol layer: over the field and the coastline, under the labels and the case’s markers. With the 3D relief on it draws once per terrain tile (projection.ts::surfaceTiles): each segment is clipped to the tile in the vertex stage, both ends are lifted onto the tile’s mesh height, a cut end carries no cap, and a segment end behind a ridge (the terrain’s packed depth) is left undrawn. - Gauges are one circle layer (hollow rings, inked per ground) over
the reaches. A click pins the probe at the gauge (a grid gauge at its
samplecell) withproducts/river/gauge.ts’s section under the meteogram rows: the observed line (one Range read ofgauges.jsonl,fetchSpanBytes), the outflow line where the gauge has one, the model at the gauge (the track’s columnfeature, or the case’sdis06probe series on a grid case), the reported peaks numbered on the chart and listed under it, on a log axis by whole decades, on the meteogram’s own columns and playhead (products/river/hydrograph.ts). - Extents are fetched the first time the playhead passes their
atand drawn as translucent blue fills under the reaches; the case panel’s switch hides them. The credit line (#river-credit, shown underbody[data-river]) names the index’s credits and each extent on screen. - Case panel.
RiverCase.renderPanelfills#case-riverunder the summary: the track switch (analysis first and by default, then each forecast by its UTC cycle), the key, the extents’ switch, the gauge hint, the index’s disclaimer and its credits.
Tests: tests/web/river-*.test.ts; the synthetic GeoParquet and network
store are written by tests/web/fixtures/river.ts (README beside it).
Rail and view state
What is on screen is one object, view: ViewState. The rail
(syncRail), the level row and the URL (syncUrl over searchForView,
the inverse of parseView) are projections of it; nothing else keeps a
copy.
Three rail sections, one kind of press each: fields (a radio: core
tiles from FORECAST_MODELS[].railCore, the on-screen tile, and MORE →
#field-sheet, which opens on the classic charts — a fill and the lines
read over it, one press each, from chartpresets.ts, listing only those
the run ships both halves of, and the 1000–500 hPa thickness for the
one that draws it — and whose fire group lists the three fire
fields — only the hotspot is a core tile; on NASA GIBS its two colour tiles alone), overlays (switches: pressure lines, particles, a
volume, the precipitation setup’s derived layers), marks (switches: storms,
soundings, airports, stations, fires; the storms’ options hang from a TC
chip on the level row while tracks are drawn). Switches carry
data-toggle and a ring, sheet triggers data-dialog and a chevron.
syncFieldTiles hides unshipped tiles and writes a generic one for a
core or on-screen field without a tile (railtiles.ts); syncRailDensity shrinks tiles to 36px
when they do not fit.
The thickness lines (?thickness=1000-500, thickness.ts) are a derived
layer like the fire fields’ (derived.ts): hgt500 less hgt1000,
recoded so every 60 gpm lands half a code off and traced by the layer’s
contour shader with no fill; thicknesslabels.ts writes their values in
red with the pressure labels’ tracer, in a worker and a symbol layer of
its own. Their switch is the level row’s THICKNESS
group, after the lines, on a run that ships both surfaces.
levels.ts: one tile per family. levels are one quantity on other
surfaces (the level row); variants are different quantities behind one
tile (chips in the sheet, cycled by re-pressing the tile, never on the
level row). OFFERED_LEVELS is the isobaric surfaces the pickers list (the
level row’s fill, lines and flow groups and the sheet’s chips, each through
offeredMembers); the others registered (800, 750, 650, 550, 450 and 350 hPa)
are there for the pinned point’s profile, open by URL, and have a button while
they are on screen. Re-pressing the pressed lines member removes the lines; ALONE
drops the field, and lastField returns on the next press. A family whose
levels are no surfaces names its group (captionKey): the probability of
the 24-hour precipitation (pop) lists one field per threshold, lowest
first, read off the registry’s probability blocks, under THRESHOLD.
An ensemble’s statistics of one field are a level-row group of their own
(STATISTIC, statisticMembers): the quartiles around the median (25% ·
MEDIAN · 75%) or the mean and the spread (MEAN · SPREAD), whatever the run
publishes of them. Membership is the registry’s: a statistic is a variable
with an ensemble block whose parameter block is a field’s own, and that
field’s id is the centre, since an ensemble publishes its median or mean
under the quantity’s id. A statistic has no tile and is in no family: its
field’s tile stands for it and stays pressed (statisticBase). A field’s
statistics swap the fill; a lines field’s (the pressure’s mean and spread)
keep the mean as the lines and draw the spread under them, and MEAN puts
back the fill the spread replaced. The meteogram shades a row’s quartile
band where both quartiles are published, and the probe’s line names the
statistic it reads (median, 75th pct, spread, P>10 mm).
variables.ts is complete over KnownBundleId and every id-keyed table
derives from it. chart (what the field is) and family (which tile) are
different questions; keep both. Labels and legends are closures so they
follow the locale. The table is built on first use. tests/web/variables.test.ts
holds the markup to it, and tests/web/registries.test.ts holds it to the
registry: every bundle a source publishes needs a row (a short list of
ids is drawn generically on purpose). A new field is a row there plus an
optional tile; a bundle the shell does not know renders generically.
The registry
web/src/data/registry.ts is the registry document trimmed for the shell
(docs/registry.md), generated by xue registry --shell web/src/data/registry.ts and never edited by hand. The shell takes from it
what the encoders decide: the source ids (ForecastModelId) and each
source’s label, product, pointer, observation flag, core bundles and
cadence (FORECAST_MODELS); the isobaric and turbulence levels; the
family lists (SURFACE_DIAGNOSTIC_IDS, OCEAN_IDS, SOIL_IDS,
AEROSOL_IDS, HYDROLOGY_IDS, PRESSURE_BUNDLE_IDS); the members of every
vector, composite and volume bundle; the parameter, producer, aerosol and
ensemble blocks identity.ts matches a file against (ENSEMBLE_IDS are
the variables carrying an ensemble block); the quality codebooks the
chart ranges in levels.ts and pressure.ts are drawn over
(codebooks.ts); and the storm agencies, models and basins. What stays
hand-written, keyed by id, is chart knowledge: palettes, ceilings and
legend steps, contour intervals, the rail’s core tiles and families,
regions, ?type= spellings, codes and i18n keys, and the two views that
are no source (geo, gibs). Satellite files stay in kelvin; units.ts shows °C in
legends and readouts only.
Default field: with no ?type= and nothing pressed this session
(variableChosen), FORECAST_MODELS[].defaultVariable, else
DEFAULT_VARIABLE. A chosen layer survives a model switch.
Probe panel
A click pins a cell (probe.ts); store and v2 sessions answer one series
message for the whole axis, v1 fills in from decoded planes. Rows
(meteogram.ts) are whatever the manifest publishes, each a probe session
at the primary’s tier, aligned to the primary axis by lead seconds
(alignSeries) so a missing frame is a gap, not a shifted column. Panel and
capsule share --probe-column, so all playheads coincide. Skew-T and
airport overlays: point-products.md.
Each read is asked for once per pin (probeSeriesRequests). One the worker
could not make — the store’s own retries exhausted — is the panel’s to ask
again (probeSeriesFailed: three more times, two seconds longer each),
never a dialog over the map: the rows are the pin’s context, and a frame’s
failure is the only one that stops the page. A bundle that would not open
is tried again the same way (probeOpenFailures), and the channel it never
opened is ended. Because a read is asked for once, its reply is taken
whenever it comes: a series is the whole axis, so the frame-request
generation, which moves with every step of the transport, says nothing
about it — only a moved pin (another cell) or another dataset (another
session) makes a reply stale.
The rows are wide and short and belong over the transport; a sounding is a
square, and stacked under the rows it made a slab over the middle of the
map, where the pinned point is. probelayout.ts keeps the two apart, by
the window’s width:
- From 1120 px,
side. The sounding’s body is docked (SoundingSection.dock) in a card on the right, under the top row of buttons and inside the control column; the panel keeps the rows, and its SOUNDING row opens and closes the card. Under 1912 px the centred capsule would reach under the card, so the card sets--dock-righton their parent and the capsule and the panel move over together and keep to the width left of it — together, so the rows stay on the transport’s axis. - Under 1120 px,
tabs. The panel shows one page at a time — the rows, the observations, the sounding — picked by tabs in the sticky head (data-page; a section’s own header becomes a caption). Leaving the sounding’s page folds the section, so nothing keeps reading the run’s levels for a chart that is not on screen; a section that opens itself (a station card’s button, the marks switched on) takes the tab with it (probePageFor). - At 720 px and under, the phone’s panel is also capped at half the
screen (
data-tall), with a button in the head for the whole height.
Whenever the panel or the card comes to cover the pin — a fresh pin, a page
turned, the panel grown by rows that arrived late — the map is eased so the
pin sits in the middle of what is left clear (aimOffset). A pin in the
clear is never moved, and neither is one with no clear map to go to. The
decisions are plain functions (probeLayoutFor, probePageFor,
aimOffset, cardCrowdsCapsule), tested in tests/web/probelayout.test.ts.
Cross-section
The section button of the view tile takes one drag over any dataset whose
run has a column store (its own, or the lender’s on one that borrows its
upper air); over a volume it is still the volume’s. The line is
view.section, held to hundredths of a degree from the moment it is drawn
so that ?section= and the screen agree, and it outlives a switch of
dataset: where there is no store it is dashed on the map and the panel is
one row saying why. A case has none.
shell.tsis all thatmain.tsknows: whether the tool is offered, and calls handed on, none of which throws back. The rest is loaded with the first line (a link’s, or as the tool is taken up).control.tsis the controller. It starts a section when a line is drawn or a run opens. A run that ends takes the chart off at once; the next is read whole (generation), so the chart is never of two runs, unless it names the same store (a run published again with a bundle added), whose chart is put back. Over a dataset without a store, and until there is a first chart, the panel is one row; a run that does not open (runFailed) leaves it so. It is drawn fromframeShown, after the playback’s own work, at the primary’s valid time, and gates nothing.source.tsandline.tsread the store: what an array is of is its members’ parameters (identity.ts::columnQuantity), never its name; the line is sampled along its great circle about half a cell apart, limited by the blocks it crosses (MAX_BLOCKS) rather than by its length, and read on a channel of its own, so the pin’s reads and the section’s never supersede each other. A read that hears nothing forSTALL_MSends with its channel, and is the reader’s to ask again.renderer.tsdraws the plot in a worker (engine.ts,field.ts,derive.ts,draw.ts); the canvas is the plot alone.panel.tsis the axes, the controls, the legend and the crosshair around it, all DOM: reading the chart never redraws it.maplayer.tsis the line on the map.
What the worker draws in units (the isotachs, the freezing line’s label,
the heights the right axis may name) it is told as numbers in the draw state
(displayunits.ts), each step round in the unit it is read in. The distance
axis measures its labels and drops marks until they keep apart, then all but
the coordinate that changes more; its ends always stay.
When the panel has come to cover part of the line the map is eased, once, so
that the line lies in the clear map above it (aim.ts, on screen points): for
a line just drawn, one a link brought, and a panel back after a pin. A line
in the clear is never moved, and neither is the map for a frame or a run.
The fill is taken from the map’s field when the line is drawn and is the
panel’s from then on: the map’s ramps are windowed to one level and the
section’s span the column. The panel has the probe panel’s slot; while a
point is pinned it steps aside (probeShown), and a line drawn closes the
pin. The ground is the model’s own, which the note under the chart says.
The preview of the drag is the great circle, not the straight line of the
screen, its words stand at the end of what would be drawn (short of the
pointer where the line is cut), and an end that does not project back to
where the pointer was (off the globe, in the sky) is refused
(volumetool.ts); over the relief the way back is inexact, and more is
allowed. On the flat map a drag half way round the world and more is refused
without a word: the great circle goes the other way.
Workbench
/workbench (workbench.html, workbench.ts) reads one run in depth along
a line or at a point: the section, the profile and the hours ahead side by
side on one axis of pressure, over lanes of the surface. What one chart can
say is the map page’s; the workbench is for what takes two read against
each other. The section panel and a pinned point’s panel link to it
(workbenchlink.ts) with their line or point, their valid time and the
section’s fill and top, where the run has a column store of its own
(borrowed ones do not count), outside a case and on the site’s own pages;
the links are rewritten as they are reached for, since the playhead moves
under them. It links back with ?section= or ?point= and ?time=.
state.tsis the state and its address. Three coordinates are shared by every chart: where (a point of the line’s plan, or a cell), when (a valid time, never a lead, held to a frame of the store) and how high (a level of the store).history.tswrites them: a coordinate at rest is one entry, how the charts are drawn replaces the entry there is, andpopstaterestores.page.tsputs it together. A gesture on a chart is a crosshair (pad.ts: the chart’s own axis and the height together, the profile only the height), draws from memory and commits when it is let go of; Escape takes it back. The bar’s play button steps the time through the frames the time chart spans and round again, holding each until the map has read it; stopping is one entry, and any other move stops it. A place under the mouse moves nothing: the profile, the lanes’ rules and the numbers show it until the mouse leaves.engine.tsis the section’s engine with two canvases in one worker: the line at a time (SectionDeriver.slice) and the probe through time (timeSlice, hourly columns linear between frames, for drawing only: every number is read off a frame). A plane is drawn again when its key changes, one of them a frame of the screen.- The read is
createSectionSourcewith 64 MB of chunks held, so a line that shares blocks with the last one reads only the others. A point is the plan of one cell (plan.ts), the nearest and not a blend, as a pin’s is. - The column store has no gust and no precipitation: those two rows are the run’s own series stores at the probe, read when it has been still 400 ms.
run.tskeeps the run the page opened with. A newer one is offered in the header once its column store is out; only where a read of the old one fails and there is a newer one is it taken unasked, and the header says so.- The header’s gear is the viewer’s settings sheet (
settingssheet.ts, with the time zone): theme, language, zone and units change the page in place through the same listeners, the map’s title included; its grids are drawn on the map byCoordinateGrid, clear of the title and the shape buttons. mapfield.tsdraws the height line’s level at the charts’ time under the map’s line: the chart’s fill (the wind’s speed for the wind across a line) on its stepped ramp, and isotherms every 5 °C, through twoForecastLayers; with the bar’s barbs on,mapbarbs.tsadds the level’s wind as barb icons (5 kt steps, turned to the direction) every 56 px of the view, placed again when the map has moved. It reads the map’s stores, not the column store: a column block holds every frame and level of 64 cells, so a view of it is tens of MB where the map’s tiles in view are a few hundred KB. The column store’s members name those bundles (SectionArray.bundles), so both read the same codes.locator.tsis the map. A, B and the probe are buttons the arrow keys move; the line’s body moves the whole of it with its length and course kept (moveline.ts). A line is read when it is let go of.layout.tsshares the window out: the map gives way first, then the lanes, then the page scrolls. Under 1400 px a line shows one plane at a time, under 720 px one plane with a narrow profile beside it. Off a phone the bar offers three map sizes; a larger one takes the lanes before the charts and never leaves a plot under its least. The choice is the device’s (localStorage), not the address’s.
Compare page
compare.html: every live forecast model at one point on one clock, plus
the nearest airport’s METARs. No map, no playback: pages/compare/series.ts
opens each store in a Zarr worker, sends one series per variable and
terminates it. pages/compare/axis.ts is pure arithmetic
(tests/web/compare.test.ts). The cell is probeCell on the full tier, so
it matches the viewer’s probe; regional models appear only inside their
domain (modelCoversPoint). State is lat, lon, span, fields;
hidden and pinned models are localStorage.
API console
api.html: a form over the data API’s routes (docs/api.md) that sends
the request from the browser and shows the status, the headers the API
exposes and the body. It is hosted on the site, not on the API’s origin,
because it reads the run’s manifest from the bucket, whose CORS admits
the site. For /v1/cell it turns a latitude and longitude into the row
and column (pages/apiconsole/locate.ts: the server’s probe_cell rule, with
floor(x + 0.5) where the viewer’s probeCell uses Math.round, the
canonical query and run_directory). Grid reads go only through
/v1/cell: /v1/point is not offered, so the page shows the cell-addressed
way a client should ask. The live run is the Collection’s
pointer on the API’s dataOrigin. State is the page’s query, spelled as
the request’s. English only, like the OpenAPI reference; noindex and
out of the sitemap. Pure parts: tests/web/apiconsole.test.ts.
Past storms
typhoon.html: the storm archive (docs/tc.md §8–9) on one map, linked
from the showcase header. A panel beside the map (under it on a phone)
picks the season, the basin and the storm. A season opens as every track
of its overview at once (products/tc/seasonlayers.ts: one GeoJSON segment per
synoptic step, by Saffir–Simpson class, the strongest on top, the basin
chip filtering and framing them); pointing at a track or a row names and
thickens it, and picking one loads that storm, which the storm layers draw
above the season’s tracks, faded. ?season=YYYY is written back on a
season and ?storm=<ATCF id>&issue=YYYYMMDDHH on a storm, each with the
basin chip’s ?basin= (kept across seasons that have the basin, dropped
by a linked storm of another); without a season or a storm the page opens
on the season running now.
products/tc/archive.ts reads the catalog, the season and month indexes and one
storm’s spans of best.jsonl, forecasts.jsonl and errors.jsonl by
Range, and turns them into what the page draws: stormAt builds the storm
the live product would have carried at one issue time, so the viewer’s
StormLayers draws it unchanged with the time held at the issue. Its own
plain basemap; a theme or language switch swaps the style and makes the
storm layers again on style.load (no WebGL layers to lose). The pure
parts are in tests/web/tcarchive.test.ts. The best track is drawn by
Saffir–Simpson class and with its wind radii (products/tc/intensity.ts, options
of StormView the live viewer leaves off), and a southern season’s
July-to-June span is said beside its chip. The slider stops at every best-track
synoptic time and every issue time (storyTimes); it plays at four
steps a second, and the MP4 is that playback captured through
mp4export.ts with a GifHost of the page’s own.
Storm pages: web/tooling/stormpages.ts writes one static page per
archived storm of a season with forecasts, per such season and for the
archive (/tc/…; older seasons of best tracks alone stay on the storm map,
past a Pages deployment’s file limit otherwise), in English at the
root and in zh, zh-hant, ja and ko under a prefix, the blog’s
layout: each names every translation with hreflang (English the
x-default, whose page sends a reader to their site or browser language)
and its Open Graph locales. Each carries JSON-LD: a BreadcrumbList, a
storm’s WebPage whose mainEntity is a Dataset of its record (dates,
the track’s box, IBTrACS and the verified sources; no box for a track
across the antimeridian), and a season’s or the archive’s CollectionPage
with an ItemList of what it links. A storm’s and a season’s tracks on a map
are pictures drawn apart from the archive (docs/tc.md §10,
tc-images/, never inside tc/archive/). A storm page shows the light or
dark WebP by prefers-color-scheme in place of the inline SVG, a season
page shows its picture under the header, and each page’s dark PNG is its
og:image and the ImageObject of its WebPage (and a storm’s
Dataset); a page the index lacks keeps the SVG (a storm) and the site’s
card. Built in discovery.ts’s bundle step from the
published archive, so deploy-pages.yml also runs daily after the archive
job; a build without a data root skips them (tests/web/stormpages.test.ts).
Case pages: a case is the viewer, at /showcase/<id> (camera in
#map=), one page per catalog case, parts included, in every language
(Language paths). web/tooling/sitepages.ts writes
each from the built index.html and the published showcase.json, read
with the shell’s own validateCatalog: the case’s head (title, the summary
cut as the description, canonical, hreflang, a BreadcrumbList and a
schema.org Dataset for the slice), the case panel (#case-banner:
title, summary, region, marker buttons, the event’s part links)
prerendered, and the noscript note replaced by the case in words
(facts, markers with notes and sources). caseview.ts::updateCasePresentation
writes the same elements again from the catalog (textContent,
replaceChildren), so nothing doubles. The summary card folds
(setCaseSummaryOpen, the last choice in localStorage); with no choice
made it opens on a wide window and is folded at 720 px and under, where the
open card hides the legend, shows the whole title and takes half the screen
at most. The list (/showcase) is written
with the listed cases’ cards and their ItemList (showcase-cases), which
showcase.ts replaces once the catalog loads and keeps when it does not.
lastmod in the sitemap is the later of the catalog’s generatedAt day and
sitepages.ts::PAGES_REVISED, the day the pages’ own copy last changed
(moved by hand, and the datasets’ pages’ lastmod alone); the pages appear with the next Pages
deploy after a catalog upload, and a build without a catalog writes none
(the dev and preview servers still serve the viewer at any case’s path).
The case pages of #223 (/cases/…) are redirected by web/public/_redirects
(/:lang/cases/:id → /:lang/showcase/:id).
Airport pages: web/tooling/airportpages.ts writes one static page per
airport in web/tooling/airports.json and an index grouped by country
(/airports/…), in the storm pages’ five languages, layout and head
(hreflang, Open Graph, BreadcrumbList plus a schema.org Airport). The list
is checked in and edited by hand (names and the city served in the page languages from Wikidata,
the IANA zone computed once with tzf), validated at build, and is the only
membership: a page never depends on the live product, so every build has
them, and their sitemap lastmod is the later of the list’s updated day
and airportpages.ts::AIRPORT_PAGES_REVISED (moved by hand when the pages'
own copy changes). A page’s og:image and the ImageObject of its
WebPage are the airport’s share card, named by the published
airport-images/index.json (docs/airport.md §8) that
discovery.ts reads at build; without it the pages keep the site’s card,
and deploy-pages.yml follows every airport-images.yml run. The static
page states the airport and links the map at it (?stations=apt), the
compare page and its nearest listed neighbours; the weather is the live
block, web/src/products/airports/live.ts, built as the airport entry of
vite.config.ts (a few kB plus chunks shared with the shell, no MapLibre)
and linked by the pages from the bundle. It reads the product the way the
probe does (products/stations/fetch.ts: pointer, index, one range read of the
station’s line), takes its words from the page’s #live-config, and
renders the newest METAR raw and decoded, the day’s observed high and low on
the airport’s clock (products/airports/today.ts), the TAF and its groups, and the
24-hour window, in the viewer’s units (tests/web/airportpages.test.ts).
Below it the model forecast (#models): the static page names the runs it
reads (products/airports/modelchart.ts::airportModels: GFS, ECMWF, AIFS, and HRRR
inside its domain), and once the reports are in, live.ts imports
products/airports/models.ts, which reads each run’s tmp2m, prate and wind10m
at the cell nearest the airport through the comparison page’s reader
(pages/compare/series.ts::readPointSeries) and draws them as one SVG meteogram
across models, a day back and five ahead on the airport’s clock, models told
apart by dashes and the reports as dots. The decoder’s chunks load only
then, so the METAR never waits on them; a model that cannot be read is left
out.
The viewer’s airport card links a listed airport’s page; the shell gets
the ids alone through virtual:airport-pages (airportPageIds).
Storm names: products/tc/namestable.ts holds the western Pacific list in the
scripts the CMA, CWA, JMA and KMA write it in, plus the CMA’s simplified
Chinese for every other basin’s lists, and localStormName (products/tc/names.ts)
is what every storm label, list and card shows (tests/web/tcnames.test.ts).
The zh names follow the National Meteorological Centre’s naming tables on
nmc.cn; the other scripts were compiled from the agencies’ tables as the
Wikipedias cite them. A name a naming committee adds is added by hand.
Layout and theming
- Title top left (opens
#model-sheet); three round buttons top right; colour scale on the left edge; one 48px tile per layer on the right; one capsule at the bottom, ≤ 960px. The range input is transparent and only carries hit area, keyboard and accessible name. - Round controls, zoom tile, rail and credit mark share one 44px column at one right offset (20px, 16px on phones); keep new controls on it. The credit line shows only above 1400px.
- Each layer keeps the ground its palette needs, so chrome and map tokens
are separate. Things floating on the map use
--map-ink/--map-ink-muted, followingbody[data-ground]fromapplyBasemapTheme. The coastline is the shell’s own layer; forecast layers insert below it, and the rivers (lines from z9, the tiles’ limit) draw right above it, over the fields. - Theme and locale switch in place, never by reload (
onThemeChange,onLocaleChange).map.setStyledrops the custom WebGL layers, sosyncBasemapStylediffs layer properties instead (basemap.ts::applyBasemapStyleDiff).index.htmlrepeats theme detection inline so the first paint is on the right ground. isDark,locale,htmlLang,basemapLang,displayZoneare live bindings: read them at use, never capture them in a module constant.- The Protomaps key allows the production domains and
localhost, not127.0.0.1(Playwright’s origin, hence stubbed tiles). See the real basemap athttp://localhost:4173.
i18n, time and URL state
- Thirteen locales under
locales/, eachRecord<MessageKey, string>againsten.ts, the source of truth and the only one with design notes. Only English is bundled; every other dictionary is a chunk of its own (i18n.ts::loadLocale), the page’s one fetched asi18n.tsevaluates and awaited by each page entry (await localeReady) before its first render, sotstays synchronous and reads English for a dictionary that is not in.setLocaleloads, then swaps; a failed load leaves the page in its language. The build tooling importsalllocales.ts, which registers all thirteen at once. Translate only human-facing copy: errors, worker messages, instrument codes (F058,PLAY), diagnostics,UTC+9and zone ids stay English. Long-lived status copy goes throughsay()so a switch restates it. - Observation datasets (
isObservationModel) read “OBSERVED” and the frame’s clock time instead of “FORECAST HOUR” /F058: an observation has no run to count from. - Valid times use one display zone (
timezone.ts). Under the defaultautoit is the browser’s, or the pinned point’s (tzf-wasm, a 4 MB index loaded on first pin); an open showcase case stands in for the browser with its own zone (its row’stimeZone, or the one at its box’s centre), and a pin still wins over it; the settings sheet can hold it on the browser’s zone, UTC or any IANA zone instead (xue-zonein storage, not in the URL). Run cycles and showcase cards stay UTC. - Query state is parsed in
urlstate.ts, except the language (the path’s prefix, and an old?lang=:i18n.ts),?theme=(theme.ts) and?units=(units.ts); the table below lists every parameter of the main page. Unknown values fall back to defaults. - The camera is the fragment
#map=<zoom>/<lat>/<lon>, so a pan never touches the query.parseCameraFromHashonly says whether a link fixed the view; the region is framed on a model switch or a first open without a camera, never on a retry or a new run. - A case is framed by
applyCaseCamera: the camera is held to itsbbox(caseCameraLimits), and on the first open without#map=it jumps to the fit — or to the row’s optionalview(showcase-catalog.tsShowcaseView:center,zoom,pitch,bearing,terrainas an exaggeration orfalse), which a mountain case uses to look from a side with the relief up. The view’s terrain goes through the samesetTerrainthe view control’s switch uses, so URL, switch, lapse row and peak labels follow from theterrainevent; a link carrying?terrain=(on or off,searchNamesTerrain) outranks it, as#map=outranks the framing. Aviewthe shell cannot read is dropped with one warning and the case opens on the fit. The view’s optionalvolume(a volume bundle among the case’s variables) is applied on the first entry into the case (applyCaseVolume, beside the case’s default field) by setting the oneViewState.volumethat?volume=and the overlay tile set, so the tile, the address bar andapplyVolumeOverlayfollow from it once the manifest is open; a link that said anything about the volume (?volume=,offincluded:ParsedView.volumeRequested) outranks it, the tile still turns it off, and a volume name the shell does not know is dropped from the view without a warning. A dataset reached only through cases (woof,efas,efaswb) has no pointer:isCaseOnlyModel, absent fromFORECAST_MODEL_IDSand the model sheet, has no path, and?model=naming it goes to/. - A case may name a dataset this build has no
FORECAST_MODELSentry for: a catalog row whosemodelmatches no label is admitted from the row itself (registerCaseDataset, called last inshowcase-catalog.ts::validateCase) as a case-only dataset with the row’smodelId,modelas its label, itsproduct,defaultVariable, itsvariablesas the rail core, no core bundles, and itsdataBboxas the region unless the grid goes around the globe. Its manifest then validates like any case’s, its fields draw through the generic card and a rail tile each, and the eyebrow shows the label. A row is still refused when itsmodelIdis a built-in id or is not a lowercase slug, when another row admitted the same id with a different label or product, or when its label is already another dataset’s. Nothing about it reaches the model switch, the paths or the comparison page. - A case may say how its axis is read (
timeline,showcase/README.md).dailyis a record of days:showingDailyRecord()reads each frame by its UTC date (the readout, the tooltip, the export stamp,aria), stamps the run line with the days the case spans and the track’s ends with their dates, and leaves the lead hours and the display zone out. Every other case is read by its dataset, as before.
Language paths
Every page of the shell comes in the thirteen locales, the language in the
path (sitepaths.ts, no runtime imports): English at the root (and the
x-default), the others under a lowercase prefix (/zh, /zh-hant,
/ja, /ko, /de, /fr, /es, /pt, /tr, /ru, /ne, /ar;
products/tc/pages.ts::PAGE_PREFIXES is the same table):
- Pages:
web/tooling/sitepages.ts(called fromdiscovery.ts’s bundle step, after Vite’s HTML step) writes a copy of each built page per locale (ja/index.html,ja/hrrr.html,ja/showcase/<id>.html, …): the static copy translated asapplyStaticMessageswould (translateMarkup:data-i18n*,<html lang>, links to the shell’s pages), and the head written per language (writeHead: canonical to itself, the thirteenhreflangalternates plusx-default,og:url,og:locale; the title fromcompareTitle,metricsHeading,tcHistoryHeading,showcaseHeadingwhere a message exists, else the English one). Every copy names its assets root-absolute (absolutizeUrls): the build’sbase: "./"would resolve./assets/under/ja/showcase/. Shell code that builds a URL does it root-absolute too (site.ts::dataBaseUrlis/data/,peaks.ts’s/peaks.json,i18n.ts::shellPath/caseHreffor links); workers and the wasm resolve againstimport.meta.url. - The storm (
/tc/…) and airport (/airports/…) pages keep their five languages (STORM_PAGE_LOCALES,pagePrefix): a locale without them links to the English ones. i18n.ts: the locale is the path’s prefix. An unprefixed page doubles as the language chooser:sitepaths.ts::LANGUAGE_CHOOSER, injected right after<meta charset>of every page by thelanguageChooserplugin (dev and build) and dropped from the other languages’ copies, sends a reader whose stored (xue-locale) or browser language is another locale to its prefix, path, query and fragment kept; a crawler, a prefixed page and a link still carrying?lang=stay. Switching in place (setLocale) stores the choice and moves the prefix withreplaceState;applyStaticMessagesre-points every link to a shell page (localizedHref).- A build that ships the viewer alone (an embedding,
building-on-xue.md) has neither the copies nor the
chooser:
LANGUAGE_PATHSis false there, the locale is?lang=, else stored, else the browser’s, and a case stays?case=<id>on the page. - Old links, moved by the shell with
replaceStateon boot:?lang=<tag>on any page goes to that prefix without the parameter;/?case=<id>[&lang=]to/<prefix>/showcase/<id>; then?model=on a home to the dataset’s path (/?model=hrrr&lang=ja→/ja/hrrr).i18n.tsplaces the language and the case,main.tsthe dataset. The deployment is static files alone: no Pages Function.web/public/_redirectsmoves #223’s/cases/…pages to/showcase/…. - Agent discovery:
web/public/_headersputsLinkheaders (llms.txt, sitemap, API catalog) on/, servesllms.txtastext/markdownand/.well-known/api-catalog(RFC 9727, pointing at the API’s OpenAPI document and the STAC root) asapplication/linkset+json;robots.txtcarriesContent-Signal. - Sitemap: every locale’s copy of every page but
/api(noindex), then the storm and airport pages. The dev and preview servers serve every path as Pages does (sitePathRewrite: the source page on the dev server, the built copy on preview). An unknown path, prefixed or not, is Pages’ 404.
Dataset paths
The live dataset is the path, one segment after the language prefix:
/hrrr?type=wind#map=…, /ja/hrrr. / is the home on the default
dataset; a case is at /showcase/<id>.
- The path set is
pageModelIds():FORECAST_MODEL_IDS(modelpaths.ts) that the build serves and that are not case-only, views included (geo,gibs,cma, …), lessNO_PAGE_MODEL_IDS. Never list it by hand.NO_PAGE_MODEL_IDS(mrms3d, its live publishing paused) are live but get no page: no<id>.html, no sitemap entry, and the shell keeps them on/?model=<id>(searchForLiveModel). urlstate.tsreads the model from the path after the prefix (the canonical id only: Pages serves nothing else there), then from?model=, then the default (parseModelFromLocation).syncUrlwrites the path withreplaceState(livePathname, behind the page’s prefix):/<id>for a live view,/showcase/<id>for a case,/for a dataset with no page and the home while it shows the default and no dataset was chosen.searchForVariabledropsmodelfrom the query;searchForLiveModelputs it back for a dataset with no page.- Old links:
legacyModelLocation(modelpaths.ts) maps/?model=<alias>(/ja/?model=alike) to/<id>?<rest>, a case-only or unknown dataset to/without the parameter, and leaves a dataset with no page alone; it is the last of the steps above. - Pages:
sitepages.ts::renderModelPagewrites<id>.html(and<prefix>/<id>.html) with the head frommodelpage.ts, in the page’s language (title, description, canonical, hreflang, social card), and the title block and the no-script note naming the dataset. The page’s JSON-LD graph keeps the site and the author and gains the dataset’sDataset; the home’s own nodes (the application, its source, the catalogue of live datasets) stay on the home, and the page names them by@id. Label, product, region, frame step, layers and live pointer come from the table, the producer and grid from the title block’s line (MODEL_EYEBROW); theproducerproviders (creator), the licence links and the longer English description come fromxuebuild/stac_prose.json(modelpages.ts::datasetProvenance), which the tooling reads and passes in so the shell bundle never carries it. A mosaic lists its members' producers and licences; GIBS, which is no source, has its own entry (VIEW_PROVENANCE); a dataset whose prose names no licence claims none. A case’sDatasettakes its source’s the same way. The build fails when an id takes the name of a page, directory or public file (the build’s output,web/public/including404.html,web/*.html, every locale’s prefix). - Links: every row of the model sheet (
index.html) is an<a>to the dataset’s page, so each page of the viewer links them all; a plain click switches in place, any other is the browser’s. The sheet’s last group links the airports’ index and the storm archive, and those pages link each other, the home and the cases at their foot (stormpages.ts::siteNav). web/public/404.htmlis the site’s 404: with a top-level404.htmlPages answers any path it has no file for with that page and status 404 instead of the viewer with 200, so a stray path is no soft 404. It is static (no bundle, no map) and the only page markednoindex.- On a dataset’s page the shell keeps that dataset’s description, the home the site’s, both in the page’s language.
URL parameters
Every parameter the main page (index.html) reads. Written means the
shell writes it back into the address bar as the view changes
(syncUrl → searchForView + searchWithScene, mapprefs.ts,
theme.ts), so a copied link reproduces the view; read once means it
is read at load, kept in the link as given, and needs a reload to change.
Stored names the localStorage key a parameter falls back to when the
link says nothing; the link always outranks storage. A switch accepts
on/1/true/yes and off/0/false/no (SWITCH_ALIASES).
| Parameter | Values | Default | URL | Stored | Notes |
|---|---|---|---|---|---|
model | dataset id or alias (MODEL_ALIASES) | — | moved to the path; written for a dataset with no page | — | An old link’s: redirected to /<id> (Dataset paths); a case-only or unserved id goes to /; mrms3d stays as given. |
case | showcase case id | — | moved to the path | — | An old link’s: redirected to /showcase/<id> (Language paths). Written only by a build with no case pages. |
type | field alias, bundle id, pressure surface, or precipsetup | dataset default | written | — | The primary; a pressure surface is the lines alone. precipsetup is the precipitation setup on prate. |
lines | pressure surface, or none in the setup | none (setup: prmsl) | written | — | Lines over a filled field. |
flow | qflux<level> or wind<level> | qflux850 | written | — | The setup’s particle flow; dropped outside the setup. |
section | lat,lon,lat,lon | none | written | — | The line of the cross-section, A first, to 0.01°; dropped in a case. |
point | lat,lon | none | written | — | The pinned point, to 0.01°; dropped in a case. |
time | valid time to the hour, 2026-11-27T18Z | — | read once, then dropped | — | Opens on the nearest frame, paused; ignored in a case. Not written: a playing run would rewrite the address every frame. |
accum | window (3h, 30m) or UTC range (2026111106-2026111400) | rate | written | — | Precipitation total; only on prate outside the setup. |
particles | switch | on (off under reduced motion) | written when chosen off | xue-particles | Only a chosen off is written. |
phase | switch | off | written | — | Precipitation by phase and the 0 °C line; stacks on the setup. |
volume | volume bundle id (cloud3d) or off | none (a case’s view.volume) | written | — | 3D volume over a 2D field; any volume= outranks the case’s. |
vexag | number, 0–200 | volume’s own | read once | — | Volume vertical exaggeration. |
projection | globe | plane | written | — | |
terrain | switch or exaggeration (≤ 10) | flat (a case’s view.terrain) | written | — | on is 1.5×; any terrain= outranks the case’s. |
shadow | switch | off | written | — | Terrain shadows, from z9. |
contours | switch | off | written | — | Elevation contour lines over the relief. |
gibs | GIBS_LAYERS id | none | written | — | NASA GIBS daily picture (the gibs dataset or a case’s imagery). |
radar | on, a NEXRAD site id, off | off | written | — | on marks the sites; a site draws alone. |
radarproduct | n0b / ref, n0g / vel | n0b | written | — | Written only for velocity. |
stations | comma list: snd, apt, synop, fire, aq, alerts (aliases) | none | written | — | Point-product marks. |
tc | storm id, or off | active storms | written | — | Tropical cyclone tracks. |
tcagency, tcmodel | comma lists of keys | all | written | — | Which agencies and models to draw. |
tcmembers | switch | off | written | — | Ensemble members. |
grid | comma list of mgrs, utm, gars, bng, latlon, or off | none | written | xue-grid | Reference grids (settings sheet). |
units | preset and overrides (units.ts) | auto (region) | read once | xue-units | The settings sheet writes storage, not the link. |
lang | locale code | the path’s prefix | moved to the path | xue-locale | An old link’s: redirected to that locale’s prefix. Read only by a build with no language copies. |
theme | light, dark | system | written on switch | xue-theme | |
res | auto, half / low, full / high | auto | read once | — | Pins a resolution tier for the session. |
backend | xue, zarr | zarr | read once | — | Comparison switch: the .xue container where a run ships one. |
The camera is not a query parameter: it is the fragment (above). Other
pages read their own: compare.html (span, fields), typhoon.html
(storm, issue), api.html (api, route and the route’s fields).
Embedding
A page that builds this shell from source can draw its own layers over the
map in step with playback through window.xueViewer (embed.ts). It is
always installed, at the end of the map’s load callback, and announced by
a xue:ready event on window; a script that runs later finds the object
already there. How such a page is laid out and built, the build-time
variables (VITE_*) that fit the shell to another host and data root, and
what the data root must hold are in
building-on-xue.md. Such a page may also colour its own bundles:
window.xuePalettes, set before the shell’s module runs, maps a bundle id
to at least two [value, r, g, b, a] stops in increasing value (channels
0–255, palettes.ts::readHostPalettes), or to { stops, sampling } where
sampling (smooth or nearest) overrides how the field is drawn between
cells — nearest for a field one cell wide, whose bicubic would blend in
the no-data neighbours. A declared palette replaces the one
the field’s identity picks, on the map and in the legend, whose bar spans
the first stop’s value to the last’s with six ticks read off its codes; a
malformed declaration is ignored and the shell’s palette stands.
VITE_RIVER_COLOR=field colours a case’s river reaches from the selected
scalar field, using its existing GPU textures, palette and frame blend: each
line segment takes the field’s cell under its start vertex, so the colour can
change along a reach. A class field steps between frames at the midpoint, as
its fill does, and the field’s own clips (a model’s domain, a mosaic member’s
longitude band, the frame’s coverage) apply to the reaches too. The cell is
found with the field’s GridForm and the shared tableCell shader, borrowing
the uploaded projection table on a native Lambert grid; while a new grid has
no frame or table the reaches are not drawn. With no scalar fill to borrow (a
vector or composite field, or the fill hidden) they fall back to the catalog’s
colouring. It needs no additional data reads. The line widths still follow
the river track’s discharge. Without this option, the catalog’s
river.color behaviour is unchanged.
- Readiness.
time(),setTime()andsource()return null until the shell is ready and a dataset has loaded, and again while a model switch is in flight (selectedModelIdnames the next model beforemetadatadoes). Wait for the firstsourceevent. timeis the timeline pointer: the frame asked for, which may lead the screen by a frame while it decodes. The event fires fromupdateFrameReadout, once per valid time; a locale or zone change, which re-renders the same frame, stays silent. It fires on every frame during playback, so a listener must be cheap.openCase(id, { time, play })opens another case of the catalog in place — the open path a case’s link takes, without a reload — and resumes at the frame nearesttime(the first frame without one), playing unlessplayis false. The view (layer, camera) stays, the last frame stays drawn until the new case’s first replaces it, and the address bar follows the case. It returns false off a case or for an id that is not a slug; an id the catalog lacks fails as its link would. A page that splits a long record into consecutive cases plays through them by opening the next on the last frame whileplaying().setTime(ms)stops playback and selects the frame nearest toms: a time outside the axis lands on the first or the last frame. It returns the valid time it landed on, or null when the shell could not select the frame yet (its layers still being added).sourcefires fromapplyVariable, once per (model, run, run time, variable, case): a rolling window, which names no run, fires again as each round moves its run time on, and a re-tier of the same variable stays silent.modelis the source id (gfs, a case’s own model),variablethe bundle id,manifestCrc32the live pointer’s (null for a case). The GIBS imagery view has no variable session, so it never yields a source:source()stays null and the event does not fire there.- Ground. There is no theme API. Ink for marks on the map follows
body[data-ground](see “Layout and theming”), which changes with the theme and with the variable, so read it at draw time or observe the attribute. mapis outside theversionpromise. It is MapLibre’s own object and changes with MapLibre upgrades. The shell’s layer and source ids carry no prefix, so an embedder prefixes its own and adds, never edits or removes, the shell’s. Its layers survive a theme or locale switch, becausesyncBasemapStylepatches properties in place and never callsmap.setStyle.- Listener exceptions are caught and logged; they never reach the shell.
versionchanges only for an incompatible change; fields are only added.
Discovery
What the shell says about itself must match what the encoder publishes.
web/index.html and web/showcase.html carry static metadata, hreflang and
JSON-LD; pagemeta.ts rewrites title, canonical and og:url per view (a
case is its own page /showcase/<id>, a live view is its dataset’s page
/<id> or the home / (Dataset paths), each language’s
copy is canonical to itself (Language paths); typhoon
opened bare is the page /typhoon whichever storm it shows, and opened on
a ?storm= link is noindex, follow, canonical to itself with no
alternates, decided from the address before anything loads: the storm’s
static page is its one indexable address, and a canonical that only the
loaded archive could name was never seen by a crawler’s render). Addresses are written without .html: Pages answers a
.html request with a 308 to the bare path, and a canonical, hreflang or
sitemap entry that redirects is never indexed. Update web/public/llms.txt when xuebuild/sources.py changes
what a model publishes or urlstate.ts gains a parameter.
web/tooling/discovery.ts generates sitemap.xml and llms-full.txt
(README + docs/*.md + showcase/README.md) at build time, so
deploy-pages.yml triggers on those documents too. The sitemap lists every
language’s copy of every shell page, then the storm and airport pages.
Case pages come from
the published showcase.json at VITE_DATA_BASE_URL, never from
showcase/cases/: a deploy build fails if the bucket does not answer.
Storm pages carry a sitemap lastmod: the last best-track day of the storm,
or of the latest storm a season or archive page lists. deploy-pages.yml
runs after every successful archive-tc.yml run.
7 - Building a site on Xue
How to put Xue’s viewer on a page of your own, over your own data, with
your own layers and controls on top, without forking. The shell is not a
package: you pin this repository and build web/ with a Vite config of
your own. Hong is built this way.
What you can rely on
| Surface | Status |
|---|---|
The data formats (docs/) | Versioned, with the compatibility rules in docs/README.md |
window.xueViewer, window.xuePalettes | The embed contract: frontend.md, “Embedding” |
| The build-time variables below | Kept; one may be added |
| URL parameters | May change with any commit |
DOM ids and classes, CSS, the map’s layer and source ids, module paths under web/src/ | Not an interface |
xuebuild (Python) | Not a library: no stable module API, not on PyPI |
Everything in the last three rows changes without notice, so a site pins a commit and re-checks what it touches when it moves the pin.
Layout and build
Node.js ≥ 22, and a Rust toolchain with wasm-pack: the decoder is built
from the pinned source, there is no prebuilt one.
web/vite.config.mjs, a plain object because it is run by the submodule’s
Vite, which your directory cannot import:
- Only
index.htmlis an input, so the build ships the viewer and none of the shell’s other pages (showcase list, comparison, typhoon, metrics, API console), and none of Xue’s per-language or per-case copies. Without them the shell keeps the language out of the address (a link’s?lang=, else the stored choice, else the browser’s) and a case on the page as?case=<id>(Language paths). localhost:5173exactly: the shell’s Protomaps key serveslocalhostbut not127.0.0.1, and Xue’s public bucket admits that origin (Data).- To type-check the overlay, point
typeRootsandpathsof itstsconfig.jsonatvendor/xue/node_modules(maplibre-gl,@types).
Build-time variables
Read from .env in envDir and inlined by Vite, so a change is a rebuild.
Unset means the default.
| Variable | Effect | Default |
|---|---|---|
VITE_DATA_BASE_URL | The data root: pointers, manifests, stores, showcase.json. Ends with / | /data/, at the site root |
VITE_SOURCES | Comma-separated source ids the model switch and the dataset paths (/<id>) offer | every source |
VITE_POINT_PRODUCTS | Comma-separated point products the shell asks the root for (tc, sounding, airport, synop, fire, aq, alerts), or none | every product |
VITE_PROTOMAPS_KEY | The Protomaps key bound to your origin | the shell’s, which serves only its own origins |
VITE_BASEMAP_TILES | Vector tile template of a basemap mirror, absolute | Protomaps’ API |
VITE_BASEMAP_ASSETS | Root holding Protomaps’ fonts/ and sprites/, absolute | protomaps.github.io/basemaps-assets |
VITE_BASEMAP_HIDE | labels (every name, and the peaks), boundaries, or both | nothing hidden |
VITE_TERRAIN_TILE_URL | Tile template of a Mapterhorn mirror | tiles.mapterhorn.com |
VITE_RIVER_COLOR | field: colour a case’s river reaches from the selected scalar field (frontend) | the catalog’s river.color, or the ratio to usual flow |
Data
The data root is static files. Its origin must:
- answer byte ranges with
206, suffix ranges included (bytes=-N, how the reader asks for a shard index); - answer a missing object with
404or403, never a fallback page: the shell asks for pointers a root may not publish; - when it is another origin than the page, admit the page’s origin by CORS
for
GETwith aRangeheader; - serve the mutable objects (the
latest*.jsonpointers,showcase.json) revalidated. Everything else is addressed with?v=<crc32>and may be cached forever, so nothing is ever overwritten under an unchanged?v=and a mutable object is written last.
Xue’s public bucket admits browser reads from an allow-list of origins and
from http://localhost:5173. A page deployed on another origin cannot
read it and serves a root of its own; code that is not a browser reads it
freely (README, “Using the data”).
Runs of a source Xue knows. Run the pipeline into your root:
setup.md, publishing.md. Name
the sources in VITE_SOURCES and the point products in
VITE_POINT_PRODUCTS.
A dataset of your own. Publish it as showcase cases
(showcase/README.md):
- A catalog row may name a dataset the shell has no entry for: a
modelIdslug ([a-z][a-z0-9]*, not a built-in id), amodellabel no other dataset uses, aproduct. The shell admits it as case-only, absent from the model switch and the dataset paths, and draws its bundles generically; give them colours withwindow.xuePalettes. - The stores must satisfy
zarr-profile.mdandbundle.md(shapes indocs/schemas/). The writer inxuebuildproduces them; install it from the pin (with uv:[tool.uv.sources] xuebuild = { path = "vendor/xue", editable = true }) and expect its modules to move. - A time axis holds offsets up to 65534 in units of at most an hour
(
bundle.md), about seven and a half years. A longer record is several cases, joined by the catalog’spartsor by your module callingopenCaseon the last frame. - A root with cases only has no live pointer for a bare visit to open. Send
a visit without
?case=to one before the shell’s module runs (below).
Your module
It runs beside the shell’s and reaches it through window.xueViewer
(the contract). Declare the part of the interface
you use rather than importing the shell’s module:
- Draw on
xue.mapwith layer and source ids under a prefix of your own; add, never edit or remove, the shell’s. - Read your own files from the same data root
(
import.meta.env.VITE_DATA_BASE_URL). - What must exist before the shell’s module runs goes into an inline
script, a second tag from the plugin with
injectTo: "head-prepend":window.xuePalettes, the redirect of a bare visit to a case, and a copy of any query parameter of your own, since the shell rewrites the query string to its view state. - The shell’s elements are yours to hide with CSS but not to remove: its
script reaches them. Ink for anything over the map follows
body[data-ground].
The page’s identity
The shell names its own site in three places, and a build on another host corrects each:
index.html’s static head (title, description, canonical andhreflanglinks, social card, JSON-LD,noscript): rewrite the HTML intransformIndexHtml, which may return{ html, tags }.public/(llms.txt,robots.txt,_headers,.well-known/,og-image.jpg, the icons), copied into the build as is: replace or delete them in the plugin’scloseBundle.- The head the shell rewrites as the view changes (
pagemeta.ts, againstsite.ts): observedocument.headfrom your module and put your origin and name back.
Moving the pin
- Rebuild the decoder (
make wasm) with every move: it comes from the same commit as the shell. - Shell before data. A shell refuses a manifest or metadata version above
the ones it implements, so move the pin and deploy before publishing
data written by a newer
xuebuild. Data already published stays readable: nothing is rebuilt for a newer shell. - Re-check the selectors you hide or mount into, and type-check your module.
Licences
The code is MIT or Apache-2.0. Published data keeps its sources’ terms (README). The basemap and the relief are third-party services with their own terms and attribution.
8 - Delivery: stores, catalog, API, uploads
The pointer/manifest contract is in architecture.md; running uploads is in publishing.md.
Zarr store
Every bundle of one resolution tier of a run or round is published in one
shared store, bundles.zarr/ / bundles.<tier>.zarr/ (profile 2; a series
store and every run published earlier are one store per bundle, profile 1);
zarr-profile.md is normative. Choices the spec does
not explain:
- One store per tier, not per bundle. A per-bundle store repeated its
group document and three coordinate arrays (seven objects) beside every
bundle’s few shards: 88 % of the objects a run wrote, at a Class A
operation each. Shared, they are written once per tier; the group
document is then the one object several bundles share, so it is a merge
of per-bundle parts written last (
assemble-runin a fan-out) and its CRC-32 is every entry’s?v=. - One shard per array (whole axis, whole grid). A bucket bills per object: per-time-chunk shards made a GFS run ~5 000 objects. The shard index, one suffix range, is the whole index. Readers take the shard length from the chunk shape, so earlier per-time-chunk stores still read.
- Inner chunks are regular six-frame chunks of the bundle’s tiles. They match the container’s temporal groups only up to the first step change, so every chunk is encoded from the codes, never copied out of a container.
Writing:
- A build writes each bundle’s arrays straight from its codes:
binconvertper bundle job throughzarrstore.write_bundle_arraysover aCodesSource(NumPy only), the native encoder throughencode/zarrstore.rs, both with up to four tiers in flight over one compression pool, then the store’s part and group document (write_part,finalize_store; the native path’s group document is written byxuebuild/native.py, encoder.md). A bundle’s arrays are a function of the metadata, the codes, the tile, the predictors and its dimension names, so no container is read;tests/test_native.pyandtests/test_zarr.pyhold the two writers byte-identical. Every chunk is decompressed again and compared after compression, and the native writer parses each document and index back with the decoder’s own validators. - A tier’s manifest
bandwidthhint is computed from the delivery it ships: the container’s size where one is written, the store’s otherwise. build-binandshowcase buildwrite the stores alone and the manifest names nothing else;--xue(container=Truein the Python and wheel APIs) writes each bundle’s.xuebeside its store and names both. A store is never derived from a finished.xue.- The
zarrdependency group is for tests and for reading delta stores with zarr-python (xuebuild/zarrcodec.py).
Manifest: a bundle entry and each variant may carry zarr: {path, byteLength, crc32} (crc32 of the group zarr.json, also the store’s
?v=, the same on every entry naming a shared store; byteLength the
bundle’s share), validated by all three validators and stamped by
assemble-run. Entries of one tier share the store’s path, the one
exception to the validators’ unique-path rule. The container fields are present whole or absent whole; an
entry with neither delivery is refused.
Browser (web/src/decode/zarr/, the default channel unless ?backend=xue):
- Fallback order: store by ranges →
.xueby ranges →.xuewhole → store by whole objects (only when there is no container). Probes stream or fail. decode/zarr/worker.tsspeaks theworker.tsprotocol. The format is read in wasm (rust/xue/src/zarr.rsthroughrust/xue-wasm): the group and array documents, the CRC-32C-checked index once per shard, the span of a frame’s tile (a chunk may straddle container groups), the decoded tiles of the time chunk being read, the frame assembled from them and a cell’s series.store.tscoalesces one shard’s ranges per microtask (gap ≤ 64 KB), keeps at most sixteen of a worker’s requests on the wire, and asks again (after 250 ms, then 1 s) for one that died there: every request to the origin rides one HTTP/2 connection, and an edge that closes it takes all of them at once. A request that goes quiet — no response, or no further piece of its body, for ten seconds — is aborted and asked again the same way. A request on a connection the edge closed is not always answered or failed (in Safari a pinned point’s rows were seen to stay empty with no error after one), and one that never settles would keep its place under the limit for good, sixteen of them leaving a worker that reads nothing. Range support is probed once per object (sessions.ts), and the probe’s byte is read rather than cancelled.- A layer’s session has a worker to itself. A pinned point’s sessions —
one per meteogram row, and four per pressure level with a model column on
the chart — share at most four hub workers (
decode/zarr/hub.worker.ts), each hosting many channels: the loop is the same one (decode/zarr/endpoint.ts), the messages travel in an envelope naming the channel, andchannel.tshands the session aDecodeChannelthat hides it.probepanel.tsopens them six at a time. A hub outlives its channels, so closing one frees its reader’s WASM memory (ZarrReader.dispose) once its reads in flight have returned; a dedicated worker frees everything by being terminated. - Compressed chunks sit in an LRU under
payloadBudgetBytes(budget.ts::zarrPayloadBudgetBytes), bounding memory by the prefetch window rather than the axis; a decode re-fetches what eviction took. - A tab that refuses a live manifest or cannot open a live store reloads
once per manifest (
primaryswitch.ts::reloadForNewerShell), the insurance behind shell-first deploys. tests/web/zarr.test.tsholds frames and series byte-identical to the.xuepath;npm run measure:backendscompares backends.
STAC catalog (xuebuild/stac.py)
A static STAC 1.1.0 catalog beside the shell’s JSON; the frontend never reads it. stac.md defines the documents, including the point products'.
- Every document is a pure function of the manifest (or a point
product’s
index.json), the catalog row andsources.py: no timestamps, no hosts, relative links. So the split-build and top-up identity tests cover them. - Written by the CLI, not the converter:
build-bin(whole run),assemble-run,xue stac. A--bundlespiece writes none. Point products write theirs in their own build, after the index and the pointer (write_point_product_documents). - The live Item
<source>/item.jsonis the run’s Item relocated (relocate_item) so its path outlives the run. - Licence and provider prose:
xuebuild/stac_prose.json, held to the registry bytests/test_stac.py.stacindex.pyrenders the rootindex.htmlfrom the same prose; its hostnames mirrorweb/src/site/site.ts. - Uploads: the run Item no-cache with the manifest; Collection, live Item
and root through
upload-r2-stac-collection(run byupload-r2-pointer); showcase documents byupload-r2-showcase; a point product’s byupload-r2-<product>.
Data API (rust/xue-worker)
The endpoint contract is api.md. Production runs the crate as
the native xue-api-server on a self-hosted origin behind a Cloudflare
Tunnel (api-origin.md); no Worker is deployed, and the
Workers build runs only under wrangler dev. What follows is how the crate
is built; the Worker-specific parts (R2 binding, wrangler dev, upload
size) apply to that build only.
- Resolves Collection → pointer → manifest, reads stores by R2 range
(
DATAbinding) and decodes with the crate’sdecode_chunk. - The point products go through
products.rs(pointer → index, theissue=pin, the spatial selection, one cached range read per station) and a module per product (sounding.rs,airport.rs,synop.rs,tc.rs) that only reshapes the product’s JSON: compact rows to objects, fixed point to units, epoch seconds to ISO. The products’ goldens undertests/fixtures/<product>/expected/are their test bucket, so a change to a product’s schema that regenerates a golden also runs these tests. Adding a product is aPRODUCTSrow plus a module; the routes are listed inroute.rs. - Read geometry lives IO-free in
rust/xue/src/zarr.rs, held to zarr-profile.md. The browser reads through the same code (rust/xue-wasm/src/zarr.rs); it keeps the requests and the cache of compressed chunks. A point read and the browser’s series share the cell arithmetic (tile_cell) and the chunk decode (decode_inner_chunk). - The binding is
remote: true(honoured bywrangler devonly), somake api-devruns locally against the real bucket;make api-dev-cdn(DATA_SOURCE=cdn) reads the public origin when the network blocks that. timezone.rsanswers the point’s IANA zone fromtzf-rswith its bundled polygon file compiled into the wasm. That file is most of the upload (4.8 MiB uncompressed perwrangler deploy --dry-run, against a 64 MiB limit on every plan; only the uncompressed size counts). The finder opens on the first point request of an isolate, not at startup, so the 1 s startup limit is untouched.- Only
runtime.rsand the framing half oferror.rstouch the Workers runtime;route.rsand the handlers return plain values, socargo test -p xue-workerruns them natively over the web fixtures through an in-memoryDatathat logs every read.
Uploads to R2 (scripts/aws-config)
All uploads go through the AWS CLI ($(S3) in mk/r2.mk).
- One operation per object. R2 bills each multipart step as Class A, and
the CLI’s 8 MiB default split large shards into ~7.
AWS_CONFIG_FILEpoints atscripts/aws-config, which setss3.multipart_thresholdto 5 GB. It names no profile; credentials stay in the environment. The workflows’ credential probe is ahead-object(Class B), not a listing. - Order:
upload-r2-bundles(artifacts), thenupload-r2-manifest(check-pointer, manifest + run Item, thenupload-r2-pointer);upload-r2is both. The pointer goes last because it takes the run live;check-pointerrefuses a pointer that names another run or whose CRC32 disagrees with the manifest on disk. columns.zarrgoes up bymake cut-columnsin the run’scolumnsjob, before finalize: the store’s objects (immutable; the group document carries every shard’s CRC-32, so a changed cut is a new?v=) and their edge warm-up, with the descriptor handed to finalize, which names it in the one manifest it writes, only for a run R2 does not serve yet (a top-up or forced rebuild of the live run never cuts before the flip). A run already live without its store is attached bymake publish-columns: the manifest and Item, then the pointer last, each behind a check that the live pointer still names the run and manifest the job started from (the manifest is rewritten at its own key, as a top-up does; its?v=changes with the pointer’smanifestCrc32). Shards stay under Cloudflare’s 512 MB cache limit per object (up to ~140 MB, a few GB per run) by sharding along latitude.prune-r2runs in its own job after a successful finalize, six minutes late: open pages poll the pointer every five minutes, so one poll has happened by then; a page that missed it keeps reading the old run until its next one.- Nothing is overwritten under an unchanged
?v=(seepublishing.md).
9 - Publishing
The live site is a static shell on Cloudflare Pages; the data lives on a
public R2 bucket served at dataset.ringsaturn.me/xue/ (bundles exceed the
Pages 25 MB per-file limit). The bucket is managed over R2’s S3 API with
the AWS CLI.
Credentials: an R2 API token’s key pair in AWS_ACCESS_KEY_ID /
AWS_SECRET_ACCESS_KEY plus CLOUDFLARE_ACCOUNT_ID; on Actions the
R2_ACCESS_KEY_ID / R2_SECRET_ACCESS_KEY / CLOUDFLARE_ACCOUNT_ID
secrets. mk/r2.mk points the CLI at scripts/aws-config, which raises
the multipart threshold above every artifact, so each object costs one
Class A operation instead of one per part.
Rules that hold everywhere:
- The pointer goes last, and nothing is overwritten under an unchanged
?v=(which is why rolling windows build each round into its own directory):delivery-and-deploy.md. - The Pages shell deploys before widened or new-source data (releasing).
Forecast runs
prune-r2 considers only <model>.<run>/ directories, so showcase cases
are never removed. Between the assets and the pointer, upload-r2 runs
make warm-r2 (scripts/warm_edge_cache.sh): one GET of every artifact
through the public hostname with the site’s Origin, so the edge and the
tiered cache hold the run before its first viewer (a cold fill from R2 is
about 1 MB/s per object). A failed warm-up
is reported and the pointer goes live anyway; WARM=false skips it.
One workflow per source (publish-gfs.yml, publish-ecmwf.yml, …) calls
the reusable publish.yml on a
schedule and takes a manual dispatch with a dry-run switch. They pin the
native encoder (encoder.md).
publish.yml builds a run in pieces: xuebuild bundle-groups packs the
bundles into at most max_jobs groups of roughly equal cost, each group
builds in its own job (build-bin --bundles …, fetching only its inputs),
writes its bundles’ arrays into the run’s shared stores (bundles.zarr,
bundles.half.zarr; zarr-profile.md),
uploads them (make upload-r2-bundles, which never uploads a part or a
group document) and hands on manifest.part.<group>.json with each store’s
zarr.part.<first bundle>.json; a final job merges the parts into the
manifest and each store’s group document (xuebuild assemble-run), uploads
the group documents, then the manifest, warms both with the shared stores'
arrays (whose ?v= exists only now; a job warms its posters and series
stores), then the pointer (make upload-r2-manifest); a separate job prunes
once finalize has succeeded, after waiting six minutes: open pages poll the
pointer every five, so one poll has happened by then. A page that missed it
(a background tab, a dropped connection) keeps asking for the old run until its
next poll and meets a 404 if that is after the prune. A source in
sources.COLUMN_STORE_SOURCES gets a columns job between build and finalize
(Column store). By hand:
Top-up. When the live cycle is still the newest but lacks bundles the
source now publishes, only those are built and merged onto the live
manifest and the live group documents (make live-store-groups); the
group documents are rewritten under a new ?v=, which every entry naming
them then carries, and the live arrays are not touched. force rebuilds
everything:
A live run published before shared stores names none, so live-stores
stays empty and the top-up’s bundles start the run’s shared store beside
the live one-bundle stores.
Column store
The columns job of publish.yml cuts <model>.<run>/columns.zarr
(zarr-profile.md, “Column store”) before the run goes
live, so a run takes the store with it in one manifest and one pointer write:
resolve, build, columns, finalize, prune. A source with a store therefore
goes live when its store is ready, later by the cut; it goes live without the
store if the cut fails or exceeds 30 minutes (the frontend then reads the
maps’ stores as before), and the next scheduled publish attaches it. The
attach path below is the exception.
Whether it runs is decided in
resolve, cheaply: the source is insources.COLUMN_STORE_SOURCES(so itsSourceSpec.column_arraysis set), the publish is not a dry run, and either- the run is not the one R2 serves (a new cycle, or a source’s first publish): cut mode; or
- R2 serves this very run and the publish found nothing to build (a skip):
attach mode, when
xuebuild columns-missingsays the live manifest lacks the store, or the manifest namescolumnsunder a pointer that carries another CRC-32 (an attach died between its two writes).
A top-up or a forced rebuild of the live run does neither: nothing is cut before the flip, so no cut ever changes what a live run’s
?v=names. Finalize’s merge rule applies (it keeps the base’s store when no member was rebuilt, and goes live without one otherwise) and the next scheduled publish attaches it. A source outside the list (every one until it is enabled) never starts the job.Cut mode (
make cut-columns,mk/r2.mk; build succeeded). The job downloads the parts and, for a top-up, the base artifact exactly as finalize does and runsassemble-runlocally with the same arguments, so the manifest, the shared stores’ group documents and the pointer on disk are the ones finalize will write. If that manifest already names the store (a top-up that keeps its base’s) it stops with no descriptor. Otherwise it fetches whatxuebuild column-inputslists except a group document already on disk (the local shared ones are authoritative, R2’s may be absent or, on a top-up, the old run’s; the series store a widened surface member is cut from is a bundle’s own, which its part job uploaded whole andassemble-runnever writes), runsxuebuild build-columns(which checks each group document against the manifest’s CRC-32 and the local pointer against the run, cuts into the hidden.columns.zarrand renames it), uploads the store with three attempts (immutable; shardsapplication/octet-stream, documents JSON; onlycolumns.zarris ever uploaded), and writescolumns.jsonlast:{run, stores, columns}, the run, the CRC-32 of every shared store’s group document it was cut against, and the store’s own entry. The job uploads it as thecolumns-<model>-<run>artifact right after the cut, whatever follows; a separate step then warms the store, bounded to five minutes and never failing the job, so a slow warm-up cannot lose a complete store. No manifest, Item or pointer is uploaded. Some 4 GB in and 5 GB out for GFS on a ~14 GB runner. Inner timeout 30 minutes (the cut, not the warm-up). Before anything,make check-live-runrefuses (below) when R2 has moved on.Finalize downloads that artifact by name pattern when resolve expected one (no match is the ordinary outcome of a failed or overrun cut and not an error; a download that really fails still fails the job) and runs
assemble-run --columns columns.json. The descriptor is bound: its run must be this run and its group CRC-32s the ones just assembled, and its store must validate; then it becomes the manifest’scolumns. On any mismatch, or an unreadable or invalid descriptor, or a source without a store, it warns and the run goes live without one (never fails for it). Without a descriptor the run goes live exactly as before.Re-runs. A re-run of a red
columnsjob re-runs finalize and prune with the outputs of the first attempt. Before any write,cut-columnsand finalize runmake check-live-run: R2’s live pointer has to be the one resolve saw, or (finalize only) already the one about to be written, else the job exits 1. Publishing an older run by hand, which is how a bad one is rolled back, passes, since resolve saw the newer pointer. A pointer that cannot be read is an error, an absent one (a first publish) is fine, and a dry run checks nothing. Prune only runs after a successful finalize, so a refused one deletes nothing.Attach mode (resolve said skip: R2 serves this run without its store).
make publish-columnscuts from R2’s own objects (each map store’s group document and each member’s shard) and writes, in this order: the store and its edge warm-up (its?v=does not depend on the manifest), the manifest and the Item, the manifest’s warm-up, the pointer last. The live pointer must still name this run, manifest path and manifest CRC-32 the job started from after the cut, after the store, before the manifest and again before the pointer (the warm-ups take minutes). Ifprune-r2ran or a newer run went live it prints a notice and exits 0, the pointer untouched: the store is unreferenced and goes with its run. A pointer that cannot be read is an error (exit 1), never taken for one that moved. Inner timeout 52 minutes.Finishing a flip. An attach that died after the manifest went up leaves a manifest naming
columnsunder a pointer with the CRC-32 of the manifest before. The next attach sees that the manifest without itscolumns, serialized as the writer does, has the pointer’s CRC-32, and only re-uploads the Item and flips the pointer. A manifest that differs from its pointer’s in anything else fails the job.Open tabs. The attach’s second flip changes the live pointer’s
manifestCrc32while the run stays the same; the shell adopts it in place (the manifest’scolumns) instead of reloading the page.Overwrites. The store’s group document carries every shard’s CRC-32, so its CRC-32, the
columnsentry’scrc32and the objects’?v=change with any change to the cut. Cut mode only writes into the directory of a run R2 does not serve, where nothing exists under any?v=a viewer holds, so it rewrites nothing a page can have cached. The attach path is the one narrow exposure: it rewrites the live manifest at its own key before the pointer flips (as a top-up does), so a page still on the older manifest that refetchesmanifest.json?v=<old crc>after a cache miss may be served the new bytes; the pointer’s newmanifestCrc32is what a polling page adopts.Failure isolation. The job is
continue-on-error, so a failure marks the job red and warns but leaves the workflow green. A red workflow would read as a failed publish in the run metrics even though the run is live; the metrics read onlyfinalize <model> <run>and its pointer step, which the job does not touch. A job timeout would be a cancellation, which sets the workflow’s conclusion to cancelled, so each mode runs under an innertimeoutthat fails the step instead (30 and 52 minutes of the job’s 60); the report and warning steps run on failure and cancellation alike. Finalize’s and prune’sifare written out (!cancelled()plus their own needs’ results; a status-lessifwould keep an implicit success() over the whole chain and skip them whenevercolumnsis skipped) so the columns job’s result, whatever it is, never decides whether a run goes live or is pruned.tests/test_metrics.pyguards both strings.Concurrency. The job runs inside the caller’s workflow run, so it holds the caller’s concurrency group (
publish-<model>) while it works, up to half an hour in cut mode, and delays the run’s landing by the same. A source that publishes every hour should not be enabled without thought: the next scheduled publish queues behind it.Two writers, one store. The Python reference (
xuebuild/columns.py) and the native writer in the xuepy wheel (xue.write_columns) emit the same bytes. The job runs underXUE_ENCODER=native, so a locked wheel without the function fails the job loudly (the run goes live without the store) rather than falling back to Python;XUE_ENCODER=pythoncuts a store by hand with the reference.The edge is warmed whole (
scripts/warm_edge_cache.sh --columns), because the edge fills a whole object on the first range request and a shard is up to ~140 MB.
Enabling a source. Add the source’s id to
sources.COLUMN_STORE_SOURCES: sources.py then sets its
SourceSpec.column_arrays with columnarrays.column_arrays, which builds the
arrays from the source’s published bundle ids by registry identity. The wheel
that writes it must be released and locked first (release skill), and the shell
that reads columns must be deployed first (releasing.md),
and enabling one adds a store about the size of its map stores’ arrays to every
run (GFS some 5 GB), so ask before turning one on.
Rolling windows
mrms, jma, cma, himawari, himawarijp, goeseast, goeswest,
meteosat and aurora each run one round of
scripts/window_rounds.sh per job
(ONCE=true) on a five-minute cron (ten for the 10-minute imagers). A
loop dispatch runs rounds until twenty past the next hour and yields to
the next scheduled job (scripts/successor_queued.sh).
A round: compare the newest upstream frame with the live window.json
(make live-window); if there is something new, rebuild the window
(build-bin --run latest --hours N --round HHMM, reusing frames on disk),
upload into <model>.<run>/<HHMM>/ with make upload-r2 … ROUND=HHMM
(WARM=false), then prune: make prune-r2-rounds keeps the live run’s
newest two rounds (clock order; it lists only the run directory the
pointer names), and on a run change make prune-r2 KEEP=2 drops older
runs. One log line per round records the newest frame’s age and each
step’s seconds.
With SEGMENTS=true a round’s stores are cut into clock-aligned segments
(zarr-profile.md) before upload:
the build reads the live pointer and manifest (make live-pointer,
make live-manifest), names again every segment the live round already
published, and writes only the rest under <model>.segments/ — one shared
segment per tier and interval, bundles[.<tier>].zarr, holding every
bundle with frames there.
upload-r2 copies those before the round’s directory, so a round uploads
the hour in progress and whatever hour just closed, not the window.
make prune-r2-segments then reads every round left on the bucket and
deletes the segment directories none of them names; it finds them with
one recursive listing of <model>.segments/, not a listing per segment
start. prune-r2 never counts <model>.segments/ as a run.
Every window workflow except MRMS resolves its encoder at job time: it
takes native when the installed wheel’s native.knows_source has the
model, else the reference pipeline with a system GDAL and a ::warning::
on the run (a wheel on PyPI may predate a source, and a cron run takes no
input). A dispatch can insist on either. MRMS and MRMS 3D pass
encoder: native, so a fallback fails the round.
publish-mrms3d.yml is disabled in the repository’s Actions settings (the
last scheduled round ran 2026-10-05): the live window is paused and the
volume is reached through the showcase cases. gh workflow enable publish-mrms3d.yml resumes the cron; nothing in the tree changes.
How the workflows are built
publish-<model>.yml for himawari, himawarijp, goeseast, goeswest,
jma, aurora, mrms and mrms3d is a wrapper, like the forecast ones:
it owns the cron, the dispatch inputs, the fork guard, the permissions
(actions: read, which the called workflow can only narrow) and the
concurrency group, then calls
rounds.yml with the feed’s values.
rounds.yml owns the job: validate inputs, check the R2 credentials, set
up uv and sync, resolve the encoder, run scripts/window_rounds.sh, verify
the live pointer, upload the publish-report-<model> artifact. A feed
differs from the others only in the inputs it passes:
| Input | Meaning |
|---|---|
model, hours, round_minutes | the feed and its window and loop cadence |
encoder | auto (dispatchable) or native (pinned) |
uv_group | the dependency group to sync (satellite, aurora) |
pip_install | one extra requirement after the sync (jma: the jma-radar tool) |
gdal | always (satellite fetch stage runs gdalwarp), fallback (only when the encoder resolved to the reference pipeline), none |
frame_cache, frames_keep_hours, ancillary, segments | the window_rounds.sh switches of the same names |
cma (a private archive with its own credentials and listing check) and
meteosat (every step skipped when the EUMETSAT secrets are absent, and a
runner GDAL probe) stay standalone workflows. cma stays published and
is reached through its path (/cma) and the showcase cases, but the shell’s
model sheet and docs/sources.md leave it out on purpose.
The steps several workflows share are composite actions under
.github/actions/: check-r2-credentials (empty-secret check and a test
read of the dataset bucket; the secrets are inputs of that one step, so no
other step sees them) and resolve-encoder (the native.knows_source
probe and its ::warning:: fallback; run it after uv sync). Both are
used by rounds.yml, publish-meteosat.yml and, for the encoder,
publish-cma.yml.
Per-source switches:
| Source | HOURS | Extra |
|---|---|---|
mrms | 4 | none |
jma | 3 | FRAME_CACHE=true (jma-radar’s decoded frames, pulled before and pushed after, pruned to seven days) |
cma | 3 | XUE_CMA_ARCHIVE secret, uv sync --group cma; CMA_ARCHIVE_ACCESS_KEY_ID / CMA_ARCHIVE_SECRET_ACCESS_KEY when the dataset token cannot read the archive |
himawari, goeseast, goeswest | 6 | FRAME_CACHE=true (warped GeoTIFFs, kept FRAMES_KEEP_HOURS=8), ANCILLARY=true (CAMEL months for the dust confidence), --group satellite, system gdal-bin |
himawarijp | 3 | FRAME_CACHE=true under himawarijp-frames (kept FRAMES_KEEP_HOURS=5), no ANCILLARY, --group satellite, system gdal-bin |
meteosat | 24 | as the disks plus the EUMETSAT_* secrets and hdf5plugin |
aurora | 12 | FRAME_CACHE=true (the feed has only its newest grid; force never clears the cache), --group aurora |
Ancillary staging
The CAMEL emissivity months the satellite rounds pull (ANCILLARY=true,
make pull-r2-ancillary) are staged by
stage-ancillary.yml: at
03:00 UTC on the 25th it stages the month in progress and the next for
every region in xuebuild/satellite/staging.py (the 1st is the retry) and
pushes them with make push-r2-ancillary. It is the only job that touches
Earthdata: the repository secrets EARTHDATA_USERNAME /
EARTHDATA_PASSWORD, written to the runner’s ~/.netrc for the job and
removed after; R2 is the usual three secrets. A dispatch takes one
region, one month (YYYY-MM) and dry_run; it needs no GDAL.
Point products
Each runs on its own schedule, independent of the raster publishes, and withholds its pointer only when nothing contributed.
| Product | Workflow | Cadence | Spec |
|---|---|---|---|
| Tropical cyclones | publish-tc.yml | twenty past every hour | docs/tc.md |
| Tropical cyclone archive | archive-tc.yml | 00:50 UTC daily; backfill by dispatch | docs/tc.md §8 |
| Airport share cards | airport-images.yml | on a push that changes the airport list or the drawing; dispatch to redraw | docs/airport.md §8 |
| Airports | publish-airport.yml | every ten minutes | docs/airport.md |
| Soundings | publish-sounding.yml | a quarter past every hour | docs/sounding.md |
| Surface stations | publish-synop.yml | three past every ten minutes | docs/synop.md |
| Active fires | publish-fire.yml | twenty-three past every hour | docs/fire.md |
| Air quality | publish-aq.yml | a quarter past and a quarter to every hour | docs/aq.md |
| Weather warnings | a self-hosted timer (below); publish-alerts.yml by dispatch only | every five minutes | docs/alerts.md |
The airport, sounding, synop and fire builds also take --offline --raw-dir tests/fixtures/<product>.
Weather warnings on a host
MeteoAlarm’s terms ask for warnings within five minutes on average and ten
at most, which a scheduled workflow (often late by several minutes, at
times skipped) cannot promise. So alerts runs on a host:
scripts/alerts-host/ holds xue-alerts-run.sh (installed as
/usr/local/sbin/xue-alerts-run), xue-alerts.service and
xue-alerts.timer (*:0/5:30).
- Each run updates a sparse checkout of
main(xuebuild,mk,scripts),uv sync --frozens it, exportsXUE_BUILD_REVISION(the checkout’s commit, the index’sbuilder) and takes the same steps as the workflow: live index, build, upload, prune. The installed script only bootstraps: after the checkout it runsmain’s copy of itself, so the host followsmain, this script included, with no deploy of its own. - Then it journals the round into the monthly archive
(
xue alerts-archive,docs/alerts.md§12) under$STATE/alerts-archive/, which must survive restarts: the journal and the month in progress live only there until the hourly fold uploads them (make upload-r2-alerts-archive). A lost directory is seeded again from the published month; what it loses is the rounds journaled since the last fold. A failed archive step is logged and does not fail the round. The workflow fallback keeps no state and does not archive. - The boundary sets’ box files are cached in the checkout’s
data/raw/alerts-areas/, fetched once from the data origin. /etc/xue-alerts/r2.env(mode 600) holds an R2 token scoped to the dataset bucket, asAWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEYandCLOUDFLARE_ACCOUNT_ID; the AWS CLI is awscli from PyPI throughuvx./etc/xue-alerts/env, when present, addsDRY_RUN=--dryrunorFORCE=--forcefor a test round.- The unit runs as a dynamic user under
MemoryMax=400M,CPUQuota=50%; a round takes about 40 s and 20 s of CPU, most of it the sync. - One writer per pointer: while the timer runs,
publish-alerts.ymlhas no schedule. To fall back, stop the timer (systemctl disable --now xue-alerts.timer) and dispatch the workflow, or restore its cron.
Indicators
publish-indicators.yml (seventeen past every hour) reduces the published
GFS, ECMWF IFS, AIFS and IFS HRES stores over the soybean regions and
appends the result under indicators/ at the data root (spec:
docs/indicators.md). It reads the public stores over
HTTPS and never touches a run’s own publish, so it runs on its own schedule
with base dependencies only (no GDAL, no wheel).
Upload order: every month file, then the season totals, the climatology and
the context table, and only after R2 reports each object’s size the
index.json that names them. The month files grow by appending but are
served under a new ?v=<crc32> each time, so no URL ever changes under its
old bytes.
The weights are built by hand, rarely: when the crop mask or the region table changes. Download the SPAM 2020 v2r2 soybean physical-area GeoTIFF (it sits behind a Harvard Dataverse guestbook form, so it cannot be fetched by a script) and the Natural Earth 10 m admin-1 archive, then:
Existing rows keep the weights version they were computed with; they are not recomputed.
Run metrics
metrics.yml (every six hours) reads the forecast publish workflows back
from the Actions API and rewrites metrics/latency.json (spec:
docs/metrics.md). The cycle comes from the finalize job’s
name, finalize <model> <run>, and the landing time from its pointer step,
so renaming either breaks the metrics (tests/test_metrics.py pins both).
The previous file lists the workflow runs already read; a build fetches job
records only for new ones, at most METRICS_BUDGET calls (the token allows
1,000 an hour), and the rest waits for the next build.
STAC catalog
The catalog (docs/stac.md) is derived, never edited: every
document is a function of the manifest (or a point product’s index), the
catalog row and xuebuild/sources.py, so a split build and a whole one
write the same bytes. Writers: build-bin for a whole run,
assemble-run, showcase build / refresh / catalog, each point
product’s build, and xue stac --model <m> --run <r> [--round HHMM] or
xue stac --product <p> --issue <i> to rewrite one. Uploads: a run’s Item
with its manifest; the Collection, the live Item, the root catalog and its
index.html (xuebuild/stacindex.py) with the pointer
(upload-r2-pointer, upload-r2-stac-collection); the showcase’s with
upload-r2-showcase. The root catalog and index.html change only with the
registry, yet every publish of every source reaches them, so they are put only
when R2’s ETag differs from the local MD5 (put_if_changed in mk/r2.mk).
Showcase cases
On a runner, showcase.yml takes
case ids by dispatch, pulls the live catalog rows first
(make live-showcase-catalog) so the rewritten showcase.json still
lists every case, builds and uploads. The archives sit in AWS us-east-1,
where a runner is fastest. A case whose inputs exist only on one machine
(a fire round cut from downloaded granules, a local frame cache) is built
there and uploaded by hand: its own directory, then a showcase.json
collected after make live-showcase-catalog, never a sync of the whole
local tree. Authoring: showcase/README.md.
The shell
deploy-pages.yml deploys the shell on every push to main that touches
the frontend, Rust, the documents or site/; make deploy does it by hand.
It never touches the bucket. The deploy carries the documentation site
under /docs/ (below): a Pages deploy replaces the whole site, so
make deploy-build always builds both.
The documentation site
https://xue.ringsaturn.me/docs/ is part of the shell deploy:
make deploy-docs (run by make deploy-build) renders the documents with
Hugo and the OINK theme into
dist-deploy/docs/, and adds the rust/xue API reference for main under
api/, built the way docs.rs builds it (nightly, --cfg docsrs), so a
manual deploy needs Hugo, Go and a nightly toolchain. The site has its own
sitemap at /docs/sitemap.xml, listed in robots.txt beside the shell’s,
and its own llms.txt. A pull request that touches docs/ or site/
builds the site in site.yml without deploying it.
The documents stay plain GitHub Markdown, with no front matter.
site/data/xue_nav.yaml arranges them: two trees, the specifications at
/spec/ (from docs/) and the developer documentation at /dev/ (from
docs/contribution/), each split into groups that are sidebar headings only,
so a document’s URL is /<tree>/<file name>/. A document missing from the
file is still published, at the end of its tree, and the build warns.
site/content/_content.gotmpl makes the pages: the first H1 is a page’s
title, and a tree’s README.md is its section page.
site/layouts/_markup/render-link.html resolves each relative link against
the document’s path in the repository: another document becomes its page, a
schema the copy the site serves, anything else a link to GitHub. The site
takes the viewer’s icons and monospace face, mounted from web/
(site/assets/css/project.css), and the theme’s own palettes: Paper by
default, the other presets in the menu. One theme
template is overridden: site/layouts/_partials/landing/sections/hero.html,
a copy of OINK’s with the home page’s cover made a link, which an OINK
upgrade has to carry over.
To preview, from site/: hugo server (Hugo 0.170 or later; the theme is a
Go module pinned in site/go.mod, so Go is needed too). Restart it after
changing data/ or the adapter: its incremental rebuild can miss them.
10 - The data API on a self-hosted origin
The data API (rust/xue-worker, contract in api.md) builds
for the Workers runtime and, with the same routes, as a native binary
xue-api-server. xue-api.ringsaturn.me is served by the binary on a
self-hosted origin: a fixed-price machine behind Cloudflare’s proxy, so the
worst case under load is a slow or unavailable API, never a metered bill.
No Worker is deployed; the Workers build runs only under wrangler dev
(make api-dev).
What differs from the Worker
| Worker | xue-api-server | |
|---|---|---|
| Data | R2 binding (DATA), or the public origin with DATA_SOURCE=cdn | the public origin over HTTP (DATA_ORIGIN); a cache miss costs CPU here, not an R2 read |
| Response cache | caches.default, per data center | in process, for the answer’s max-age; a hit answers with the remaining lifetime |
| Object cache | per isolate (cache.rs) | the same module, one per process |
| Overload | Workers limits | XUE_API_INFLIGHT requests computed at once, then 503 overloaded with Retry-After |
| Rate | the zone’s per-IP rule | optionally a global budget, XUE_API_RATE_PER_MIN computed answers a minute, then 429 rate_limited; Cloudflare’s free rate-limit rules count per IP only, so a global cap has to live here |
| Behind an authenticating proxy | — | optionally XUE_API_REQUIRE_HEADER (name: value): every request but /health without it is 403 forbidden, so only the proxy is served even if the hostname is reached around it; XUE_API_CLIENT_HEADER + XUE_API_INFLIGHT_PER_CLIENT cap the requests computed at once per value of a header the proxy sets (a client id), above which that client alone gets 503 overloaded |
| Swagger UI | static assets from public/ | the same files compiled into the binary |
| Compression | Cloudflare’s | gzip for a client that takes it (Cloudflare does), Vary: accept-encoding; a point answer goes out at about a sixth of its size |
route.rs decides which handler answers a path and its Cache-Control;
runtime.rs (Worker) and server.rs (binary) only frame the answer. A
route added to one runtime is in both.
Configuration is the environment, read from /etc/xue-api/env when it
exists: XUE_API_LISTEN (default 127.0.0.1:8787), DATA_ORIGIN,
XUE_API_INFLIGHT (32), XUE_API_CACHE_MB (64), XUE_API_RATE_PER_MIN
(0, off), XUE_API_METRICS_LISTEN (unset, off), XUE_API_REQUIRE_HEADER
(unset, off), XUE_API_CLIENT_HEADER (unset) and
XUE_API_INFLIGHT_PER_CLIENT (0, off; needs the client header).
Builds
.github/workflows/build-api-server.yml builds the binary on every main
change to the code it is made of (rust/xue-worker, rust/xue, the
workspace manifest and lock) and publishes it as the rolling prerelease
api-server: xue-api-server-x86_64-linux-gnu (glibc 2.35+), its
.sha256, a build provenance attestation and
….third-party-licenses.txt, the licences of the crates and the ODbL
time-zone data compiled into it (cargo-about, rust/about.toml). The release is replaced on
each build, its tag moved to that commit; the binary reports the commit as
revision (metrics, start-up line). A host installs from there after
sha256sum -c (by itself: xue-api-update.timer, under Units) and, by
hand, gh attestation verify <file> --repo ringsaturn/xue; the workflow
names no host and reaches none.
Metrics
With XUE_API_METRICS_LISTEN set (e.g. 127.0.0.1:9787) the binary serves
Prometheus metrics at /metrics on that address, and only there (metrics.rs).
It must not be the API’s address: the tunnel forwards everything that
reaches that one, so a metrics route there would be public. Keep it on
loopback, or on a private interface a scraper reaches; the tunnel never
connects to it.
| Metric | What |
|---|---|
xue_api_requests_total{route,outcome,status} | answers, by route template (/v1/soundings/{station}, other for anything else), outcome (hit, miss, error, asset, preflight) and status |
xue_api_request_duration_seconds{route,outcome} | histogram, request to response |
xue_api_response_bytes_total{route} | body bytes sent, after gzip |
xue_api_upstream_requests_total{kind,result} | reads of the dataset origin (whole, range; ok, not_found, error) |
xue_api_upstream_duration_seconds, xue_api_upstream_bytes_total | their time and bytes |
xue_api_inflight, xue_api_inflight_limit | requests computed now, and the 503 threshold |
xue_api_response_cache_entries, _bytes, _limit_bytes | the response cache |
xue_api_rate_tokens | the global budget left, when XUE_API_RATE_PER_MIN is set |
xue_api_build_info{version,revision}, xue_api_start_time_seconds | the build (crate version, source commit), and when it started |
hit is this process’s response cache; Cloudflare’s edge hits never reach
the origin, so they are not counted here.
Measured on a 1-vCPU host (2026-10-30, single-variable GFS points, every request a miss): 96 req/s at 16 in flight (p50 0.14 s), 124 req/s at 32 (p50 0.24 s, 71 % of the core); past that the single-threaded loop saturates and latency, not throughput, grows. A miss is mostly waiting on the range reads from the dataset origin, so a request for n bundles costs about n times one.
Another data source
The binary reads the public origin. A program that keeps the objects
elsewhere (a mirror on local disk, another store) depends on xue-worker
with features = ["server"], implements xue_worker::ObjectSource (read an
object, or a byte range of it, by its path under the data root), and calls
server::serve(Config::from_env()?, Data::from_source(…)) inside a
LocalSet on a current-thread runtime. Routes, caches, compression, limits
and the watchdog are the same; work of its own (refreshing the source) runs
as tasks on that LocalSet.
Reaching it without exposing the host
The origin is reached only through a Cloudflare Tunnel. cloudflared on
the host dials out to Cloudflare; the API listens on loopback; the host
opens no port for it and no DNS record names its address. The public
hostname is a proxied CNAME to <tunnel-id>.cfargotunnel.com, which only
Cloudflare can route.
The alternative, a proxied A record plus a firewall that admits only Cloudflare’s address ranges, was rejected:
- The address is in DNS (and in DNS history, and in certificate scans if the origin serves TLS for the hostname).
- The ranges are shared by every Cloudflare customer: anyone can point a zone of their own at the address and reach the origin without this zone’s WAF and rate limit, unless Authenticated Origin Pulls are added.
- The ranges change, and every origin has to follow.
Putting the Worker in front and calling the origin through the tunnel (Workers VPC) would keep Worker-side control, but every request would count as a Worker request again, which is the cost this setup exists to cap.
What the tunnel does not hide: the origin’s own outbound reads of the public dataset come from the host’s address, and other services on the same host may already make that address public. Neither links the address to the API’s hostname.
Units
rust/xue-worker/origin/:
xue-api.service:Type=notifywithWatchdogSec=30(the server pings from its event loop, so a wedged loop is restarted),DynamicUser,MemoryMax=256M,CPUWeight=50so a shared host’s other services keep their share.xue-api-tunnel.service:cloudflared tunnel runwith the token from/etc/xue-api/tunnel.env(TUNNEL_TOKEN=…, mode 600).BindsTo=the API: when the API stops, the connector stops, and Cloudflare stops sending requests to the host. With one connector that turns a502into Cloudflare’s own error page; with several it moves traffic to the others.install.sh: installs the binary and the units,cloudflaredfrom Cloudflare’s apt repository if missing, restarts and checks/health.xue-api-update.timer/.service/.sh(installed as/usr/local/sbin/xue-api-update): every five minutes, fetch theapi-serverrelease’s.sha256; when it differs from the installed binary, download the binary,sha256sum -cit, install it, restart, and wait up to 30 s for/health. A build that fails is rolled back to the previous binary and remembered in/var/lib/xue-api-update/rejected, so it is not retried until the release moves on. A run while the release is being replaced (no asset, or a.sha256of another build) does nothing. The checksum guards against a torn or mixed download, not against a forged release; the host does not rungh attestation verify.
So a host follows main: a merge that touches the server is live about
ten minutes later. A binary installed by hand (deploy.sh from a
branch) is replaced at the next run; stop the timer
(systemctl disable --now xue-api-update.timer) to keep it, and start it
again to go back to the release. journalctl -u xue-api-update shows what
each run did.
Deploy
The first deploy needs the tunnel token: set XUE_API_TUNNEL_TOKEN for
that run (cloudflared tunnel token <name> prints it). Later deploys keep
the token on the host.
Cloudflare side
One tunnel; the connector sends every hostname routed to it to
http://127.0.0.1:8787 (--url), so the tunnel needs no ingress rules.
A hostname is a proxied CNAME to the tunnel (cloudflared tunnel route dns <tunnel> <hostname>). More hosts run deploy.sh with the same token: each is another connector
of the same tunnel, and Cloudflare sends a request to the nearest one that
is up (no weights, no application health check; BindsTo= stands in for
the latter).
Zone settings the API depends on, all in the dashboard:
- A Cache Rule for the API hostname and
/v1/: eligible for cache, edge TTL from the origin’sCache-Control, query string sorted in the cache key (solat=…&source=…andsource=…&lat=…share an entry). Cloudflare does not cache JSON without one, and then every request reaches the origin. - Tiered Cache (Smart Tiered Cache on the free plan), so an edge miss asks an upper tier before the origin.
- The per-IP rate-limit rule api.md mentions.
11 - Releasing
One v* tag releases two artifacts built from rust/:
- the
xuecrate (decoder, plus the off-by-defaultencoderfeature) to crates.io, byrelease-crate.yml; - the
xuepywheels (the decoder and the native encoder through PyO3, each carrying a minimal GDAL) to PyPI and the GitHub release, byrelease-xuepy.yml.
xuebuild itself is never published (its classifier makes PyPI refuse
it); it depends on the xuepy wheel.
Versions
| Where | Field |
|---|---|
rust/xue/Cargo.toml | version: the crate, and the tag |
rust/xue-py/Cargo.toml | version: tracks the crate; maturin takes the wheel version from it (dynamic = ["version"] in rust/xue-py/pyproject.toml) |
rust/Cargo.lock | both entries |
pyproject.toml | xuepy>=0.N,<0.N+1: the floor xuebuild installs |
xue-wasm and xue-worker keep 0.1.0 and are never published.
The flow
Everything happens on a release/0.N branch, and main receives the
release only once it is complete. So main never carries an encoder
change without the wheel that matches it, and the scheduled publishes keep
working throughout the release window.
A change to the registry tables alone (xuebuild/variables.py,
quantize.py, sources.py, the bundle tables of bundles.py) is not
an encoder change and takes none of this: it is a commit to main with
the regenerated rust/xue/registry.json (xue registry --output rust/xue/registry.json), and the next build hands the new document to the wheel
already installed (see “Why the floor tracks the current release”).
- Branch:
git checkout -b release/0.N main. Commit the encoder change there, or merge it in.test.ymlruns onrelease/**, and its Python job builds the wheel from the tree (make encoder-py) instead of installing PyPI’s, so native parity is checked against the code being released. Byte parity needs both encoders on one libzstd: the job pins the interpreter to a CPython patch whosecompression.zstdcarries thezstd-sysversion inrust/Cargo.lock, and on a release branch (XUE_REQUIRE_PARITY) a parity test that finds two versions fails rather than skips. Moving either libzstd means moving the other. - Release commit on the branch,
chore: release 0.N.0: bumpversioninrust/xue/Cargo.tomlandrust/xue-py/Cargo.toml, and refreshrust/Cargo.lock. Nothing else goes in this commit. - Tag the release commit
v0.N.0on the branch, then push the branch and the tag. Both workflows first check that the tag equals the manifest version and refuse otherwise.release-crate.ymlpublishes the crate and creates the GitHub release.release-xuepy.ymlbuilds wheels on macOS arm64 and Linux x86_64 / aarch64 (manylinux_2_39), smoke-tests each one (it encodes the GRIB fixture and the JPEG 2000 wave fixture and decodes them back), publishes to PyPI and attaches the wheels to the release. Both authenticate with Trusted Publishing (OIDC), so no token is stored. No sdist is published, because a source build needs GDAL, libclang and cmake. - Relock commit, made by CI. When
release-xuepy.ymlhas published the wheels,release-relock.ymlwaits until PyPI’s simple index lists the version, then runsscripts/relock_release.sh v0.N.0on the branch that holds the tag: the floor inpyproject.tomlbecomes"xuepy>=0.N,<0.N+1",uv lock --refresh-package xuepyruns, the lock is checked to hold exactly 0.N.0, andchore: relock on the published xuepy 0.N.0is pushed torelease/0.N. A push with the workflow token starts no workflow, so the job then dispatchestest.ymlon the branch; wait for that run too. If the job failed, run the script by hand from a fetched checkout, or dispatch the workflow with itsrelock_taginput (dry_runshows the commit without pushing). - Merge into
mainwith a fast-forward, so the change, the release commit and the relock land onmaintogether and keep their history. Ifmainmoved on meanwhile, mergemaininto the branch first, push it and wait for its tests. Do not rebase: the tag stays on the published release commit, and only a merge keeps that commit inmain’s history. Land it locally, never through a pull request: GitHub’s rebase merge rewrites every commit even whenmainhas not moved. Then delete the branch.
A manual dispatch of either workflow is a rehearsal: cargo publish --dry-run, or wheels uploaded as workflow artifacts only.
Gate each step on its exit code. Do not chain a commit or push behind a
pipe such as uv lock | tail, which hides a failure.
Why the floor tracks the current release
The wheel carries no table of variables, bundles or sources. It reads the
registry document this tree hands it on every call
(xuebuild.registry.document_json(), docs/registry.md), and what it
carries instead is the set of rules that document can name: the
registrySchema it implements, the conversion and match.gdal rule
names, the derivation.kinds and the codebook types (docs/encoder.md
§“The registry document”). A wheel handed a document that names a rule it
does not implement refuses the whole document before reading any input,
and the scheduled forecast workflows pin the native encoder, so an older
wheel fails the build instead of quietly building less.
The floor is therefore the first release that implements every rule name
this tree’s document uses and its registrySchema, and the upper bound
keeps an unrelocked tree from picking up a wheel whose rules have moved
on. A table change — a new source, a new bundle, a new level, a changed
codebook or input list — moves no rule and no schema: it is a commit to
main with the regenerated snapshots, and no release follows.
Why the release lives on a branch
If an encoder change (a new rule, derivation, codebook type or ingest path,
or a schema bump) merged to main before its wheel shipped, main would
still install the old locked wheel, which refuses the document. Then
tests/test_native.py (byte parity between the two encoders) and the
scheduled publishes, which pin the native encoder, would fail until the
relock. Raising the floor before the wheel is indexed is worse: uv sync
fails everywhere, because the version cannot be resolved. Keeping steps
1–4 on release/0.N confines both failure windows to the branch.
Workflows that publish a source whose document a released wheel may not
implement yet (publish-jma.yml and the other rolling windows except
MRMS) resolve the encoder at job time with native.knows_source, which
hands the wheel the document and reads its answer, and fall back to the
reference pipeline with a warning.
Where xuebuild gets the wheel
xuepy comes from PyPI like every other dependency, and uv.lock holds
its files.pythonhosted.org URLs and hashes. The wheels attached to the
GitHub release are the same files, kept as a record of the release; no
build downloads them.
Deploy order
The Pages shell (deploy-pages.yml)
deploys automatically on every push to main that touches web/,
rust/, the build configuration or the documents llms-full.txt is built
from. A new shell accepts old data, but an old cached shell rejects new
data, so the shell must be live before the bucket carries a widened
manifest schema, a container or bundle metadata version bump, or a new
source id (the rule, in
delivery-and-deploy.md).
In practice: merge the frontend change, let deploy-pages.yml finish,
then release the wheel and let the publishes run. A tab whose validator
rejects a live manifest or store reloads itself once per manifest, which
covers viewers holding the old shell. A new bundle of a known shape needs
no shell change: the shell renders an unknown field generically.
The data API (rust/xue-worker) is released by neither: the origin follows
the api-server prerelease that build-api-server.yml rebuilds on every
main change (api-origin.md).
12 - Setup and local builds
Requirements
- Python ≥ 3.14 with uv.
uv synccreates.venvwith NumPy and thexuepywheel. Always run Python as.venv/bin/python; the Makefile picks it automatically. - GDAL ≥ 3.8 with the GRIB driver. Needed by
XUE_ENCODER=python, by the satellite fetch stage (gdalwarp,gdal_translate,gdalbuildvrt) whichever encoder converts, and by the tests. The native encoder inspects inputs through the wheel’s own GDAL. - zstd ≥ 1.5 comes with the standard library (
compression.zstd); no CLI. - Node.js ≥ 22.
- A Rust toolchain and
wasm-pack(the browser decoder,make wasm). - eccodes:
grib_setrepacks ECMWF open data (CCSDS-packed) togrid_simpleat fetch time;bufr_dumpdecodes the tropical cyclone and sounding BUFR. - om2nc,
ifshresonly: reads Open-Meteo’s.omfiles and writes the NetCDF series the encoders ingest. It is GPL-2.0-only and stays a subprocess: nothing in this tree imports, links or vendors it, and no om dependency may enterpyproject.toml,Cargo.tomlorweb/. Install a pinned release (the publish workflow checks its sha256) or setXUE_OM2NCto the command. - jma-radar,
jmaonly:uv pip install git+https://github.com/ringsaturn/jma-radar, orXUE_JMA_RADAR. - Optional dependency groups:
uv sync --group zarr(tests, reading a delta store),--group satellite(Dust RGB / DEBRA producers and the FCI plugin),--group cma(the CMA archive reader),--group aurora. - Credentials:
XUE_CMA_ARCHIVEplus theR2_*pair forcma;EUMETSAT_CONSUMER_KEY/EUMETSAT_CONSUMER_SECRETformeteosat. - AWS CLI v2 and
jqfor publishing only.
make check verifies versions and commands, and reports which encoder a
build would take. The native encoder from source (make encoder-rust)
also needs libclang.
web/src/wasm/ is generated and gitignored: run make wasm before the
frontend typechecks or builds.
Building a run
Step by step (--model takes any id in docs/sources.md;
--hours defaults to the whole published axis):
XUE_ENCODER:auto(default; the wheel when installed),native(fail without it) orpython(the reference pipeline). Both produce identical bytes.--hoursmay be any hour on the model’s axis.build-bin(andshowcase build) writes every bundle into the run’s shared storebundles.zarr/straight from the codes, with--xueeach bundle’s.xuecontainer beside it from the same codes; the reduced tiers (bundles.half.zarr/, plus.quarteron satellites and the 0.1° grids) and a first-frame poster.--skip-variantsturns the tiers off. The pressure family gets no poster: contours need exact codes.- A vector bundle (
wind10m,wind850,qflux850, …) is added only when its components were fetched;--force-downloadre-fetches. - Overwriting an existing manifest needs
--force(make mvp FORCE=--force).
Raw inputs live in data/raw/, published data in web/public/data/, the
static build in dist/. All of it is gitignored.
The frontend locally
npm run dev serves the shell with Vite. The dev server has no Range
support, so streaming stores are exercised through npm run build and
make serve. The basemap key is origin-locked to localhost (not
127.0.0.1): browse http://localhost:4173 to see real tiles.
13 - Testing
Single tests:
What holds what
- Python (
tests/test_*.py): codebooks, modulo-256 residuals, the container writer’s bytes and the bundle metadata validator, the manifest and pointer contracts, every source’s crop fixture through both encoders, the Zarr store writer and reader, the STAC documents and the point products against committed goldens. A source test builds what production publishes, the shared stores, and reads its bundles back out of them (tests._support.stored_bundle); a test that has to read a.xueopens it with the wheel’s decoder (xue.Bundle), the only container reader on the Python side. - Encoder parity:
tests/test_native.pyand every source test compare every artifact of one build through thexuepywheel against the reference pipeline, byte for byte: the shared stores, the manifest and the pointer. One case,NativeContainerParityTests, builds with the container too (--xue) and holds the.xuebytes of both encoders to each other.tests/test_assemble.pyholds a split build and a top-up identical to a whole one. - Rust:
rust/xue/tests/golden.rsdecodes the containerstests/prepare_bin_fixture.pywrites to the codes they were written from (read back out of the shared store by the NumPy reader), plus the container rejection paths and mutation fuzzing. - Registry snapshots (
rust/xue/registry.json, the shell’sweb/src/data/registry.ts) hold the three implementations to one set of ids, identities and codebooks;tests/test_registry.pyfails untilxue registry --output rust/xue/registry.json --shell web/src/data/registry.tsregenerates them. - Web (
tests/web/, Vitest): manifest validation, the Zarr reader (every frame and series identical to the wasm bundle reader), the variable table, URL state, discovery files. - Browser (
tests/e2e/, Playwright): synthetic fixtures built bytests/prepare_web_fixture.py(no network, no GDAL); download, streaming, playback, scrubbing, error recovery, and the store-only path.
Fixture provenance and regeneration are in
tests/fixtures/README.md. Goldens are
regenerated by the tests/prepare_*_golden.py scripts after a deliberate
change (the tc and sounding ones need bufr_dump).
CI
.github/workflows/test.yml runs the Python (3.14), Rust, web
and browser jobs on every push and pull request except prose-only changes
(**.md, docs/**). On release/** branches the Python job builds the
wheel from the tree instead of installing PyPI’s, since the encoders there
run ahead of the published wheel (see releasing). The Rust
job also runs make encoder-rust-test on every run: plain cargo test
leaves the encoder feature off, so the native encoder’s unit tests and
its golden run only there. The web job, after npm run build, holds the
viewer’s first-load JavaScript to web/tooling/size-budget.json
(node web/tooling/entrysize.ts; see
frontend).