Return a dataset with a variable with the given shape and preferred chunks.
(self, shape, pref_chunks)
| 183 | var_name = "data" |
| 184 | |
| 185 | def create_dataset(self, shape, pref_chunks): |
| 186 | """Return a dataset with a variable with the given shape and preferred chunks.""" |
| 187 | dims = tuple(f"dim_{idx}" for idx in range(len(shape))) |
| 188 | return xr.Dataset( |
| 189 | { |
| 190 | self.var_name: xr.Variable( |
| 191 | dims, |
| 192 | np.empty(shape, dtype=np.dtype("V1")), |
| 193 | encoding={ |
| 194 | "preferred_chunks": dict(zip(dims, pref_chunks, strict=True)) |
| 195 | }, |
| 196 | ) |
| 197 | } |
| 198 | ) |
| 199 | |
| 200 | def check_dataset(self, initial, final, expected_chunks): |
| 201 | assert_identical(initial, final) |
no test coverage detected