zarr-indexing¶
This library is for modelling and transforming NumPy-style array indexing expressions. It separates the declaration of an array indexing expression from the result of that expression.
Developed for use in zarr.
Inspired by TensorStore's index-transform model.
Install¶
zarr-indexing is developed in the
zarr-python repository
and released independently of zarr itself:
Quickstart¶
Wrap an array, compose a lazy view through .lazy, and call result() when
you want its values:
import numpy as np
from zarr_indexing import LazyArray
source = np.array([10, 11, 12, 13, 14, 15])
view = LazyArray.from_numpy(source).lazy[2:5]
view.result()
# array([12, 13, 14])
Composing these selections does not read source values; the example reads them
at result(). Construction inspects source metadata. Dask tokenization hashes
plain NumPy data or delegates to an explicit source hook; other sources need
a naming opt-out or source hook. Lazy views compose shows how
the chain stays one description, and where the materialization boundary is.
Learn more¶
- Visual guide — one selection followed from coordinates to chunk plan. Using lazy indexing, start at An index selects coordinates; integrating a chunked backend, start at A request becomes a chunk plan and finish with the per-axis tables a plan is built from.
- Indexing pattern reference — every selection form with its NumPy-verified result.
- Integration boundaries — what a reader, writer, or scheduler owns, and what the plan owns.
- Lazy indexing a NumPy array and with Dask — runnable examples.
- The ndsel wire format — the JSON form of a selection.
- Design notes — TensorStore lineage, box vs query, and deliberate limits.
- API reference
- Release notes · License (MIT)