MCPcopy
hub / github.com/pydata/xarray / test_stack

Method test_stack

xarray/tests/test_dask.py:680–689  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

678 assert chunked_array.chunksizes == {"x": (2, 2)}
679
680 def test_stack(self):
681 data = da.random.normal(size=(2, 3, 4), chunks=(1, 3, 4))
682 arr = DataArray(data, dims=("w", "x", "y"))
683 stacked = arr.stack(z=("x", "y"))
684 z = pd.MultiIndex.from_product(
685 [list(range(3)), list(range(4))], names=["x", "y"]
686 )
687 expected = DataArray(data.reshape(2, -1), {"z": z}, dims=["w", "z"])
688 assert stacked.data.chunks == expected.data.chunks
689 self.assertLazyAndEqual(expected, stacked)
690
691 def test_dot(self):
692 eager = self.eager_array.dot(self.eager_array[0])

Callers

nothing calls this directly

Calls 3

stackMethod · 0.95
assertLazyAndEqualMethod · 0.95
DataArrayClass · 0.90

Tested by

no test coverage detected