aggregate_cells_test.py 文件源码

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

项目:geopyspark 作者: locationtech-labs 项目源码 文件源码
def test_aggregate_variance(self):
        result = self.raster_rdd.aggregate_by_cell(Operation.VARIANCE)

        band = np.array([[
            [1,   1.5, 2,   2.5, 3],
            [1.5, 2,   2.5, 3,   3.5],
            [2,   2.5, 3,   3.5, 4],
            [2.5, 3,   3.5, 4,   4.5],
            [3,   3.5, 4,   4.5, 5]]])

        expected = np.array([
            ((self.first - band) ** 2) + ((self.second - band) ** 2),
            ((self.first - band) ** 2) + ((self.second - band) ** 2)
        ])
        expected_2 = np.full((5, 5), -1.0)

        self.assertTrue((result.lookup(1, 0)[0].cells == expected).all())
        self.assertTrue((result.lookup(0, 0)[0].cells == expected_2).all())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号