icon_sc.core.io — monitors and output¶
Generic I/O: monitors (§7.4). Synchronous single-rank slice; async/zarr post-slice.
In-memory monitor and shared monitor helpers (§7.4, SPEC S03).
MemoryMonitor snapshots states for tests and interactive work (the
RCE-style acceptance loop verifies trajectories against closed forms through
it). Snapshots are deep copies of the selected DataArrays: T0 loops with
out= mutate buffers in place, so a monitor holding references would watch
its history being rewritten.
- class icon_sc.core.io.monitor.MemoryMonitor(*, variables=None, name=None)¶
Store deep-copied state snapshots in memory (frozen interface, SPEC S03).
- icon_sc.core.io.monitor.snapshot_state(state, *, variables=None)¶
A deep-copied snapshot of
state(optionally restricted tovariables).The
timeentry is always kept; DataArray values are deep-copied, anything else (time) is carried as-is.
Synchronous single-rank NetCDF monitor (§7.4, SPEC S03).
xarray-based, one file, record appended on every store — semantics from
upstream sympl’s NetCDFMonitor (see REFERENCES.lock), reimplemented over
xarray. The T0 implementation keeps all stored records in memory and rewrites
the whole file per store (synchronous, deliberately dumb — enough for the
SCM example); async writers and zarr are post-slice.
- class icon_sc.core.io.netcdf.NetCDFMonitor(filename, *, variables=None, name=None)¶
Write stored states to one NetCDF file, appending a time record per store.
variablesrestricts the stored set (default: every DataArray in the state). The provenance stamp (§5.3) is written into the global attributes as JSON undericon_sc_provenance.