test_statistics.py 文件源码

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

项目:agdc_statistics 作者: GeoscienceAustralia 项目源码 文件源码
def test_new_geometric_median():
    from datacube_stats.statistics import NewGeomedianStatistic

    arr = np.random.random((5, 100, 100))
    dataarray = xr.DataArray(arr, dims=('time', 'y', 'x'), coords={'time': list(range(5))})
    dataset = xr.Dataset(data_vars={'band1': dataarray, 'band2': dataarray})

    new_geomedian_stat = NewGeomedianStatistic()
    result = new_geomedian_stat.compute(dataset)

    assert isinstance(result, xr.Dataset)

    assert result.band1.dims == result.band2.dims == ('y', 'x')

    # The two bands had the same inputs, so should have the same result
    assert (result.band1 == result.band2).all()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号