plaid.storage.zarr.bridge

Zarr bridge utilities.

This module provides utility functions for bridging between PLAID samples and Zarr storage format. It includes functions for key transformation and sample data conversion.

Functions

to_var_sample_dict(→ dict[str, Any])

Extracts a sample dictionary from a Zarr dataset by index.

sample_to_var_sample_dict(→ dict[str, Any])

Converts a Zarr sample to a variable sample dictionary.

Module Contents

to_var_sample_dict(zarr_dataset: zarr.Group, idx: int, features: list[str] | None) dict[str, Any][source]

Extracts a sample dictionary from a Zarr dataset by index.

Parameters:
  • zarr_dataset (zarr.Group) – The Zarr group containing the dataset.

  • idx (int) – The sample index to extract.

  • features – Iterable of feature names (keys) to extract from the dataset.

Returns:

Dictionary of variable features for the sample.

Return type:

dict[str, Any]

sample_to_var_sample_dict(zarr_sample: dict[str, Any]) dict[str, Any][source]

Converts a Zarr sample to a variable sample dictionary.

Parameters:

zarr_sample (dict[str, Any]) – The raw Zarr sample data.

Returns:

The processed variable sample dictionary.

Return type:

dict[str, Any]