utils.py 文件源码

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

项目:unmixing 作者: arthur-e 项目源码 文件源码
def clean_mask(rast):
    '''
    Clips the values in a mask to the interval [0, 1]; values larger than 1
    become 1 and values smaller than 0 become 0.
    Arguments:
        rast    An input gdal.Dataset or numpy.array instance
    '''
    # Can accept either a gdal.Dataset or numpy.array instance
    if not isinstance(rast, np.ndarray):
        rastr = rast.ReadAsArray()

    else:
        rastr = rast.copy()

    return np.clip(rastr, a_min=0, a_max=1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号