(
self, *, name, shape, dtype, fill_value, encoding, attrs
)
| 1162 | return cast(ZarrArray, zarr_array) |
| 1163 | |
| 1164 | def _create_new_array( |
| 1165 | self, *, name, shape, dtype, fill_value, encoding, attrs |
| 1166 | ) -> ZarrArray: |
| 1167 | if coding.strings.check_vlen_dtype(dtype) is str: |
| 1168 | dtype = str |
| 1169 | |
| 1170 | if self._write_empty is not None: |
| 1171 | if ( |
| 1172 | "write_empty_chunks" in encoding |
| 1173 | and encoding["write_empty_chunks"] != self._write_empty |
| 1174 | ): |
| 1175 | raise ValueError( |
| 1176 | 'Differing "write_empty_chunks" values in encoding and parameters' |
| 1177 | f'Got {encoding["write_empty_chunks"] = } and {self._write_empty = }' |
| 1178 | ) |
| 1179 | else: |
| 1180 | encoding["write_empty_chunks"] = self._write_empty |
| 1181 | |
| 1182 | if _zarr_v3(): |
| 1183 | # zarr v3 deprecated origin and write_empty_chunks |
| 1184 | # instead preferring to pass them via the config argument |
| 1185 | encoding["config"] = {} |
| 1186 | for c in ("write_empty_chunks", "order"): |
| 1187 | if c in encoding: |
| 1188 | encoding["config"][c] = encoding.pop(c) |
| 1189 | |
| 1190 | zarr_array = self.zarr_group.create( |
| 1191 | name, |
| 1192 | shape=shape, |
| 1193 | dtype=dtype, |
| 1194 | fill_value=fill_value, |
| 1195 | **encoding, |
| 1196 | ) |
| 1197 | zarr_array = _put_attrs(zarr_array, attrs) |
| 1198 | return zarr_array |
| 1199 | |
| 1200 | def set_variables( |
| 1201 | self, |
no test coverage detected