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")