Skip to main content

Crate xue

Crate xue 

Source
Expand description

Xue bundle parser and frame decoder.

The contract is defined in docs/bundle.md (metadata, codebooks), docs/zarr-profile.md (stores) and docs/format.md (the legacy container), mirrored by the Python reference implementation in xuebuild/. Every integer computation on untrusted input uses checked arithmetic, and no allocation is sized from a file value before it is validated against the metadata grid and the file length.

Both container versions are read. In v1 a payload is one whole plane of one frame; in v2 it is a chunk — one spatial tile of one temporal group for one variable — which is what lets a reader fetch only the tiles a viewport covers (Bundle::decode_frame_tiles) and read one cell’s whole series at one chunk per group (Bundle::decode_series).

Two readers share the same structural validation and decode logic: Bundle opens a complete file, while StreamingBundle opens only the structural prefix (header + metadata + index) and accepts payload bytes incrementally as HTTP range responses arrive.

The crate is arranged as the format in the middle and the two directions around it:

  • format — the container’s byte layout, and nothing else: the constants, the enums, and the pack/unpack pair for each structure. Both directions go through it, so a field cannot drift between them.
  • decode — reading, re-exported here. Links nothing, compiles to wasm.
  • level3 — NEXRAD Level 3 N0B / N0G sweeps, a port of the Python reader the polar store is built from, so the browser can read a live site’s sweeps straight from the public bucket.
  • network — the Zarr profile’s network store: one value per river reach per frame, read IO-free like zarr.
  • column — the Zarr profile’s column store: a run’s codes cut so one cell’s whole column over the whole axis is one inner chunk, read IO-free too.
  • projection — the grid geometry both directions share: the Lambert conformal projection and true Gaussian latitudes.
  • encode — the native encoder, behind the off-by-default encoder feature because it links GDAL. Not a link: on a decode-only build the module does not exist, so linking it would dangle there.

Re-exports§

pub use decode::decode_chunk;
pub use decode::decode_chunk_u16;
pub use decode::Bundle;
pub use decode::StreamingBundle;
pub use format::align8;
pub use format::ChunkEntry;
pub use format::Compression;
pub use format::DecodeError;
pub use format::FixedHeader;
pub use format::FrameRequest;
pub use format::GroupEntry;
pub use format::IndexHeader;
pub use format::IndexHeaderV2;
pub use format::PlaneEntry;
pub use format::Predictor;
pub use format::TileGeometry;
pub use format::TileRect;
pub use format::VariableEntry;
pub use format::CHUNK_ENTRY_SIZE;
pub use format::ENTRY_SIZE;
pub use format::FLAG_ZSTD_CHECKSUM;
pub use format::GROUP_ENTRY_SIZE;
pub use format::HEADER_SIZE;
pub use format::HOUR_SECONDS;
pub use format::INDEX_HEADER_SIZE;
pub use format::INDEX_HEADER_SIZE_V2;
pub use format::INDEX_MAGIC;
pub use format::INDEX_MAGIC_V2;
pub use format::INDEX_VERSION;
pub use format::INDEX_VERSION_V2;
pub use format::MAGIC;
pub use format::MAX_PLANE_LENGTH;
pub use format::NO_DEPENDENCY;
pub use format::VARIABLE_ENTRY_SIZE;
pub use format::VERSION;
pub use format::VERSION_V2;
pub use level3::read_level3;
pub use level3::Level3Sweep;
pub use level3::LEVEL3_BEAMS;

Modules§

column
Reading the Zarr profile’s column store.
decode
Reading a Xue bundle, in four layers over crate::format:
encodeencoder
An experimental native encoder for the Xue v1 bundle format.
format
The Xue container’s byte layout, shared by the decoder and the encoder.
level3
Reading one NEXRAD Level 3 digital radial product (N0B, N0G) into a sweep on the fixed 0.5° beam grid.
network
Reading the Zarr profile’s network store.
projection
Grid geometry a reader needs without the encoder: the Lambert conformal projection a grid.projection block declares, and the true latitudes of a grid.gaussian block (docs/bundle.md, “Regional Grids”).
zarr
Reading the Xue Zarr profile.