Version: dev

derive_output_gridding

Stable function · Runtime I/O

Tier: stable · Kind: function · Topic: Runtime I/O

JuliaTypeScriptPythonRustGo
derive_output_griddingoutside profilenot exportedderive_output_griddingoutside profile

Julia

derive_output_gridding(var_map::AbstractDict)
derive_output_gridding(var_map::AbstractDict, meta::OutputMeta)
derive_output_gridding(var_map) -> Vector{VarGridding}

Invert the flat var_map (state-element name → flat index) into one VarGridding per output base-variable (RFC §7). Groups the cell keys by base name via _parse_cell_key (a key with no […] suffix is a scalar variable), derives each axis length as the max cell index along that axis, and records the flat-index → CartesianIndex scatter map. Base-variable order is the first-seen order in var_map’s iteration, made deterministic by sorting on the base name so the derived schema is reproducible.

A gridded variable’s cells must be dense: exactly one cell per grid position. An incomplete grid (a hole, which would leave an uninitialized value on disk) or a double-covered one (which would silently drop a cell) is an OutputError , not a silent mis-write.


derive_output_gridding(var_map, meta::OutputMeta) -> Vector{VarGridding}

Doc-aware derive_output_gridding : first invert the flat var_map (shape + scatter map, the language-neutral core), then rename each variable’s axes from positional <base>_d0 to its REAL declared dim names via meta.var_dims (RFC §7 → §8). A variable with no declared shape in meta (a scalar, or a var_map built without a document) keeps its positional names. Validates that the declared dim count and each index_sets length agree with the shape recovered from the flat state — a mismatch means the document and the built state disagree, which must fail loudly rather than mislabel an axis.

Source

TypeScript

Not available in TypeScript. TypeScript is outside the runtime I/O capability profile (Julia, Python, Rust): data-source providers, refresh cadence, output sinks, checkpoints.

Python

Python does not export this function.

Rust

pub fn derive_output_gridding(slot_names: &[String]) -> Result<Vec<VarGridding>, OutputError>

Invert the flat state-element names into one VarGridding per output base-variable (RFC §7), the flat index of a name being its position in slot_names — the shape Solution::state_variable_names already has.

Base-variable order is sorted by base name, matching Julia, so a derived plan is reproducible and cross-language comparable.

Errors See OutputError : a ragged rank, a duplicated scalar key, a 0 index, or a grid the cells do not densely cover.

Source · Rust docs

Go

Not available in Go. Go is outside the runtime I/O capability profile (Julia, Python, Rust): data-source providers, refresh cadence, output sinks, checkpoints.