protobufcodecs.py 文件源码

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

项目:geopyspark 作者: locationtech-labs 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号