The registry document
What an encoder needs to know about the variables, bundles and sources it
builds, as one JSON document. The Python tables in xuebuild/ author it
(xue registry prints it); the native encoder reads it in place of a
table of its own, so a table change is a document change and needs no
release. The committed snapshot rust/xue/registry.json is held to
the tables by a test.
The document is not a published artifact and not part of the format. What
reaches a store is the variable block of docs/bundle.md, which the
label, unit, parameter, producer, aerosol, ensemble and
quantization keys of a variable entry are, key for key: an encoder copies them into
attributes.xue, it never computes them. seriesQuantization reaches a
series store the same way, as that store’s quantization. Everything else
in an entry is how to obtain the field and what to do with it.
Shape
Bundle ids are the ^[a-z][a-z0-9]*$ strings the manifest admits; a
variable that is read and never published may carry _ (prate_ave). Keys are
camelCase. Every key of an entry is written, even when empty, except where
a key is marked optional below: an absent optional key means “none”.
registrySchema is the version of this document’s own shape. A reader
implements a set of schemas and refuses a document outside it before any
input is read. Adding a key an existing reader can ignore keeps the number;
changing what a reader must do with an existing key raises it.
Variables
| Key | Meaning |
|---|---|
label, unit, parameter, producer, aerosol, ensemble | Exactly the metadata blocks of docs/bundle.md. producer carries the id alone; the version is stamped on the series the producer wrote and read off it at build time. ensemble is the variable’s own statistic (a quartile, a spread, a probability); a shared variable whose record a source reads as an ensemble’s centre has none, and the source names the block it writes (ensembles, below). |
quantization | One codebook block per profile, each exactly as the metadata writes it. The type is one of the closed set below. A variable without this key is read and never published (tp, the categorical precipitation flags). |
seriesQuantization | Optional. The codebook a series store holds this variable’s codes in (docs/bundle.md, “Series codebooks”; docs/zarr-profile.md, “Series store”): one linear block whatever the profile, with a nodataCode above 255, so its codes are uint16. An encoder that writes a source’s seriesBundleIds writes every variable of those bundles that carries this key under it, quantized from the same plane as the profile’s codes, and puts the block in the series store’s metadata as the variable’s quantization; every other variable of a series store keeps its profile codebook. Absent: the series store holds the profile’s byte codes. Present exactly for tmp2m, ugrd10m, vgrd10m, prate and dswrf. |
valueRange | [low, high] in unit: the range the pipeline treats as the field’s own. |
fillValues | Values GDAL hands back where the record carries no data; folded to valueRange[0] before anything else touches the plane. |
static | True for a field read at the analysis alone and published as one frame. |
predictor | delta (chunks chain against the previous frame) or raw. |
decimation | How reduced tiers sample the full tier: sample (the site’s own code) or peak (the warmest code around the site). |
companions | The subset of poster, video this variable’s bundle ships beside the store. video is further subject to the source’s video flag. |
conversion | The unit rule: see below. |
match | How the record is found: see below. |
conversion
{"rule": <name>, …}. The rule names the arithmetic that takes a record’s
values to unit and the unit spellings it accepts a record under; a
record under any other spelling is an error. Spellings are compared after
compaction: lower-cased, whitespace and *()[] removed, ² written ^2.
| Rule | Accepts | Arithmetic |
|---|---|---|
none | the entry’s acceptedUnits list, compacted; no list = any unit | identity |
celsius | k, kelvin; c, celsius, degc; f, fahrenheit, degf (after dropping °, degrees, degree) | K − 273.15; (F − 32) × 5⁄9 |
soil-temperature | as celsius | as celsius, after the soil read-through: a plane GDAL labels [C] whose values are kelvins is kelvins |
precipitation-rate | kg/m^2s, kg/m2s, kgm^-2s^-1, kgm-2s-1; mm/h, mm/hr | × 3600; identity for mm/h |
precipitation-accumulation | -, m, empty; kg/m^2, kg/m2, kgm^-2, kgm-2, mm, kg/m^2s, kg/m^2*s, kg/m2s, kg/m2*s | × 1000 for metres; identity for the millimetre spellings |
pascal-to-hectopascal | pa | ÷ 100 |
metre-to-kilometre | m, metre, meter, metres, meters | ÷ 1000 |
mass-ratio-to-g-per-kg | kg/kg | × 1000 |
proportion-to-percent | proportion, fraction, 1, -, empty | × 100 |
cloud-cover | %; -, 1, fraction, proportion, 0-1 | identity for %; × 100 otherwise |
degrees-true | degreetrue, degtrue, degrees, degree, deg, degreestrue | value mod 360 |
geopotential-to-metres | gpm, m; m2/s2, m2s-2 (compacted further: ^ dropped too) | identity; ÷ 9.80665 for the geopotential |
mass-density-to-micrograms | kg/m^3, kg/m3, kgm^-3, kgm-3 | × 10⁹, kg/m³ to µg/m³ |
per-second-to-1e-5 | 1/s, /s, s-1, s^-1 | × 10⁵, s⁻¹ to 10⁻⁵ s⁻¹ |
code-table | 1, -, empty, the entry’s table, any spelling containing it or 0=no (after dropping codetable) | identity |
A GRIB record is accepted under the listed spellings alone. A series
variable read out of a NetCDF file is accepted, in addition, under the
variable’s own unit and its udunits spelling, which take the identity:
the scaling rules scale only under their listed input spellings, so a
series already in the published unit is left as it is.
The raster expression the two inspection paths compare (gdal.py,
inspect.rs) is derived from the rule and the unit alone and is never
written anywhere. A variable whose gdal list is empty matches no band;
that is not an error.
match
The first eleven keys are the fetch-side spellings of VariableSpec
(xuebuild/variables.py), one for one. statistical is the code table
4.10 process the record must carry (null: instantaneous). aliases are
other parameter triples on the same surface, alternates whole other
record identities, both accepted when matching and never written.
gdal is how the variable’s record is recognised among a GRIB’s bands as
GDAL describes them: a list of rules, the band is the record when any one
accepts it. Empty for a field no GRIB band carries (a derived field, a
series-file variable). Each rule reads the band’s GRIB_ELEMENT,
GRIB_SHORT_NAME, GRIB_COMMENT, GRIB_LEVEL, description and, for the
template rules, GRIB_PDS_PDTN, GRIB_PDS_TEMPLATE_ASSEMBLED_VALUES and
GRIB_DISCIPLINE; the “text” is the short name, comment, level and
description joined and lower-cased, except that isobaric, phrase,
local-parameter, total-precipitation and accumulation-from-start
search the comment, level and description without the short name.
accumulation-from-start also reads GRIB_FORECAST_SECONDS. Elements compare upper-cased; the
template-mrms element compares as written.
A band whose GRIB_PDS_PDTN is an ensemble template — 2, 12 (a derived
forecast), 6, 10 (a percentile), 5, 9 (a probability) — is a statistic of
an ensemble’s members, which the element and surface do not tell from the
quantity (GDAL spells a spread as it spells the mean): only a
template-ensemble rule accepts it, every other rule refuses it. The GRIB2
header index applies the same rules to the octets it reads, and a variable
that carries its own ensemble block matches no record of another
template.
| Rule | Parameters | Accepts the band when |
|---|---|---|
surface | elements | the element is one of elements, and the short name ends in -SFC, or the text contains sfc=" or ground or water surface |
height | element, metres | the element matches, and the short name is <metres>-HTGL or <metres>-M-HTGL, or the text matches `(^ |
entire-atmosphere | element | the element matches, and the short name is 0-EATM or the text contains entire atmosphere |
mean-sea-level | elements | the element is one of elements, and the short name is 0-MSL or the text contains mean sea level |
isobaric | element, hpa | the element matches, and: where GRIB_PDS_PDTN is 0, 1, 8 or 11 and the assembled values (with GRIB_DISCIPLINE) give a first surface of type 100 with a value of whole pascals (the scaled value at index 11 times 10 to the minus the scale factor at index 10, a scale factor of at most 9 either way), that value is <hpa×100>; otherwise the short name is <hpa>-ISBL or <hpa×100>-ISBL, or the text names this level as <hpa> mb/hPa or <hpa×100> Pa and no other. The template decides first because GDAL spells 10 hPa 1000-ISBL, 1000 hPa’s short name in hectopascals |
cloud-layer | element, shortName, phrases | the element matches, and the short name is shortName or the text contains one of phrases |
template | — | GRIB_PDS_PDTN is 0 and the assembled values’ parameter category and number, surface type and surface value equal the entry’s parameter or one of its alternates (a null level value accepts any) |
template-aerosol | — | GRIB_PDS_PDTN is 48 and the assembled values equal the entry’s parameter and aerosol blocks whole |
template-ensemble | discipline, category, number, levelType, levelValue, ensemble, hours, statistical | see below |
template-rank | — | the element is match.gribElement, then as template against the entry’s own identity, the surface value being the rank; without an assembled template, the short name is <rank>-RESERVED(<surface type>) |
template-mrms | — | the element is the entry’s mrmsProduct up to its first _, the discipline is 209, and the assembled template 4.0 values equal the entry’s discipline-209 alternate (or its own identity); without an assembled template, a surface of type 102 must spell <value>-GPML in the short name |
total-precipitation | — | the element is unknown, tp, apcp or tprate; the short name is 0-SFC or the text contains surface; and the comment contains cat 1, subcat 193 or the text total precipitation |
accumulation-from-start | — | the element is APCP followed by nothing or by digits (GDAL names an accumulation by its length in hours, APCP06, APCP264, and the empty interval APCP); GRIB_PDS_PDTN is 8; GRIB_FORECAST_SECONDS, for template 4.8 the interval’s start, reads as 0 (a run total, where a window that starts later, the NAM’s APCP06 at 21600 s, is refused); and the short name is 0-SFC or the text contains ground or water surface |
local-parameter | category, number | the element is unknown, the short name is 0-SFC or the text contains ground or water surface, and the comment contains cat <category>, subcat <number> |
phrase | element, phrases | the element matches and the text contains one of phrases |
geopotential-surface | elements | the element is one of elements, the short name ends in -SFC or the text contains ground or water surface, and the text contains geopotential |
template-ensemble names the record whole:
levelValue is a number or null (any value, a missing one included);
ensemble is a block of docs/bundle.md §“Ensemble”; hours and
statistical are both integers (an interval of at least one hour and its
code table 4.10 process) or both null. It accepts a band when all hold:
GRIB_PDS_PDTNis the template of the block’s shape: a derived forecast 2 (hoursnull) or 12 (hoursset), a percentile 6 or 10, a probability 5 or 9;- the leading integer of
GRIB_DISCIPLINEisdiscipline; - in
GRIB_PDS_TEMPLATE_ASSEMBLED_VALUES(space-separated integers, from index 0): index 0 iscategory, 1number, 9levelType, and whenlevelValueis notnullthe surface value, index 11 × 10^−(index 10), equals it (a missing pair never equals a number); - the record’s statistic equals
ensemble. After the fifteen values every template shares with 4.0, a derived forecast’s code is index 15, a percentile’s index 15, a probability’s type index 17 with the lower limit at 18–19 and the upper at 20–21; a limit with either half missing isnull, and a probability keeps only the limits its type uses (types 0, 3, 5 the lower, 1, 4 the upper, 2 both), whatever the record wrote in the others; - of an interval template, there is exactly one time range, its unit is
hours (1), its length is
hoursand its processstatistical: indices 23, 25, 27, 28 of 4.12, 22, 24, 26, 27 of 4.10, 28, 30, 32, 33 of 4.9 (the range count, the process, the unit, the length).
A missing scale factor is −127 or 255 and a missing scaled value −2147483647 or 4294967295, whichever way the driver assembles them. A template the driver did not assemble, or assembled short, is no record.
Bundles
A bundle id absent from bundles is the scalar bundle of the variable of
the same id. Every other bundle is listed:
| Key | Meaning |
|---|---|
kind | scalar, vector (two members, u then v), composite (members an algorithm produced in the fetch stage, read off the series), volume (members read directly, lowest level first). |
members | The variables the bundle’s arrays hold, in file order (variableId 1…n). Absent for a scalar. |
derivation | optional. The members are computed in the converter from inputs, by the named algorithm. levelHpa is written where the algorithm takes the surface. |
producer, inputs, optionalInputs | A composite’s producer id, the channels it reads, and the subset of those a source may lack (read when the source fetches them, left out otherwise). |
derivation.kind is one of the closed set: vapour-flux (q·V/g from a
specific humidity and a wind pair), wave-vector (a height laid along a
direction), theta-e (Bolton’s equivalent potential temperature at
levelHpa), precipitation-type (the four categorical flags combined),
clear-air-turbulence (Ellrod at levelHpa, calibrated by the source’s
catCalibration), precipitation-rate (the first of inputs the source
lists, de-accumulated, de-averaged, divided by its interval, differenced
within its window or taken as is by the source’s precipitation flags).
Sources
One entry per source, every field of xuebuild/sources.py’s SourceSpec
under its camelCase name, nested records as objects, tuples as arrays —
except feed and packing, which only the fetch reads (the native
encoder never fetches), and columnArrays, which only build-columns reads
(zarr-profile.md, “Column store”). A companion family’s repack is always false:
repacking is the source’s packing, not a family’s.
The four precipitation flags name how the source’s precipitation input
becomes prate, and a source sets at most one: accumulatedPrecipitation
(a total since the run began, differenced against the previous frame),
averagedPrecipitation (a mean rate since the start of a window of
averageWindowHours, scaled to a total and differenced within the window),
intervalPrecipitation (the total over the interval ending at the frame,
divided by the interval’s hours) and windowedPrecipitation (a total since
the start of a window of accumulationWindowHours, differenced against
the previous frame of the same window and, on the window’s first frame,
against zero). A window that ends at hour h starts at
w × ⌊(h − 1) / w⌋ for its length w. A source that sets none reads the
rate as it is.
ensembles names, per published variable that is an ensemble’s centre
standing in for the deterministic field under its id, the ensemble block
written onto that variable’s metadata, as bands names a channel’s.
intervalPrecipitationPairs are further [rate, total] pairs an
intervalPrecipitation source derives the way it derives prate from its
input: the total over the interval ending at the frame divided by the
interval’s hours, on the same axis and analysis-optional through the
total’s own optionalAtAnalysis entry; the rate is then the bundle the
total is read for. variableFirstHours names inputs absent from every
frame before an hour (an integer above 0): no earlier frame is read for
them or required to carry them, they never key a run’s axis, and the
series of a bundle read from them starts at that hour, on a time_<id>
axis of its own; a build that ends before the hour leaves the bundle out.
variableStepHours names inputs written only every so many hours (an
integer above 0), counted from the input’s first hour (0 when
variableFirstHours does not name it): a frame at hour h carries one
exactly when h is at least the first hour and h less the first hour is
a multiple of the step. No other frame is read for it or required to carry
it, it never keys a run’s axis, and a bundle read from it is on a
time_<id> axis of its own, the run’s axis thinned to those hours — even
when its first hour is the analysis.
downsample is {"factor": n} or null. gridRelativeWinds is true on a
source published on a map projection, whose wind pairs a reader turns to east and
north (docs/encoder.md, “Native grids”), and whose bundles are on y and x.
gaussianN is the latitudes per hemisphere of a primary grid that is regular
Gaussian, or null. The meaning of each field is SourceSpec’s docstring and
docs/contribution/sources.md.
The shell’s copy
xue registry --shell web/src/data/registry.ts writes, beside the document,
the part of it the shell reads, as a TypeScript module (export const REGISTRY = {…} as const) so the ids reach the type checker as literal
unions. It carries every published variable’s unit, parameter,
producer, aerosol, ensemble and quality codebook; every bundle’s kind and
members; each source’s label (manifestModel), product,
latestFilename, observation, coreBundleIds and cadenceSeconds;
and, from the same tables, the isobaric, turbulence, stratosphere and
relative vorticity levels, the family
lists the shell’s rail groups by, the pressure family’s contour intervals
and the tropical cyclone registry (xuebuild/tc/registry.py). It is not
a published artifact either, and it is held to the tables by the same test
as the document.
Closed sets
A reader implements these names and refuses a document that names any
other, as it refuses a registrySchema it does not implement. Adding a
name is a behaviour change and needs the readers released; using an
existing name on a new entry does not.
| Field | Names |
|---|---|
quantization.<profile>.type | linear, log1p |
seriesQuantization.type | linear |
conversion.rule | the thirteen rules above |
match.gdal[].rule | the fifteen rules above |
predictor | delta, raw |
decimation | sample, peak |
companions[] | poster, video |
bundles.<id>.kind | scalar, vector, composite, volume |
derivation.kind | the six algorithms above |
sources.<id>.downsample | the one shape |
Validation
Before reading any input, a reader checks: the schema; every name above;
that every members, inputs and derivation.inputs id is a variable;
that every bundle id a source lists is a variable or a bundles entry;
that every id a source’s ensembles, intervalPrecipitationPairs,
variableFirstHours and variableStepHours name is a variable, the pairs
only on an intervalPrecipitation source and every first hour and step
above 0;
that a source sets at most one precipitation flag, and a
windowedPrecipitation source an accumulationWindowHours above 0;
that a vector has two members; that a published variable (one with
quantization) has every profile the reader is asked for; that a
seriesQuantization is a linear codebook whose code range follows from its
parameters, every code from 0 to 65535 and its nodataCode above 255, so
its codes are sixteen-bit; and that every profile codebook under
quantization keeps every code from 0 to 255. Any failure
refuses the whole build. A build is handed one source’s part of the document:
that source, the bundles it publishes and the variables they read
(registry.source_document_json), so these checks stop only the sources
that reach the problem.
Part of the Xue specification, licensed under CC BY 4.0.