test_grids.py 文件源码

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

项目:rastercube 作者: terrai 项目源码 文件源码
def test_cell_indices_in_tile(self):
        """
        Test get_cell_indices_in_tile by filling an int array for a tile,
        using the indices returned by cell_indices_in_tile for each cell
        in the tile. The array should be fully filled with 1 at the end
        """
        h, v = (20, 11)
        grid = MODISGrid()
        tile_data = np.zeros(
            (MODISGrid.MODIS_tile_height, MODISGrid.MODIS_tile_width),
            dtype=np.int16)
        cells = grid.get_cells_for_tile(h, v)
        for cell in cells:
            i_range, j_range = grid.get_cell_indices_in_tile(cell, h, v)
            tile_data[i_range[0]:i_range[1], j_range[0]:j_range[1]] += 1
        # If tile_data contains some zeros, this means the tile is not
        # fully covered by the cells. If it contains values > 1, this means
        # than more than one cell covers a given tile pixel
        assert_array_equal(tile_data, np.ones_like(tile_data))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号