zarr_indexing.domain
zarr_indexing.domain ¶
Index domains — rectangular regions in N-dimensional integer space.
An IndexDomain represents the set of valid coordinates for an array or
array view. It is the cartesian product of per-dimension integer ranges::
IndexDomain(inclusive_min=(2, 5), exclusive_max=(10, 20))
# represents {(i, j) : 2 <= i < 10, 5 <= j < 20}
Unlike NumPy, domains can have non-zero origins. After slicing
arr[5:10], the result has origin 5 and shape 5 — coordinates 5 through
9 are valid. This follows the TensorStore convention.
IndexDomain
dataclass
¶
A rectangular region in N-dimensional index space.
The valid coordinates are the integers in
[inclusive_min[d], exclusive_max[d]) for each dimension d.
Source code in packages/zarr-indexing/src/zarr_indexing/domain.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
__init__ ¶
__init__(
inclusive_min: tuple[int, ...],
exclusive_max: tuple[int, ...],
labels: tuple[str, ...] | None = None,
) -> None
__post_init__ ¶
Source code in packages/zarr-indexing/src/zarr_indexing/domain.py
contains ¶
contains_domain ¶
contains_domain(other: IndexDomain) -> bool
Source code in packages/zarr-indexing/src/zarr_indexing/domain.py
from_shape
classmethod
¶
from_shape(shape: tuple[int, ...]) -> IndexDomain
Create a domain with origin at zero.
intersect ¶
intersect(other: IndexDomain) -> IndexDomain | None
Source code in packages/zarr-indexing/src/zarr_indexing/domain.py
narrow ¶
narrow(selection: Any) -> IndexDomain
Apply a basic selection and return a narrowed domain. Indices are absolute coordinates. Integer indices produce length-1 extent. Strided slices are not supported — use IndexTransform for strides.
Source code in packages/zarr-indexing/src/zarr_indexing/domain.py
translate ¶
translate(offset: tuple[int, ...]) -> IndexDomain