This content has been marked as final. Show 2 replies
In a python script using arcpy, to select a single band from a multi-band raster, just append "\\Layer_X" onto the path name. For example, my multi-band raster is "D:\\temp\\test.img" (or r"D:\temp\test.img" or 'D:/temp/test.img'). The second band would be "D:\\temp\\test.img\\Layer_2". Actually it could be called something other than Layer_X, you just have to look at how it is named when you load the raster into ArcMap (in ArcGIS 9 I think they were all named band_X).
To get the part of a raster with a specific value in a python script, you can use simple conditionals. I'm not totally sure this is what you want, but maybe it will help:
import arcpy arcpy.CheckOutExtension("Spatial") input_raster = "D:\\temp\\test.img" band1_obj = arcpy.sa.Raster(input_raster+"\\Layer_1") band2_obj = arcpy.sa.Raster(input_raster+"\\Layer_2") band3_obj = arcpy.sa.Raster(input_raster+"\\Layer_3") output_obj = (band1_obj == 112) & (band2_obj == 115) & (band3_obj == 5) output_obj.save(r"D:\\temp\\output.img")
I'm not sure how to do this in raster calculator. I was actually trying to figure that out when I found your post, but it is probably very similar though.
In ArcGIS 9.x Raster Catalog, you can use a syntax like this:
[KALI-1415.jpg - Band_1] <= 50 & [KALI-1415.jpg - Band_2] >= 120 & [KALI-1415.jpg - Band_3] <= 173
In ArcGIS 10 Raster Catalog, use full catalog path names instead of layer names in the expression.
(("C:\Test\KALI-1415.jpg\Band_1") <= 50) & (("C:\Test\KALI-1415.jpg\Band_2") >= 120) & (("C:\Test\KALI-1415.jpg\Band_3") <= 173)
*KALI-1415.jpg is my example image.