1

I am trying to perform an NDVI on multiple rasters in a folder. As I understand it, an NDVI output has a range of values from -1 to 1. Values 0 and above should represent vegetation and values below zero should represent water/clouds/etc. When I look at my output in ArcGIS Pro the NDVI values seem to be inverted.

Why is that?

See code and output below.

for file in os.listdir(DIR):
    if file.endswith(".tif"):

        new_folder_loc = arcpy.management.CreateFolder(DIR, r"\NDVI")
        new_folder_path = r"F:\GITOC_Tiles\NDVI\\"
        Out_NDVI_loc = new_folder_path + r"NDVI_"+ str(file)

        red_band = arcpy.ia.ExtractBand(file,[4])
        NIR_band = arcpy.ia.ExtractBand(file,[8])

        red = arcpy.sa.Float(red_band)
        NIR = arcpy.sa.Float(NIR_band)

        NDVI = ((NIR - red) / (NIR + red))
        NDVI.save(Out_NDVI_loc)

        print(file+ r" complete")

enter image description here

1
  • You don't state what satellite data you are using... If you look here, there are many band options for many sensor types.
    – Hornbydd
    Commented Jul 22 at 14:48

1 Answer 1

1

The rasters that I am working with were composite tiles made out of Sentinel 2 images. The composite bands did not correlate exactly with the Sentinel 2 bands so I was applying the wrong bands to the equation. Readjusting the bands corrected my output.

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