plaid.storage.zarr.bridge¶
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.
plaid.storage.zarr.bridge.to_var_sample_dict
¶
Extracts a sample dictionary from a Zarr dataset by index.
Parameters:
-
zarr_dataset(Group) –The Zarr group containing the dataset.
-
idx(int) –The sample index to extract.
-
features(Optional[list[str]]) –Iterable of feature names (keys) to extract from the dataset.
-
indexers(Optional[dict[str, Any]], default:None) –Optional mapping
feature_path -> indexerused to select feature values along the last axis.
Returns:
-
dict[str, Any]–dict[str, Any]: Dictionary of variable features for the sample.
Source code in plaid/storage/zarr/bridge.py
plaid.storage.zarr.bridge.sample_to_var_sample_dict
¶
Converts a Zarr sample to a variable sample dictionary.
Parameters:
-
zarr_sample(dict[str, Any]) –The raw Zarr sample data.
Returns:
-
dict[str, Any]–dict[str, Any]: The processed variable sample dictionary.