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
setBandName.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录