squirrel.driver.zarr

Module Contents

Classes

ZarrDriver

A Driver that allows retrieval of items using keys, in addition to allowing iteration over the items.

class squirrel.driver.zarr.ZarrDriver(url: str, **kwargs)

Bases: squirrel.driver.driver.MapDriver

A Driver that allows retrieval of items using keys, in addition to allowing iteration over the items.

Initializes ZarrDriver.

name = zarr
get(key: str, fetcher_func: Callable[[zarr.hierarchy.Group, str], Any], **storage_options)Iterator

Given key, returns a sample defined by self.fetcher_func.

get_iter(fetcher_func: Callable[[zarr.hierarchy.Group, str], Any] = fetch, storage_options: Optional[Dict] = None, flatten: bool = True, **kwargs)squirrel.iterstream.Composable

Returns an iterable of samples as specified by fetcher_func.

Parameters
  • fetcher_func – A function with two arguments, a zarr.hierarchy.Group object and a key of type string. This function is used to fetch required fields and attributes of a sample. Defaults to squirrel.driver.zarr.fetch().

  • storage_options – Keyword arguments passed to squirrel.zarr.convenience.get_group(), which will

  • called to retrieve the store that will be provided to fetcher_func. (be) –

  • flatten – Whether to flatten the returned iterable. Defaults to True.

  • **kwargs – Keyword arguments that will be passed to MapDriver.get_iter().

Returns

(Composable) Iterable over the items in the store.

get_root_group(mode: str = 'r', **storage_options)squirrel.zarr.group.SquirrelGroup

Returns the root zarr group, i.e. zarr group at self.url.

Parameters
  • mode (str) – IO mode (e.g. “r”, “w”, “a”). Defaults to “r”. mode affects the store of the returned group. See squirrel.zarr.convenience.get_group() for more information.

  • **storage_options – Keyword arguments passed to squirrel.zarr.convenience.get_group().

keys()Iterator[str]

Returns the keys of the root zarr group.