def get_cells_for_tile(self, tile_h, tile_v):
"""
Returns the list of cells covered by the given modis tile. The tile
is identified by its MODIS grid coordinates
"""
range_x = np.arange(tile_h * self.n_cells_per_tile_x,
(tile_h + 1) * self.n_cells_per_tile_x)
range_y = np.arange(tile_v * self.n_cells_per_tile_y,
(tile_v + 1) * self.n_cells_per_tile_y)
cells_ij = np.dstack(
np.meshgrid(range_y, range_x, indexing='ij')).reshape(-1, 2)
cells = np.ravel_multi_index(
(cells_ij[:, 0], cells_ij[:, 1]),
(self.n_cells_y, self.n_cells_x)
)
# sanity check
assert len(cells) == self.n_cells_per_tile_x * self.n_cells_per_tile_y
return cells
评论列表
文章目录