modelrunner.storage.backend.zarr module

Defines a class storing data in various storages

Requires the optional zarr module.

class ZarrStorage(store_or_path, *, mode='read')[source]

Bases: StorageBase

storage that stores data in an zarr file or database

Parameters:
  • store_or_path (str or Path or Store) – File path to the file/folder or a zarr Store

  • mode (str or AccessMode) – The file mode with which the storage is accessed. Determines allowed operations.

property can_update: bool

indicates whether the storage supports updating items

Type:

bool

close()[source]

closes the storage, potentially writing data to a persistent place

Return type:

None

extensions: list[str] = ['zarr', 'zip', 'sqldb', 'lmdb']

all file extensions supported by this storage

Type:

list of str

is_group(loc, *, ignore_cls=False)[source]

determine whether the location is a group

Parameters:
  • loc (sequence of str) – A list of strings determining the location in the storage

  • ignore_cls (bool) –

Returns:

True if the loation is a group

Return type:

bool

keys(loc=None)[source]

return all sub-items defined at a given location

Parameters:

loc (sequence of str) – A list of strings determining the location in the storage

Returns:

a list of all items defined at this location

Return type:

list

mode: AccessMode

access mode

Type:

AccessMode