使用乐队名称将HDF转换为TIFF

问题描述

我有〜500个具有hdf格式的11个波段的卫星图像。我想转换所有hdfs并以tiff格式保存乐队,并在乐队名称末尾添加。我可以分别提取tiff和乐队的名字,但无法弄清楚如何加入它们。任何帮助表示赞赏。

for i in band_name_to_conc:   
print(i) 



band01
band02
band03
band04
band05
band06
band07
band09
band10
band11
bandQA


import os 
input_dir = 'path/to/input'
output_dir = 'path/to/output'

command = 'gdal_translate -sds {input} {output}'

    for file in os.listdir(input_dir):
      if file.endswith('.hdf'):
        input = os.path.join(input_dir,file)
        filename = os.path.splitext(os.path.basename(file))[0]
        output =  os.path.join(output_dir,filename + '.tif')
        os.system(command.format(input = input,output = output))

这将输出显示

file_name_01.tif,file_name_01.tif,.
.
file_name_011.tif

我想要的是:

file_name_band01.tif 
file_name_band02.tif
.
.
.
.

file_name_bandQA.tif

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)