Select to view content in your preferred language

Band Combination for Raster TIFF

541
1
05-02-2020 12:46 PM
JohnCortenbach
New Contributor

Hi, I am still new in python. I would appreciate your guidance in looking at my script tool. I like to use your previous example to work on my tool. Can you help me? 

#Composite Bands
#Usage: CompositeBand_management in_rasters;in_rasters...out_raster
import arcpy,sys,os
from arcpy import env
arcpy.env.overwriteOutput = True
env.workspace = r"F:\Programming Final\Input"

rasterList = [ ]

x = 1

for root, dirs, files in os.walk(path_images):
      for name in files:
            bands = os.path.join(root,name)
            if WV2.endswith(('.tif')):
                  rasterList.append(bands)
            if len(rasterList) > 0:
               out_raster = path_images + "\\"+"Raster.tif"
               arcpy.CompositeBands_management("rasterList, out_raster")
               x += 1

Tags (1)
0 Kudos
1 Reply
DavidPike
MVP Frequent Contributor

Please see Dan Patterson‌ 's guide to code formatting when posting, this block of code will put people off who would otherwise help you.

/blogs/dan_patterson/2016/08/14/script-formatting