Skip to content

API reference

Choose the guide stopping point that matches your job before following module links:

The modules are layered: the transform algebra at the bottom, chunk resolution and the wire format built on top of it.

The transform algebra

  • zarr_indexing.domainIndexDomain, a rectangular region of integer coordinates with an explicit (possibly non-zero) origin
  • zarr_indexing.output_mapConstantMap, DimensionMap, and ArrayMap: three representations of a set of integer coordinates, one per storage dimension
  • zarr_indexing.transformIndexTransform, which pairs a domain with output maps, plus the indexing ([...], .oindex, .vindex), intersect, and translate operations, and selection_to_transform transforms into one

Chunk resolution

  • zarr_indexing.chunk_resolutionplan_chunks, which lazily projects a request through a caller-selected grid, the reusable ChunkPlan and paired-transform ChunkProjection values, and the plan's factored form: GridPartition (from ChunkPlan.partition), holding one StridedSet or IndexedSet table per axis and a JointSet for correlated index arrays
  • zarr_indexing.gridDimensionGridLike, the Protocol describing the narrow chunk-grid surface chunk resolution consumes, so that nothing here imports zarr, plus EdgeDimensionGrid and dimension_grids_from_chunks, a concrete per-axis grid for callers with no zarr grid to hand

Lazy arrays

  • zarr_indexing.lazy_arrayLazyArray, a wrapper for system-memory/basic-indexing sources that adds a .lazy accessor for TensorStore-style deferred indexing, plus Partition and parts() / with_parts(), which determine the boxes a read is broken into. Device sources require an explicit custom reader that transfers into the supplied system-memory output
  • zarr_indexing.readerReader, the backend execution boundary that obtains the values described by a complete transform; basic_reader serves conservative duck arrays and numpy_reader is selected explicitly by LazyArray.from_numpy
  • zarr_indexing.boundary — the translation between NumPy's positional dialect and the transform algebra's literal coordinates

The ndsel wire format (see the guide)

Errors

  • zarr_indexing.errors — the index-error types this package raises, also exported at the top level. zarr.errors defines classes of the same names, which are different objects; both subclass IndexError

Test support (needs the testing extra)

  • zarr_indexing.testing.statefulChainedIndexingStateMachine, a Hypothesis state machine that composes indexing steps onto a LazyArray wrapping your array and checks every step against NumPy, plus apply_selection, the NumPy model it checks against
  • zarr_indexing.testing.strategies — the selection strategies the machine draws from, for a project that has its own harness

Every name listed in zarr_indexing.__all__ is re-exported at the top level, so from zarr_indexing import IndexTransform and from zarr_indexing.transform import IndexTransform are equivalent. zarr_indexing.testing is deliberately not among them: it imports hypothesis, which the rest of the package does not.