def test_get_numpy_array_3d_reverse():
array = DataArray(
np.random.randn(2, 3, 4),
dims=['x', 'y', 'z'],
attrs={'units': ''},
)
numpy_array = get_numpy_array(array, ['z', 'y', 'x'])
assert numpy_array.shape == (4, 3, 2)
assert np.all(np.transpose(numpy_array, (2, 1, 0)) == array.values)
assert np.byte_bounds(numpy_array) == np.byte_bounds(array.values)
assert numpy_array.base is array.values
评论列表
文章目录