test_encoders.py 文件源码

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

项目:rio-rgbify 作者: mapbox 项目源码 文件源码
def test_encode_data_roundtrip():
    minrand, maxrand = np.sort(np.random.randint(-427, 8848, 2))

    testdata = np.round((np.sum(
        np.dstack(
            np.indices((512, 512),
                dtype=np.float64)),
        axis=2) / (511. + 511.)) * maxrand, 2) + minrand

    baseval = -1000
    interval = 0.1

    rtripped = _decode(data_to_rgb(testdata.copy(), baseval, interval), baseval, interval)

    assert testdata.min() == rtripped.min()
    assert testdata.max() == rtripped.max()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号