Search and concatenate Landsat bands with Python

المشرف العام

Administrator
طاقم الإدارة
I have a number of Landsat geotiff (*.TIF) file in a folder. The problem is simple, I need to search certain Landsat bands from that list and make a composite tif image. I am using Orfeo Toolbox's CLI utility. So far I have this

import osdir = "C:\Documents and Settings\Landsat_image"def fileList(): for root, dirnames, filenames in os.walk(dir): for tifFile in filenames: for i in range(3): if tifFile.find('B' + str(i)) != -1 and tifFile.endswith('.TIF'): inputImages = os.path.join(dir, tifFile) outputImages = os.path.join(root, tifFile) + '_concat.tif' process = os.system( 'otbcli_ConcatenateImages -il %s -out %s' % (inputImages, outputImages))print fileList()The otbcli_ConcatenateImages needs the inputs in following format

otbcli_ConcatenateImages -il GomaAvant.png GomaApres.png -out otbConcatenateImages.tif

But maybe it is getting multiple entries for out.

ERROR: Invalid number of value for: "out", invalid number of values 4

I know the problem is silly but I am still a noob.



أكثر...
 
أعلى