AnsweredAssumed Answered

Composite Bands syntax error

Question asked by rhowell2 on Apr 26, 2019
Latest reply on Apr 26, 2019 by Dan_Patterson

I have a small image dataset collected by a UAV multispectral camera and I'm trying to make a script tool that merges 4 tiffs into one, for each band (4 blues into one blue, 4 greens into one green, etc) and then use the Composite Bands tool. It runs fine in the Python window (ArcGIS Pro 2.2) but the tool gives me an invalid syntax error and I'm not really sure what the error is.

Here's my script:

outWorkspace = arcpy.GetParameterAsText(0)
cell = arcpy.GetParameterAsText(1)
blue = arcpy.GetParameterAsText(2)
green = arcpy.GetParameterAsText(3)
red = arcpy.GetParameterAsText(4)
nir = arcpy.GetParameterAsText(5)
rededge = arcpy.GetParameterAsText(6)
outName = arcpy.GetParameterAsText(7)

###create empty raster datasets
arcpy.AddMessage("making raster datasets")
blue_T = arcpy.CreateRasterDataset_management(outWorkspace, "blue.tif", cell, '32_BIT_FLOAT', "", 1, "", "", "", "", "")
green_T = arcpy.CreateRasterDataset_management(outWorkspace, "green.tif", cell, '32_BIT_FLOAT', "", 1, "", "", "", "", "")
red_T = arcpy.CreateRasterDataset_management(outWorkspace, "red.tif", cell, '32_BIT_FLOAT', "", 1, "", "", "", "", "")
nir_T = arcpy.CreateRasterDataset_management(outWorkspace, "nir.tif", cell, '32_BIT_FLOAT', "", 1, "", "", "", "", "")
rededge_T = arcpy.CreateRasterDataset_management(outWorkspace, "rededge.tif", cell, '32_BIT_FLOAT', "", 1, "", "", "", "", "")

#####################################################################################
#Merge layers####################################################################
###combine blue layers#####################################################
arcpy.AddMessage("Merging blue...")
bluex = arcpy.Mosaic_management(blue, blue_T)
#################################################################################
#Combine green layers#############################################################
arcpy.AddMessage("Merging green...")
greenx = arcpy.Mosaic_management(green, green_T)
#Combine red layers#############################################################
arcpy.AddMessage("Merging red...")
redx = arcpy.Mosaic_management(red, red_T)
#Combine red layers#############################################################
arcpy.AddMessage("Merging NIR...")
nirx = arcpy.Mosaic_management(nir, nir_T)
#Combine red layers#############################################################
arcpy.AddMessage("Merging red edge...")
rededgex = arcpy.Mosaic_management(rededge, rededge_T)
##############################################################################

#composite bands
arcpy.AddMessage("Running Composite Bands...")
arcpy.CompositeBands_management(bluex;greenx;redex;nirx;rededgex, outWorkspace + outName)

Everything through line 36 works perfectly, so I have 5 complete tiffs, one for each band.

 

The error is coming in line 40. When I run it in the python window with the actual files and file paths (bypassing the variables) it works. So I assume it's an easy fix and I'm doing something wrong with concatenating my strings or something along those lines.

Outcomes