setBandName.py 文件源码

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

项目:python_scripting_for_spatial_data_processing 作者: upsdeepak 项目源码 文件源码
def setBandName(inputFile, band, name):
    # Open the image file, in update mode
    # so that the image can be edited.
    dataset = gdal.Open(inputFile, GA_Update)
    # Check that the image has opened
    if not dataset is None:
        # Get the image Band
        imgBand = dataset.GetRasterBand(band)
        # Check the image band was available
        if not imgBand is None:
            # Set the image band name
            imgBand.SetDescription(name)
        else:
            # Print out an error message
            print("Could not open the image band: ", band)

    else:
        # Print the error message if the file
        # could not be opened
        print("Could not open the input image file: ", inputFile)

# This is the first par of the script
# to be executed
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号