nvalchemi.data.datapipes.ZarrWriteConfig#

pydantic model nvalchemi.data.datapipes.ZarrWriteConfig[source]#

Top-level storage plan handed to AtomicDataZarrWriter.

A ZarrWriteConfig collects the ZarrArrayConfig settings for a whole store and decides which one applies to each array the writer emits. Arrays are grouped by role: meta covers bookkeeping arrays (pointers and masks), core covers the standard AtomicData fields (positions, energy, forces, …), and custom covers any user-added arrays. Each group defaults to a plain ZarrArrayConfig, so an empty ZarrWriteConfig() is a valid “use Zarr defaults everywhere” plan.

For finer control, field_overrides maps an individual field name to its own ZarrArrayConfig; a matching override wins over the group-level config for that field. This lets you, for example, compress positions differently from the rest of the core arrays while leaving everything else on the shared core settings. Pass the completed config to the writer to control on-disk compression, chunking, and sharding across the store.

Examples

Compress core arrays with Zstd, but give positions its own Blosc/LZ4 codec via an override:

>>> from zarr.codecs import ZstdCodec, BloscCodec
>>> config = ZarrWriteConfig(
...     core=ZarrArrayConfig(compressors=(ZstdCodec(level=3),), chunk_size=1024),
...     field_overrides={
...         "positions": ZarrArrayConfig(compressors=(BloscCodec(cname="lz4"),))
...     },
... )

Accept Zarr defaults for every array group:

>>> config = ZarrWriteConfig()

Notes

meta, core, and custom each default to a fresh ZarrArrayConfig via default_factory, so omitting a group is equivalent to passing an unconfigured one. field_overrides is keyed by field name and takes precedence over the group config only for the fields it names. arbitrary_types_allowed is enabled so nested configs may hold native zarr codec objects.

See also

Zarr Compression Tuning – choosing codecs, chunk sizes, and shard sizes to balance store size against read and write throughput.

field meta: ZarrArrayConfig [Optional]#

Config for metadata arrays (pointers, masks).

field core: ZarrArrayConfig [Optional]#

Config for core data arrays (positions, energy, etc.).

field custom: ZarrArrayConfig [Optional]#

Config for user-added custom arrays.

field field_overrides: dict[str, ZarrArrayConfig] [Optional]#

Per-field overrides. Takes precedence over group-level config.