Skip to content

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.

DirectoryWhat 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.
ModuleRole
app/main.tsComposition 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.tsPageState, 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.tsThe 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.tsRasterSlot (a raster layer and the session, grid and planes it shows) and MosaicMember; makeSlot builds an empty one.
app/levelrow.tsThe 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.tsThe 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.tsThe 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.tsThe 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.tsThe VariableSession and DecodedFrame types the controllers share.
app/sessions.tsThe 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.tsThe 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.tsThe 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.tsThe 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.tsThe 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.tsThe data card’s “stats for nerds” rows and decode graph, the debug copy and the map’s context menu (createStats).
app/budget.tsWhat 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.tsPointer/manifest validation, FORECAST_MODELS, bundle metadata, tier picks.
data/identity.ts, data/sessionkeys.tsVariable identity from the GRIB2 parameter block (and the band, aerosol, producer and ensemble blocks beside it); session-scoped keys.
data/statistics.tsAn 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.tsVariable table; family registry; contour intervals.
app/viewstate.ts, app/urlstate.ts, data/modelpaths.tsViewState; 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.tsThe 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.tsThe 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.tsViewport to tile rectangles.
render/layer.ts, features/particles/particles.ts, render/isolines.ts + render/labels.worker.tsRaster layer, wind particles, contour labels.
render/contourlabels.tsThe 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.tsPlane / 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.tsThe view tile under the zoom tile: globe and relief switches, reset north / tilt.
map/peaks.tsNamed peaks over the 3D relief, from public/peaks.json.
map/relief.tsThe 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.tsElevation 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.tsThe 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.tsTerrain 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.tsThe 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.tsThe 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.tsThe 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.tsThe 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.tsRamps, display units, Lambert conformal arithmetic and the footprints of resampled regional runs.
map/basemap.tsThe 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.tsFrame-rate ladder and dwell; transport geometry.
app/playbackloop.tsThe 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.tsThe 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.tsThe 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.tsPoint probe and its rows.
features/probe/probepanel.tsThe probe panel’s controller (createProbePanel): the pin, series requests, probe sessions, rows, terrain column, station chips, skew-T sheet.
features/probe/probelayout.tsHow 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.tsThe 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.tsThe 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.tsGeostationary mosaic by longitude bands; the precipitation setup’s derived fields and stepped keys.
features/mosaic/mosaicview.tsThe 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.tsThe 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.tsPrecipitation totals (?accum=) over a window or a dragged range, from the published rate frames; see “Precipitation totals” below.
derive/hotspot.ts, derive/firewx.tsThe 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.tsNASA 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.tsThe 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.tsLocale, appearance, display zone.
site/pagemeta.ts, site/site.ts, site/modelpage.tsPer-view metadata; the only place production hostnames appear; a dataset page’s head (title, description, Dataset).
app/embed.tsThe embed API, window.xueViewer (see “Embedding”).
pages/compare/compare.ts + pages/compare/, pages/showcase/showcase.tsComparison page; case list page.
products/tc/, products/stations/, products/sounding/Point-product marks, cards, skew-T.
app/marks.tsThe 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.tsA 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.tsA 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.tsA 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.tsThe 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.tsThe 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.tscontourStyleFor: 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.tsThe 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.tsThe 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.tsThe 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.tssay, sayText and resayAll: long-lived status copy that keeps its message key, so a locale switch rewrites it in place.
app/preloadcard.tsThe 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.tsA 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.tsThe 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.tsThe 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.tsWhether an object’s origin answers byte ranges, asked once per object.
ui/escapestack.tsWhat 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.tsThe 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 demandWhenStatic in its place
Locale dictionaries other than Englishthe page’s language, before the first renderi18n.ts
features/crosssection/ (control, source, panel, worker)a line is drawn, the tool is taken up, or ?section= names oneshell.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 pressedmain.ts::loadMeasureTool
mp4-muxerthe first MP4 cutthe rest of mp4export.ts, whose sizes and rates the sheet reads
features/export/stillexport.tsthe first PNG savedexportsheet.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 by u_mix. Never animate raster opacity.
  • Sampling (setSampling, from VariableSpec.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, so dis06 and upstream read the nearest texel (nearest), and the return-period class disrp also steps between frames at u_mix = 0.5 instead of mixing codes (classes), since the code halfway between two classes is a third.
  • Vectors: setVectorField uses RG8 (u red, v green, the packing particles.ts needs, interleaved once per frame) and colours by magnitude / levels.ts::vectorMaxMagnitude. Only the wind pair is packed; a composite’s guns stay three R8 textures (FramePlanes).
  • Contours: setContours finds 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. prerender first smooths the plane in grid space (Gaussian, coverage-renormalised, 16-bit RG8; width pressure.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.ts crops the plane to the view and smooths it the same way, labels.worker.ts runs 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 under prefers-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 per shaderData.variantName, so the same Mercator-addressed field lies on the plane (a pole-to-pole mesh, three world copies) or the globe (one copy). With map.setTerrain on, 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 in web/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 with scripts/build_peaks.py and 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 the white flavor’s sprite has no peak icon.
  • Volumes (volume.ts; /?model=mrms3d, or a woof case’s cloud3d): 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 by u_mix; halved by block maximum past MAX_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’s projectToSphere: y to the north pole, a height scales the radius by 1 + 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 with UNPACK_ROW_LENGTH/SKIP_* and UNPACK_IMAGE_HEIGHT set to the plane’s height — a 3D upload refuses skipped rows otherwise, and every volume upload runs under withPlainUnpack, because MapLibre leaves UNPACK_PREMULTIPLY_ALPHA_WEBGL on 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 of prate frames the session decodes anyway; no bundle carries a total. A rate whose parameter block has typeOfStatisticalProcessing (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. WindowTotals holds 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 (windowFits and 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: RangeSum adds each frame once as it lands (any landing in rangeWanted, 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 in lapse.ts, controller in relief.ts): with relief on, a 2 m temperature is moved from the model’s ground (the run’s orog plane, 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 own tmp<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 with texelFetch (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 on dz and 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.
  • Particles: speed halves per zoom level past z4 (zoomPace) so the pace on screen holds; positions are RGBA32F where EXT_color_buffer_float allows (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 on moveend, 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.ts wraps maplibre-contour’s DemSource over 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 a styledata listener moves them back (only when out of place, since moveLayer fires the event too). Ink follows the ground with applyBasemapInk. 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 an ImageBitmap, 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 as shadow.ts::marchLit); without WebGL2 in workers, or after a shader or context failure, it falls back to marchLit on the CPU for good (backend in the request forces one, for comparison). shadowlayer.ts gives the mask three consumers: an image source and raster layer 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_strength 0 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, so syncBasemapStyle’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 below MIN_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 a ForecastLayer added 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): initialize branches to openImagery, which sets a synthetic day axis (the last GIBS_DAY_COUNT UTC days) as metadata, so the timeline, transport and marks run unchanged, and trySelectFrame just 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, so syncBasemapStyle leaves 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 in imagery.days and syncGibs draws the stand-in’s platform there (gibsLayerOnDay).
  • playback.ts dwells 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 a projection is its own footprint, so hrrr keeps its domain for 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, per n, by the iteration in docs/zarr-profile.md.
  • Lambert (grid.projection, schemaVersion 4): GRID_GLSL’s gridCell is the shader’s way to a cell, the cone’s n of 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. coverOfBounds walks 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.ts reads a second field one axis at a time when axesAlign holds (two tiers of one projection, two regular grids) and by a per-cell table, kept per grid pair, when not. hotspot.ts::dayMask keeps its per-column hour angles for a regular grid and works per cell on a cone. composite.ts::thermalFrontZone measures its gradient over the ground by the map factor. volume.ts takes only a regular grid; main.ts::volumeGridOf refuses the rest. Contours are marching squares in cell space, each vertex through cellToLonLat, 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) and ptypeec (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 from cpofp, 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: fzlvl is a height above sea level, so buildFrostPlane subtracts orog and the contour path draws the result at 0 on a layer of its own. A run without fzlvl (GFS and HRRR have it, and sflux borrows 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.
  • buildPhaseField writes RGBA weights (snow, mix, freezing rain, ice pellets; rain is the remainder). ForecastLayer.setPhase samples 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 through u_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=none none, 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: steppedPhasePalette bands 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.ts reads reaches.parquet through hyparquet over an AsyncBuffer whose every slice is one Range request (rangeAsyncBuffer; a 200 answer is kept whole): the footer first (16 KB suffix), then, on every moveend, the geometry column of the row groups whose bbox covering statistics meet the view — all of them when the view holds the case’s bbox. The parquet reader is a lazy chunk, loaded only on a network case. WKB is decoded by products/river/wkb.ts (hyparquet’s own GeoJSON conversion is off). Row group g is the store’s feature chunk g, so a row’s index is its feature.
  • Values. products/river/store.ts::NetworkStore opens a track’s store with the grid reader’s pieces: decode/zarr/store.ts (range coalescing, ?v=), and the WASM module’s parseShardIndex and decodeChunk (products/river/decode.ts loads it on the main thread; a frame is two 24 KB chunks). The group must carry xue_network version 1 and repeat the index’s geometry; the array is uint8 [time, feature], one shard, inner chunk [6, rowGroupRows], [xue.delta, bytes, zstd] or [bytes, zstd], and is read against the group by the module’s parseNetworkArray (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 the log1p table (codebookTable: 0 → 0, 254 → the maximum, 255 → NaN). time and baseflow are read whole at open.
  • Time. The playhead’s valid time comes from updateFrameReadout (the frame asked for) and from blendFrames during playback (the sweep’s fraction, so the reaches move with the field’s u_mix). framePair takes 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 with texelFetch. The vertex stage projects both ends through MapLibre’s projectTile prelude (plane with three world copies, or globe) and extrudes across the segment in device pixels. Colour: ratio Q / max(baseflow, 1) in four classes, < 2 grey, 2–10 yellow, 10–100 red, ≥ 100 purple, the DISRP_CLASSES hues; width 1 + 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 names color colours by flow instead: overlays.ts::syncRiverRamp hands the layer that bundle’s buildPalette (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 sample cell) with products/river/gauge.ts’s section under the meteogram rows: the observed line (one Range read of gauges.jsonl, fetchSpanBytes), the outflow line where the gauge has one, the model at the gauge (the track’s column feature, or the case’s dis06 probe 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 at and drawn as translucent blue fills under the reaches; the case panel’s switch hides them. The credit line (#river-credit, shown under body[data-river]) names the index’s credits and each extent on screen.
  • Case panel. RiverCase.renderPanel fills #case-river under 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-right on 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.ts is all that main.ts knows: 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.ts is 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 from frameShown, after the playback’s own work, at the primary’s valid time, and gates nothing.
  • source.ts and line.ts read 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 for STALL_MS ends with its channel, and is the reader’s to ask again.
  • renderer.ts draws the plot in a worker (engine.ts, field.ts, derive.ts, draw.ts); the canvas is the plot alone.
  • panel.ts is the axes, the controls, the legend and the crosshair around it, all DOM: reading the chart never redraws it. maplayer.ts is 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.ts is 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.ts writes them: a coordinate at rest is one entry, how the charts are drawn replaces the entry there is, and popstate restores.
  • page.ts puts 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.ts is 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 createSectionSource with 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.ts keeps 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 by CoordinateGrid, clear of the title and the shape buttons.
  • mapfield.ts draws 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 two ForecastLayers; with the bar’s barbs on, mapbarbs.ts adds 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.ts is 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.ts shares 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, following body[data-ground] from applyBasemapTheme. 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.setStyle drops the custom WebGL layers, so syncBasemapStyle diffs layer properties instead (basemap.ts::applyBasemapStyleDiff). index.html repeats theme detection inline so the first paint is on the right ground.
  • isDark, locale, htmlLang, basemapLang, displayZone are live bindings: read them at use, never capture them in a module constant.
  • The Protomaps key allows the production domains and localhost, not 127.0.0.1 (Playwright’s origin, hence stubbed tiles). See the real basemap at http://localhost:4173.

i18n, time and URL state

  • Thirteen locales under locales/, each Record<MessageKey, string> against en.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 as i18n.ts evaluates and awaited by each page entry (await localeReady) before its first render, so t stays synchronous and reads English for a dictionary that is not in. setLocale loads, then swaps; a failed load leaves the page in its language. The build tooling imports alllocales.ts, which registers all thirteen at once. Translate only human-facing copy: errors, worker messages, instrument codes (F058, PLAY), diagnostics, UTC+9 and zone ids stay English. Long-lived status copy goes through say() 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 default auto it 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’s timeZone, 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-zone in 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. parseCameraFromHash only 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 its bbox (caseCameraLimits), and on the first open without #map= it jumps to the fit — or to the row’s optional view (showcase-catalog.ts ShowcaseView: center, zoom, pitch, bearing, terrain as an exaggeration or false), which a mountain case uses to look from a side with the relief up. The view’s terrain goes through the same setTerrain the view control’s switch uses, so URL, switch, lapse row and peak labels follow from the terrain event; a link carrying ?terrain= (on or off, searchNamesTerrain) outranks it, as #map= outranks the framing. A view the shell cannot read is dropped with one warning and the case opens on the fit. The view’s optional volume (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 one ViewState.volume that ?volume= and the overlay tile set, so the tile, the address bar and applyVolumeOverlay follow from it once the manifest is open; a link that said anything about the volume (?volume=, off included: 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 from FORECAST_MODEL_IDS and the model sheet, has no path, and ?model= naming it goes to /.
  • A case may name a dataset this build has no FORECAST_MODELS entry for: a catalog row whose model matches no label is admitted from the row itself (registerCaseDataset, called last in showcase-catalog.ts::validateCase) as a case-only dataset with the row’s modelId, model as its label, its product, defaultVariable, its variables as the rail core, no core bundles, and its dataBbox as 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 its modelId is 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). daily is 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):

/                 /ja/                 home
/hrrr?type=wind   /ja/hrrr?type=wind   a dataset (below)
/showcase         /ja/showcase         the case list
/showcase/<id>    /ja/showcase/<id>    a case (the viewer), camera in #map=
/compare /metrics /typhoon /api        and /ja/compare, …
  • Pages: web/tooling/sitepages.ts (called from discovery.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 as applyStaticMessages would (translateMarkup: data-i18n*, <html lang>, links to the shell’s pages), and the head written per language (writeHead: canonical to itself, the thirteen hreflang alternates plus x-default, og:url, og:locale; the title from compareTitle, metricsHeading, tcHistoryHeading, showcaseHeading where a message exists, else the English one). Every copy names its assets root-absolute (absolutizeUrls): the build’s base: "./" would resolve ./assets/ under /ja/showcase/. Shell code that builds a URL does it root-absolute too (site.ts::dataBaseUrl is /data/, peaks.ts’s /peaks.json, i18n.ts::shellPath / caseHref for links); workers and the wasm resolve against import.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 the languageChooser plugin (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 with replaceState; applyStaticMessages re-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_PATHS is 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 replaceState on 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.ts places the language and the case, main.ts the dataset. The deployment is static files alone: no Pages Function. web/public/_redirects moves #223’s /cases/… pages to /showcase/….
  • Agent discovery: web/public/_headers puts Link headers (llms.txt, sitemap, API catalog) on /, serves llms.txt as text/markdown and /.well-known/api-catalog (RFC 9727, pointing at the API’s OpenAPI document and the STAC root) as application/linkset+json; robots.txt carries Content-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, …), less NO_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.ts reads the model from the path after the prefix (the canonical id only: Pages serves nothing else there), then from ?model=, then the default (parseModelFromLocation). syncUrl writes the path with replaceState (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. searchForVariable drops model from the query; searchForLiveModel puts 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::renderModelPage writes <id>.html (and <prefix>/<id>.html) with the head from modelpage.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’s Dataset; 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); the producer providers (creator), the licence links and the longer English description come from xuebuild/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’s Dataset takes 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/ including 404.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.html is the site’s 404: with a top-level 404.html Pages 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 marked noindex.
  • 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).

ParameterValuesDefaultURLStoredNotes
modeldataset 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.
caseshowcase 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.
typefield alias, bundle id, pressure surface, or precipsetupdataset defaultwritten—The primary; a pressure surface is the lines alone. precipsetup is the precipitation setup on prate.
linespressure surface, or none in the setupnone (setup: prmsl)written—Lines over a filled field.
flowqflux<level> or wind<level>qflux850written—The setup’s particle flow; dropped outside the setup.
sectionlat,lon,lat,lonnonewritten—The line of the cross-section, A first, to 0.01°; dropped in a case.
pointlat,lonnonewritten—The pinned point, to 0.01°; dropped in a case.
timevalid 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.
accumwindow (3h, 30m) or UTC range (2026111106-2026111400)ratewritten—Precipitation total; only on prate outside the setup.
particlesswitchon (off under reduced motion)written when chosen offxue-particlesOnly a chosen off is written.
phaseswitchoffwritten—Precipitation by phase and the 0 °C line; stacks on the setup.
volumevolume bundle id (cloud3d) or offnone (a case’s view.volume)written—3D volume over a 2D field; any volume= outranks the case’s.
vexagnumber, 0–200volume’s ownread once—Volume vertical exaggeration.
projectionglobeplanewritten—
terrainswitch or exaggeration (≤ 10)flat (a case’s view.terrain)written—on is 1.5×; any terrain= outranks the case’s.
shadowswitchoffwritten—Terrain shadows, from z9.
contoursswitchoffwritten—Elevation contour lines over the relief.
gibsGIBS_LAYERS idnonewritten—NASA GIBS daily picture (the gibs dataset or a case’s imagery).
radaron, a NEXRAD site id, offoffwritten—on marks the sites; a site draws alone.
radarproductn0b / ref, n0g / veln0bwritten—Written only for velocity.
stationscomma list: snd, apt, synop, fire, aq, alerts (aliases)nonewritten—Point-product marks.
tcstorm id, or offactive stormswritten—Tropical cyclone tracks.
tcagency, tcmodelcomma lists of keysallwritten—Which agencies and models to draw.
tcmembersswitchoffwritten—Ensemble members.
gridcomma list of mgrs, utm, gars, bng, latlon, or offnonewrittenxue-gridReference grids (settings sheet).
unitspreset and overrides (units.ts)auto (region)read oncexue-unitsThe settings sheet writes storage, not the link.
langlocale codethe path’s prefixmoved to the pathxue-localeAn old link’s: redirected to that locale’s prefix. Read only by a build with no language copies.
themelight, darksystemwritten on switchxue-theme
resauto, half / low, full / highautoread once—Pins a resolution tier for the session.
backendxue, zarrzarrread 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.

interface XueViewer {
  version: 1;
  map: maplibregl.Map;
  time(): number | null;              // epoch ms
  setTime(ms: number): number | null; // the valid time it landed on
  source(): { model: string; run: string | null; runTime: string; variable: string;
              caseId: string | null; manifestCrc32: string | null } | null;
  on(event: "time" | "source", callback: () => void): () => void; // returns the unsubscribe
  playing(): boolean;
  openCase(id: string, options?: { time?: number; play?: boolean }): boolean;
}
  • Readiness. time(), setTime() and source() return null until the shell is ready and a dataset has loaded, and again while a model switch is in flight (selectedModelId names the next model before metadata does). Wait for the first source event.
  • time is the timeline pointer: the frame asked for, which may lead the screen by a frame while it decodes. The event fires from updateFrameReadout, 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 nearest time (the first frame without one), playing unless play is 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 while playing().
  • setTime(ms) stops playback and selects the frame nearest to ms: 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).
  • source fires from applyVariable, 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. model is the source id (gfs, a case’s own model), variable the bundle id, manifestCrc32 the 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.
  • map is outside the version promise. 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, because syncBasemapStyle patches properties in place and never calls map.setStyle.
  • Listener exceptions are caught and logged; they never reach the shell.
  • version changes 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.