test_get_restore_numpy_array.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:sympl 作者: mcgibbon 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号