()
| 3553 | |
| 3554 | |
| 3555 | def test_to_npy_stack(): |
| 3556 | x = np.arange(5 * 10 * 10).reshape((5, 10, 10)) |
| 3557 | d = da.from_array(x, chunks=(2, 4, 4)) |
| 3558 | |
| 3559 | with tmpdir() as dirname: |
| 3560 | stackdir = os.path.join(dirname, "test") |
| 3561 | da.to_npy_stack(stackdir, d, axis=0) |
| 3562 | assert os.path.exists(os.path.join(stackdir, "0.npy")) |
| 3563 | assert (np.load(os.path.join(stackdir, "1.npy")) == x[2:4]).all() |
| 3564 | |
| 3565 | e = da.from_npy_stack(stackdir) |
| 3566 | assert_eq(d, e) |
| 3567 | |
| 3568 | |
| 3569 | def test_view(): |