Skip to main content

Module convert

Module convert 

Source
Available on crate feature encoder only.
Expand description

Build Xue v1 bundles from gridded input — the port of xuebuild/binconvert.py.

Each variable is packaged into its own single-variable .xue file so the frontend can download exactly the fields it needs. A forecast source arrives as one GRIB2 file per forecast hour; an observation source (observation.rs) as one NetCDF file whose bands are the time axis. Everything past frame discovery — crop, quantize, temporal grouping, container write, manifest — is the same for both.

Structs§

ConvertOptions
PlaneGrids
One grid per variable of a frame: the run’s single grid for every source with one, and — on a source with a grid family — the grid of the family each variable is read from. Mirrors _grid_for in xuebuild/binconvert.py, where the same thing is a GridInfo or a mapping.

Enums§

PlaneSources
How the planes of a frame are read: one file’s plane source (GRIB: the same for every record) or an observation window’s per-variable ones. Mirrors _plane_source_for in xuebuild/binconvert.py.

Constants§

DEFAULT_ZSTD_LEVEL

Functions§

align_packing_steps
Round two run-total accumulations onto the coarser of their two packing lattices before they are differenced, so a frame where the GRIB encoder coarsened its step does not difference rounding. Returns the planes to difference, (current, previous), borrowing whichever is unchanged. Mirrors align_packing_steps in xuebuild/derive.py, rounding half to even as NumPy does.
average_window_start
First hour of the window whose interval ends at hour.
bundle_grid_family
The grid family one bundle is built on: the family every one of its inputs is read from, so the bundle’s grid, tile, variants and poster are that family’s.
convert_bin
Convert a GRIB run (or one observation NetCDF file) into per-variable Xue bundles.
deaccumulate_precipitation
Mean precipitation rate (mm/h) over the step ending at the current frame, from run-total accumulations in mm. The first frame has no preceding interval, so its rate is zero; packing noise can make the accumulation dip slightly, so negative differences clamp to zero.
deaverage_precipitation
Mean rate (mm/h) over the step ending at hour, from GFS window-cumulative average rates (kg/m^2 s, sflux PRATE ave).
decimate_codes
Reduced copy of one quantized plane: every factor-th row and column of the full plane from row and column 0 (rows/columns 0, 2, 4, … for the half tier), matching the poster decimation so every tier shares the same sample sites — sampling the full plane by 4 or 8 is the same as halving it twice or three times. grid is the full plane’s grid.
dewindow_precipitation
Mean rate (mm/h) over the step ending at hour, from totals in mm accumulated since the start of a window that resets every window_hours (the NAM’s APCP: 0-5 hour acc, 12-13 hour acc).
grid_family_of
The id of the grid family one input is read from, or None for an input on the source’s own grid (SourceSpec::grid_family_of). Mirrors grid_family_of in xuebuild/discover.py.
store_dimensions
The dimension names a bundle’s arrays carry in its run’s shared store (docs/zarr-profile.md, “Coordinates”), and so the coordinate arrays the bundle uses there. Mirrors store_dimensions in xuebuild/discover.py.
validate_build
Whether this encoder builds options.model from registry with the profile and bundles options asks for, decided from the document alone: the source, the profile, a codebook for every published variable and the requested bundles. Nothing is read or written. convert_bin runs it first, so a build and the question asked before it cannot disagree.
zstd_version