Skip to main content

Module encode

Module encode 

Source
Available on crate feature encoder only.
Expand description

An experimental native encoder for the Xue v1 bundle format.

The production encoder is Python (xue/ at the repository root), orchestrating GDAL and zstd as CLI subprocesses. This module is the same pipeline in Rust with the external tools linked in process instead:

  • GDAL through gdal-sys (georust) replaces gdalinfo -json and gdal_translate -of ENVI — a production GFS run wrote and re-read several gigabytes of intermediate ENVI files per build, which the Python-side profiling identified as the remaining wall.
  • grib-rs replaces the hand-rolled GRIB2 header index that locates each variable’s band.
  • zstd is linked rather than piped through the CLI.
  • The decoder in this same crate is the read-back verifier, so every bundle the encoder writes is decoded, and every store’s documents and shard indexes parsed, by the code the browser and the API run.

Scope is convert-bin: gridded input to Zarr stores (zarrstore) and, when asked for, .xue bundles, reduced-resolution variants, posters and the manifest, and columns, the column store cut from a finished run’s map stores. Fetching, the showcase driver and the optional H.264 companion artifacts stay in Python.

It is behind the off-by-default encoder feature: it links GDAL, which the decoder does not, and nothing that only decodes should have to find a GDAL to build. docs/bundle.md, docs/zarr-profile.md and docs/format.md are the normative specs for everything written here, and xuebuild/binconvert.py is the reference the outputs are diffed against.

Re-exports§

pub use convert::convert_bin;
pub use convert::ConvertOptions;
pub use errors::EncodeError;
pub use errors::Result;
pub use registry::Registry;

Modules§

columns
A run’s column store, cut from its finished map stores.
convert
Build Xue v1 bundles from gridded input — the port of xuebuild/binconvert.py.
errors
The pipeline’s user-actionable error type.
gdalio
A thin safe wrapper over the handful of GDAL C entry points the encoder needs.
grid
Grid discovery, the -180-first column roll, and regional cropping — the port of xuebuild/grid.py.
poster
First-frame posters: one tiny artifact per variable so a variable switch can paint immediately while the real stream loads.
quantize
Xue v1 quantization codebooks — the port of xuebuild/quantize.py.
registry
The registry document (docs/registry.md): the variables, bundles and sources an encoder builds, read from one JSON document in place of a table of its own.
temporal
Xue temporal grouping, tiling and residual coding — the port of xuebuild/temporal.py.
zarrstore
Xue bundles as Zarr v3 stores, written straight from their codes.