Check that `fake_target_chunksize` returns the expected chunksize and dtype. - It pretends to dask we are chunking an array with an 8-byte dtype, ie. a float64. As such, it will *double* the amount of memory a 4-byte dtype (like float32) would try to use, fooling it into actually us
(
input_array: DuckArray[Any],
expected_chunksize_faked: int,
expected_dtype: DTypeLike,
)
| 622 | ], |
| 623 | ) |
| 624 | def test_fake_target_chunksize( |
| 625 | input_array: DuckArray[Any], |
| 626 | expected_chunksize_faked: int, |
| 627 | expected_dtype: DTypeLike, |
| 628 | ) -> None: |
| 629 | """ |
| 630 | Check that `fake_target_chunksize` returns the expected chunksize and dtype. |
| 631 | - It pretends to dask we are chunking an array with an 8-byte dtype, ie. a float64. |
| 632 | As such, it will *double* the amount of memory a 4-byte dtype (like float32) would try to use, |
| 633 | fooling it into actually using the correct amount of memory. For object dtypes, which are |
| 634 | generally larger, it will reduce the effective dask configuration chunksize, reducing the size of |
| 635 | the arrays per chunk such that we get the same amount of memory used. |
| 636 | """ |
| 637 | target_chunksize = 1024 |
| 638 | |
| 639 | faked_chunksize, dtype = fake_target_chunksize(input_array, target_chunksize) |
| 640 | |
| 641 | assert faked_chunksize == expected_chunksize_faked |
| 642 | assert dtype == expected_dtype |
| 643 | |
| 644 | |
| 645 | @requires_cftime |
nothing calls this directly
no test coverage detected
searching dependent graphs…