hoops_ai.storage.datastorage.zarr_storage_handler
Classes
|
Handles storage and retrieval of data using Zarr, including: |
- class hoops_ai.storage.datastorage.zarr_storage_handler.OptStorage(store_path, compress_extension='.data')
Bases:
DataStorage- Handles storage and retrieval of data using Zarr, including:
Setting dimension names so that xarray can open each array.
Checking for NaNs before writing and before zipping.
Compressing into a .zip-based Zarr store.
- close()
Deletes the entire DirectoryStore if needed. Thread-safe.
- Return type:
None
- compress_store()
Copies data from the DirectoryStore to a ZipStore, verifying no NaNs exist in raw arrays. If everything is OK, removes the DirectoryStore.
- Return type:
- get_file_path(data_key)
Returns the direct path for a particular data key (sub-directory or array).
- get_group_for_array(array_name)
Determines which group an array belongs to based on the schema.
- get_keys()
Retrieves a list of all top-level keys in the storage. :returns: A list of top-level keys in the storage. :rtype: list
- Return type:
- get_schema()
Retrieves the schema definition for this storage instance.
- Returns:
The schema definition, or empty dict if no schema is set
- Return type:
- load_data(data_key)
Loads data from the Zarr store by key.
- load_metadata(key)
Loads custom metadata by key from the local metadata file.
- save_data(data_key, data)
Saves data (numpy arrays, lists, dicts, scalars, strings) under data_key. Overwrites if that key already exists.
- save_metadata(key, value)
Saves custom metadata (JSON-serializable) to the local metadata file.