def to_pb_multibandtile(obj):
"""Converts an instance of ``Tile`` to ``ProtoMultibandTile``.
Args:
obj (:class:`~geopyspark.geotrellis.Tile`): An instance of ``Tile``.
Returns:
ProtoMultibandTile
"""
cells = obj.cells
if cells.ndim == 2:
cells = np.expand_dims(cells, 0)
band_count = cells.shape[0]
def create_tile(index):
return Tile(cells[index, :, :], obj.cell_type, obj.no_data_value)
multibandtile = ProtoMultibandTile()
multibandtile.tiles.extend([to_pb_tile(create_tile(x)) for x in range(band_count)])
return multibandtile
评论列表
文章目录