MCPcopy Index your code
hub / github.com/pydata/xarray / test_fake_target_chunksize_cftime

Function test_fake_target_chunksize_cftime

xarray/tests/test_namedarray.py:646–668  ·  view source on GitHub ↗

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. - This is the same as the above test, but specifically for a CFTime array case - split for testing reasons

()

Source from the content-addressed store, hash-verified

644
645@requires_cftime
646def test_fake_target_chunksize_cftime() -> None:
647 """
648 Check that `fake_target_chunksize` returns the expected chunksize and dtype.
649 - It pretends to dask we are chunking an array with an 8-byte dtype, ie. a float64.
650 - This is the same as the above test, but specifically for a CFTime array case - split for testing reasons
651 """
652 import cftime
653
654 target_chunksize = 1024
655
656 input_array = np.array(
657 [
658 cftime.Datetime360Day(2000, month, day, 0, 0, 0, 0)
659 for month in range(1, 11)
660 for day in range(1, 11)
661 ],
662 dtype=object,
663 ).reshape(10, 10)
664
665 faked_chunksize, dtype = fake_target_chunksize(input_array, target_chunksize) # type: ignore[arg-type,unused-ignore]
666
667 assert faked_chunksize == 73
668 assert dtype == np.float64

Callers

nothing calls this directly

Calls 1

fake_target_chunksizeFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…