I have a script that combines three singe-band rasters into an RGB raster. Everything works fine, except that the bands in the output raster are all called Band_1. The data is from the three different bands I used as inputs, and they are assigned to the correct RGB bands, but they're all called Band_1, which is very confusing. If I use the Composite Bands tool in ArcMap with the same input files, they are named appropriately. Does anyone know why this is happening and/or what needs to happen to have the bands named Band_1, Band_2 and Band_3 in the symbology? I'm working in ArcGIS 10.6.1.
This is what the outputs look like in the TOC. The top one is the raster generated by the script, the bottom one was generated manually using the tool interface in ArcMap. The rasters are identical in terms of pixel values in the RGB bands.
If you open the properties of the composite raster, you can see that there are 3 different bands to choose from, but they're all called Band_1. If you change the green band to the first Band_1 listed instead of the second, the image behaves as you would expect if you changed the green band (Band_2 in a the tool-generated output) to the red band (Band_1 in the tool-generated output). Likewise, the statistics for each layer (Red, Green, Blue) match those for the appropriate input single-band raster. It really does appear to be only the naming that's off.
I've even tried naming my variables Band_1, Band_2, Band_3, but, as expected, that didn't make any difference.
Here's the relevant part of the code:
# Generate Red Band
rband = (2*rp*(1-blue_mask) + zp*blue_mask)*255
Band_1 = rband*mask
# Generate Green Band
gband = (3*SquareRoot(xp)*(1-blue_mask) + 2*zp*blue_mask)*255
Band_2 = gband*mask
# Generate Blue Band
bband = (2*bp*(1-blue_mask) + 5*zp*blue_mask)*255
Band_3 = bband*mask
# Combine the bands into an RGB raster
outpath = outdir+'\\'+outname