(self, dtype)
| 4779 | reason="stacked dimension's labels have to be hashable, but is a numpy.array" |
| 4780 | ) |
| 4781 | def test_to_stacked_array(self, dtype): |
| 4782 | labels = range(5) * unit_registry.s |
| 4783 | arrays = { |
| 4784 | name: np.linspace(0, 1, 10).astype(dtype) * unit_registry.m |
| 4785 | for name in labels |
| 4786 | } |
| 4787 | |
| 4788 | ds = xr.Dataset({name: ("x", array) for name, array in arrays.items()}) |
| 4789 | units = {None: unit_registry.m, "y": unit_registry.s} |
| 4790 | |
| 4791 | func = method("to_stacked_array", "z", variable_dim="y", sample_dims=["x"]) |
| 4792 | |
| 4793 | actual = func(ds).rename(None) |
| 4794 | expected = attach_units( |
| 4795 | func(strip_units(ds)).rename(None), |
| 4796 | units, |
| 4797 | ) |
| 4798 | |
| 4799 | assert_units_equal(expected, actual) |
| 4800 | assert_equal(expected, actual) |
| 4801 | |
| 4802 | @pytest.mark.parametrize( |
| 4803 | "func", |
nothing calls this directly
no test coverage detected