Check if the chunks are regular "Regular" in this context means that along every axis, the chunks all have the same size, except the last one, which may be smaller Parameters ---------- chunkset: tuple of tuples of ints From the ``.chunks`` attribute of an ``Array``
(chunkset)
| 4149 | |
| 4150 | |
| 4151 | def _check_regular_chunks(chunkset): |
| 4152 | """Check if the chunks are regular |
| 4153 | |
| 4154 | "Regular" in this context means that along every axis, the chunks all |
| 4155 | have the same size, except the last one, which may be smaller |
| 4156 | |
| 4157 | Parameters |
| 4158 | ---------- |
| 4159 | chunkset: tuple of tuples of ints |
| 4160 | From the ``.chunks`` attribute of an ``Array`` |
| 4161 | |
| 4162 | Returns |
| 4163 | ------- |
| 4164 | True if chunkset passes, else False |
| 4165 | |
| 4166 | Examples |
| 4167 | -------- |
| 4168 | >>> import dask.array as da |
| 4169 | >>> arr = da.zeros(10, chunks=(5, )) |
| 4170 | >>> _check_regular_chunks(arr.chunks) |
| 4171 | True |
| 4172 | |
| 4173 | >>> arr = da.zeros(10, chunks=((3, 3, 3, 1), )) |
| 4174 | >>> _check_regular_chunks(arr.chunks) |
| 4175 | True |
| 4176 | |
| 4177 | >>> arr = da.zeros(10, chunks=((3, 1, 3, 3), )) |
| 4178 | >>> _check_regular_chunks(arr.chunks) |
| 4179 | False |
| 4180 | """ |
| 4181 | for chunks in chunkset: |
| 4182 | if len(chunks) == 1: |
| 4183 | continue |
| 4184 | if len(set(chunks[:-1])) > 1: |
| 4185 | return False |
| 4186 | if chunks[-1] > chunks[0]: |
| 4187 | return False |
| 4188 | return True |
| 4189 | |
| 4190 | |
| 4191 | def from_delayed(value, shape, dtype=None, meta=None, name=None): |
searching dependent graphs…