nvalchemi.data.datapipes.ZarrWriteConfig#
- pydantic model nvalchemi.data.datapipes.ZarrWriteConfig[source]#
Top-level storage plan handed to
AtomicDataZarrWriter.A
ZarrWriteConfigcollects theZarrArrayConfigsettings for a whole store and decides which one applies to each array the writer emits. Arrays are grouped by role:metacovers bookkeeping arrays (pointers and masks),corecovers the standardAtomicDatafields (positions, energy, forces, …), andcustomcovers any user-added arrays. Each group defaults to a plainZarrArrayConfig, so an emptyZarrWriteConfig()is a valid “use Zarr defaults everywhere” plan.For finer control,
field_overridesmaps an individual field name to its ownZarrArrayConfig; a matching override wins over the group-level config for that field. This lets you, for example, compresspositionsdifferently from the rest of the core arrays while leaving everything else on the sharedcoresettings. 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
positionsits 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, andcustomeach default to a freshZarrArrayConfigviadefault_factory, so omitting a group is equivalent to passing an unconfigured one.field_overridesis keyed by field name and takes precedence over the group config only for the fields it names.arbitrary_types_allowedis enabled so nested configs may hold nativezarrcodec 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.