Skip to content

Attributes

linc_convert.utils.io.zarr.attributes

Attributes Handling for Zarr.

This file contains code from the Zarr project https://github.com/zarr-developers/zarr-python

Attributes

Attributes(obj, *, write_through=True)

Bases: MutableMapping[str, Any]

In-memory, write-through (configurable) attributes mapping for Zarr v2/v3.

Reads are served from an in-memory cache. On mutation, the cache is updated and, if write_through is True, the file is flushed atomically. Otherwise, call .flush() explicitly to persist.

Works for both arrays and groups, as long as the parent exposes: - .store_path (path-like, directory) - .zarr_version (2 or 3)

asdict

asdict()

Return a snapshot of attributes as a dict.

put

put(d)

Overwrite all attributes with d (in-memory), then flush.

flush

flush()

Persist current in-memory attributes to disk atomically.

refresh

refresh()

Discard in-memory cache and re-read from disk.

__getitem__

__getitem__(key)

Get an attribute by key.

__setitem__

__setitem__(key, value)

Set or update an attribute.

__delitem__

__delitem__(key)

Delete an attribute.

__iter__

__iter__()

Iterate over a snapshot of keys.

__len__

__len__()

Return number of attributes.