0

I have a color infrared image of an agricultural field. The color infrared image contains 3 different bands; NIR, Red, and Green (order maintained here). To calculate the NDVI, I am currently using the "Image Analysis" tool of ArcMap (shown below). enter image description here

However, I am writing a larger python script where calculating the NDVI from the color infrared image is a part. If I had two different single band rasters, I could have used the raster calculator. But, in this case, I only got one Color Infrared raster which contains 3 different bands. Is there any way to calculate the NDVI using the Color Infrared raster with ArcPy?

  • 2
    You could try to use the Make Raster Layer tool to split the appropriate bands in your CIR raster. Then you can use raster calculator in your script to produce the NDVI. – reevesii Jul 26 '18 at 16:10
1

Try using arcpy.Raster() objects, which let you specify the band by appending it to the path:

>>> out_raster = arcpy.Raster(r"C:\Temp\test.tif\Band_1") + arcpy.Raster(r"C:\Temp\test.tif\Band_2")
>>> out_raster.save(r"C:\Temp\test_sum.tif")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.