var_gridding
Stable type · Runtime I/O
Tier: stable · Kind: type · Topic: Runtime I/O
| Julia | TypeScript | Python | Rust | Go |
|---|---|---|---|---|
VarGridding | outside profile | not exported | VarGridding | outside profile |
Julia
struct VarGridding
VarGridding(base::String, shape::Vector{Int64}, dimnames::Vector{String}, flat_indices::Vector{Int64}, cart::Vector{CartesianIndex})
VarGridding(base, shape, dimnames, flat_indices, cart)
VarGridding
The gridded layout of one output base-variable, derived from a flat var_map
(RFC §7). Scatter a flat state vector u into this variable’s gridded array with
grid[cart[k]] = u[flat_indices[k]] — placement is by explicit CartesianIndex,
so it is correct regardless of enumeration order.
base::String— the variable’s base name (the cell key minus its[…]).shape::Vector{Int}— the gridded spatial shape. Empty for a scalar variable: a scalar is genuinely 0-spatial-dimensional, its gridded array is a 0-dArray{Float64,0}, and its on-disk dims are exactly[time_dim](RFC §16.12; see the reconciliation note there).dimnames::Vector{String}— one positional dim name per axis ofshape("<base>_d0", …), replaced by the realindex_setsnames once anOutputMetahas been applied. Empty for a scalar.flat_indices::Vector{Int}— the flatuindices of this variable’s cells.cart::Vector{CartesianIndex}— the 1-based grid position of eachflat_indicesentry (same order);CartesianIndex()for a scalar.
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 type.
Rust
pub struct VarGridding {
pub base: String,
pub shape: Vec<usize>,
pub dim_names: Vec<String>,
pub flat_indices: Vec<usize>,
}
impl VarGridding { pub fn n_cells(&self) -> usize }
impl VarGridding { pub fn is_scalar(&self) -> bool }
impl VarGridding { pub fn cart(&self, cell: usize) -> Vec<usize> }
impl VarGridding { pub fn scatter(&self, flat_u: &[f64], out: &mut [f64]) -> Result<(), OutputError> }
impl VarGridding { pub fn scatter_record(&self, flat_u: &[f64], out: &mut [f64], record: usize) -> Result<(), OutputError> }
impl VarGridding { pub fn gather(&self, grid: &[f64], flat_u: &mut [f64]) -> Result<(), OutputError> }
The gridded layout of one output base-variable, derived from the flat state-element names (RFC §7).
The inversion is baked into Self::flat_indices: it is indexed by
row-major (C-order) offset within Self::shape and holds the
column-major flat state index that feeds that cell. Scattering is
therefore a single linear pass with the transposition already applied —
out[o] = u[flat_indices[o]] — which is exactly the layout
earthsciio::format::WriteVar::data requires.
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.