mesh_zarr#

Zarr writer sink for PhysicsNeMo Mesh objects.

Writes physicsnemo.mesh.Mesh objects to Zarr stores, producing output compatible with deep learning workflows. Each mesh is written to a separate .zarr directory containing:

  • mesh_pos — positions across all timesteps (T, N, 3)

  • edges — edge connectivity (E, 2)

  • thickness — per-node thickness (N,)

  • Additional point/cell data fields

The sink reconstructs mesh_pos from displacement fields (displacement_t{idx:03d}) and the reference points tensor.

Classes#

MeshZarrSink

Write Mesh objects to Zarr stores.

Module Contents#

class physicsnemo_curator.domains.mesh.sinks.mesh_zarr.MeshZarrSink(
output_dir: str,
compression_level: int = 3,
chunk_size_mb: float = 1.0,
naming_template: str | None = None,
)#

Bases: physicsnemo_curator.core.base.Sink[physicsnemo.mesh.Mesh]

Write Mesh objects to Zarr stores.

Each mesh is written to a separate .zarr directory. The sink reconstructs position trajectories from displacement fields and stores them as mesh_pos. Edge connectivity is read from global_data["edges"] (computed by EdgeComputeFilter).

Parameters:
  • output_dir (str) – Directory where Zarr stores will be written.

  • compression_level (int) – Blosc/zstd compression level (0-9). Default is 3.

  • chunk_size_mb (float) – Target chunk size in megabytes. Default is 1.0.

  • naming_template (str | None) – Format string for output names. Placeholders: {index}, {seq}. Default: mesh_{index:04d}.

Examples

>>> sink = MeshZarrSink(output_dir="./output/")
>>> paths = sink(mesh_generator, index=0)
>>> paths
['./output/mesh_0000.zarr']

Initialize the Zarr sink.

Parameters:
  • output_dir (str) – Directory where Zarr stores will be written.

  • compression_level (int) – Blosc/zstd compression level (0-9).

  • chunk_size_mb (float) – Target chunk size in megabytes.

  • naming_template (str | None) – Format string for output names.

classmethod params() list[physicsnemo_curator.core.base.Param]#

Return parameter descriptors for the Zarr sink.

Returns:

Descriptors for configuration parameters.

Return type:

list[Param]

set_source(
source: physicsnemo_curator.core.base.Source[physicsnemo.mesh.Mesh],
) None#

Set the source for resolving naming placeholders.

Parameters:

source (Source[Mesh]) – The pipeline source.

description: ClassVar[str] = 'Write Mesh objects to Zarr stores with configurable compression'#

Short description shown in the interactive CLI.

name: ClassVar[str] = 'Mesh Zarr Writer'#

Human-readable display name for the interactive CLI.

property output_dir: pathlib.Path#

Return the output directory path.