(self)
| 4407 | ) |
| 4408 | |
| 4409 | def test_to_stacked_array_transposed(self) -> None: |
| 4410 | # test that to_stacked_array uses updated dim order after transposition |
| 4411 | ds = xr.Dataset( |
| 4412 | data_vars=dict( |
| 4413 | v1=(["d1", "d2"], np.arange(6).reshape((2, 3))), |
| 4414 | ), |
| 4415 | coords=dict( |
| 4416 | d1=(["d1"], np.arange(2)), |
| 4417 | d2=(["d2"], np.arange(3)), |
| 4418 | ), |
| 4419 | ) |
| 4420 | da = ds.to_stacked_array( |
| 4421 | new_dim="new_dim", |
| 4422 | sample_dims=[], |
| 4423 | variable_dim="variable", |
| 4424 | ) |
| 4425 | dsT = ds.transpose() |
| 4426 | daT = dsT.to_stacked_array( |
| 4427 | new_dim="new_dim", |
| 4428 | sample_dims=[], |
| 4429 | variable_dim="variable", |
| 4430 | ) |
| 4431 | v1 = np.arange(6) |
| 4432 | v1T = np.arange(6).reshape((2, 3)).T.flatten() |
| 4433 | np.testing.assert_equal(da.to_numpy(), v1) |
| 4434 | np.testing.assert_equal(daT.to_numpy(), v1T) |
| 4435 | |
| 4436 | def test_update(self) -> None: |
| 4437 | data = create_test_data(seed=0) |
nothing calls this directly
no test coverage detected