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

Method test_stack_unstack_slow

xarray/tests/test_dataset.py:4307–4321  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4305 assert actual.identical(ds[["b"]])
4306
4307 def test_stack_unstack_slow(self) -> None:
4308 ds = Dataset(
4309 data_vars={
4310 "a": ("x", [0, 1]),
4311 "b": (("x", "y"), [[0, 1], [2, 3]]),
4312 },
4313 coords={"x": [0, 1], "y": ["a", "b"]},
4314 )
4315 stacked = ds.stack(z=["x", "y"])
4316 actual = stacked.isel(z=slice(None, None, -1)).unstack("z")
4317 assert actual.broadcast_equals(ds)
4318
4319 stacked = ds[["b"]].stack(z=["x", "y"])
4320 actual = stacked.isel(z=slice(None, None, -1)).unstack("z")
4321 assert actual.identical(ds[["b"]])
4322
4323 def test_to_stacked_array_invalid_sample_dims(self) -> None:
4324 data = xr.Dataset(

Callers

nothing calls this directly

Calls 7

stackMethod · 0.95
DatasetClass · 0.90
unstackMethod · 0.45
iselMethod · 0.45
broadcast_equalsMethod · 0.45
stackMethod · 0.45
identicalMethod · 0.45

Tested by

no test coverage detected