Skip to content

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

{
  "registrySchema": 1,
  "variables": { "<variable id>": { … } },
  "bundles":   { "<bundle id>":   { … } },
  "sources":   { "<source id>":   { … } }
}

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

"tmp2m": {
  "label": "2 meter temperature",
  "unit": "°C",
  "parameter": { "discipline": 0, "parameterCategory": 0, "parameterNumber": 0,
                 "typeOfFirstFixedSurface": 103,
                 "scaleFactorOfFirstFixedSurface": 0, "scaledValueOfFirstFixedSurface": 2 },
  "producer": { "id": "shachen" },                 // optional
  "aerosol": { "aerosolType": 62001, … },          // optional
  "ensemble": { "percentileValue": 25 },           // optional
  "quantization": {                                // optional: absent = input-only
    "quality":  { "type": "linear", "offset": -60.0, "scale": 0.5, "minimumCode": 0, "maximumCode": 220, "nodataCode": 255 },
    "compact":  { … },
    "balanced": { … }
  },
  "seriesQuantization": { "type": "linear", "offset": -90.0, "scale": 0.1,  // optional
                          "minimumCode": 0, "maximumCode": 1500, "nodataCode": 65535 },
  "valueRange": [-60, 50],
  "fillValues": [],
  "static": false,
  "predictor": "delta",
  "decimation": "sample",
  "companions": ["poster", "video"],
  "conversion": { "rule": "celsius" },
  "match": { … }
}
KeyMeaning
label, unit, parameter, producer, aerosol, ensembleExactly 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).
quantizationOne 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).
seriesQuantizationOptional. 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.
fillValuesValues GDAL hands back where the record carries no data; folded to valueRange[0] before anything else touches the plane.
staticTrue for a field read at the analysis alone and published as one frame.
predictordelta (chunks chain against the previous frame) or raw.
decimationHow reduced tiers sample the full tier: sample (the site’s own code) or peak (the warmest code around the site).
companionsThe subset of poster, video this variable’s bundle ships beside the store. video is further subject to the source’s video flag.
conversionThe unit rule: see below.
matchHow 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.

RuleAcceptsArithmetic
nonethe entry’s acceptedUnits list, compacted; no list = any unitidentity
celsiusk, kelvin; c, celsius, degc; f, fahrenheit, degf (after dropping °, degrees, degree)K − 273.15; (F − 32) × 5⁄9
soil-temperatureas celsiusas celsius, after the soil read-through: a plane GDAL labels [C] whose values are kelvins is kelvins
precipitation-ratekg/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-hectopascalpa÷ 100
metre-to-kilometrem, metre, meter, metres, meters÷ 1000
mass-ratio-to-g-per-kgkg/kg× 1000
proportion-to-percentproportion, fraction, 1, -, empty× 100
cloud-cover%; -, 1, fraction, proportion, 0-1identity for %; × 100 otherwise
degrees-truedegreetrue, degtrue, degrees, degree, deg, degreestruevalue mod 360
geopotential-to-metresgpm, m; m2/s2, m2s-2 (compacted further: ^ dropped too)identity; ÷ 9.80665 for the geopotential
mass-density-to-microgramskg/m^3, kg/m3, kgm^-3, kgm-3× 10⁹, kg/m³ to µg/m³
per-second-to-1e-51/s, /s, s-1, s^-1× 10⁵, s⁻¹ to 10⁻⁵ s⁻¹
code-table1, -, 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

"match": {
  "gribElement": "TMP",
  "indexField": ":TMP:2 m above ground:",
  "excludedIndexPhrases": [],
  "indexQualifier": "",
  "alternateIndexFields": [],
  "ecmwfParam": "2t",
  "ecmwfAlternateParams": [],
  "openMeteo": "temperature_2m",
  "dwdParam": "T_2M",
  "mrmsProduct": "",
  "gdalUnit": "C",
  "statistical": null,
  "aliases": [[0, 3, 0]],
  "alternates": [ { "discipline": 0, "category": 2, "number": 22, "levelType": 103,
                    "levelValue": 10.0, "statistical": 2, "gdalUnit": "" } ],
  "gdal": [ { "rule": "height", "element": "TMP", "metres": 2 } ]
}

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.

RuleParametersAccepts the band when
surfaceelementsthe element is one of elements, and the short name ends in -SFC, or the text contains sfc=" or ground or water surface
heightelement, metresthe element matches, and the short name is <metres>-HTGL or <metres>-M-HTGL, or the text matches `(^
entire-atmosphereelementthe element matches, and the short name is 0-EATM or the text contains entire atmosphere
mean-sea-levelelementsthe element is one of elements, and the short name is 0-MSL or the text contains mean sea level
isobaricelement, hpathe 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-layerelement, shortName, phrasesthe 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-ensemblediscipline, category, number, levelType, levelValue, ensemble, hours, statisticalsee 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-parametercategory, numberthe 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>
phraseelement, phrasesthe element matches and the text contains one of phrases
geopotential-surfaceelementsthe 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:

{ "rule": "template-ensemble", "discipline": 0, "category": 1, "number": 8,
  "levelType": 1, "levelValue": null, "ensemble": { "percentileValue": 50 },
  "hours": 6, "statistical": 1 }

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_PDTN is the template of the block’s shape: a derived forecast 2 (hours null) or 12 (hours set), a percentile 6 or 10, a probability 5 or 9;
  • the leading integer of GRIB_DISCIPLINE is discipline;
  • in GRIB_PDS_TEMPLATE_ASSEMBLED_VALUES (space-separated integers, from index 0): index 0 is category, 1 number, 9 levelType, and when levelValue is not null the 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 is null, 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 hours and its process statistical: 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:

"wind10m":   { "kind": "vector", "members": ["ugrd10m", "vgrd10m"] },
"qflux850":  { "kind": "vector", "members": ["uqflx850", "vqflx850"],
               "derivation": { "kind": "vapour-flux", "inputs": ["spfh850", "ugrd850", "vgrd850"] } },
"thetae850": { "kind": "scalar",
               "derivation": { "kind": "theta-e", "inputs": ["tmp850", "spfh850"], "levelHpa": 850 } },
"prate":     { "kind": "scalar",
               "derivation": { "kind": "precipitation-rate", "inputs": ["prate", "tp", "prate_ave", "apcp"] } },
"dustrgb":   { "kind": "composite", "members": ["dustr", "dustg", "dustb"], "producer": "shachen",
               "inputs": ["ir086", "ir104", "ir112", "ir123"], "optionalInputs": ["ir112"] },
"refl3d":    { "kind": "volume", "members": ["refl0500", …] }
KeyMeaning
kindscalar, 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).
membersThe variables the bundle’s arrays hold, in file order (variableId 1…n). Absent for a scalar.
derivationoptional. The members are computed in the converter from inputs, by the named algorithm. levelHpa is written where the algorithm takes the surface.
producer, inputs, optionalInputsA 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.

"gfs": {
  "id": "gfs", "manifestModel": "GFS", "product": "pgrb2-0p25", "latestFilename": "latest.json",
  "steps": [[120, 1], [384, 3]],
  "inputVariableIds": ["tmp2m", "prate", …],
  "accumulatedPrecipitation": false, "averagedPrecipitation": false, "intervalPrecipitation": false,
  "windowedPrecipitation": false, "averageWindowHours": 6, "accumulationWindowHours": 12, "firstHour": 0,
  "companionFiles": [{ "id": "wave", "variableIds": ["htsgw", …], "repack": false, "productionGrid": null, "tile": null }],
  "optionalAtAnalysis": ["prate", …],
  "statisticalProcesses": [["gust", 2]],
  "bands": [["ir039", { "satelliteSeries": 0, "satelliteNumber": 174, "instrumentType": 297, "centralWavenumber": 257380 }]],
  "ensembles": [["tmp2m", { "percentileValue": 50 }]],
  "intervalPrecipitationPairs": [["prateq25", "apcpq25"]],
  "variableFirstHours": [["apcp24gt1", 24]],
  "variableStepHours": [["apcp24gt1", 12]],
  "platform": null, "openMeteo": null, "gridStep": null, "region": null,
  "bundleScalarIds": [...], "coreBundleIds": [...], "bundleVectorIds": [...], "bundleCompositeIds": [], "bundleVolumeIds": [],
  "productionGrid": [1440, 721], "tile": [48, 52], "variantFactors": [2], "seriesBundleIds": [...],
  "fetchConcurrency": 4, "observation": false, "windowHours": null, "cadenceSeconds": null, "objectCadenceSeconds": null,
  "seriesFile": false, "downsample": null, "cycleHours": 6, "longCycles": [], "longCycleSteps": [],
  "gridRelativeWinds": false, "gaussianN": null, "video": true, "catCalibration": [[300, 0.0, 0.0], …]
}

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.

FieldNames
quantization.<profile>.typelinear, log1p
seriesQuantization.typelinear
conversion.rulethe thirteen rules above
match.gdal[].rulethe fifteen rules above
predictordelta, raw
decimationsample, peak
companions[]poster, video
bundles.<id>.kindscalar, vector, composite, volume
derivation.kindthe six algorithms above
sources.<id>.downsamplethe 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.