| 1171 | |
| 1172 | |
| 1173 | def test_auto_chunk_da_cftime(): |
| 1174 | yrs = np.arange(2000, 2120) |
| 1175 | cftime_dates = xr.date_range( |
| 1176 | start=f"{yrs[0]}-01-01", end=f"{yrs[-1]}-12-31", freq="1YE", use_cftime=True |
| 1177 | ) |
| 1178 | yr_array = np.tile(cftime_dates.values, (10, 1)) |
| 1179 | da = xr.DataArray( |
| 1180 | yr_array, dims=["x", "t"], coords={"x": np.arange(10), "t": cftime_dates} |
| 1181 | ).chunk({"x": 4, "t": 5}) |
| 1182 | actual = da.chunk("auto").data |
| 1183 | expected = da.data.rechunk({0: 10, 1: 120}) |
| 1184 | np.testing.assert_array_equal(actual, expected) |
| 1185 | assert actual.chunks == expected.chunks |
| 1186 | |
| 1187 | |
| 1188 | def test_map_blocks_error(map_da, map_ds): |