I am new to ArcPy and Python. I have been trying to calculate NDSSI from 100 composite raster images from a folder using python script.
This script should take list of rasters from one workspace and calculate NDSSI and store results in .tif format in another folder. However, it is not working.
# Calculates NDSSI from multispectral composite images from a folder
import arcpy, string
from arcpy import env
from arcpy.sa import*
arcpy.CheckOutExtension("spatial")
env.workspace = r'E:\Landsat All Images\Processing\LT5\Composite'
outws = r'E:\Landsat All Images\Processing\LT5\NDSSI'
rasters = arcpy.ListRasters("*.tif")
for raster in rasters:
Blue = raster + "\Band_1"
NIR = raster + "\Band_4"
Num = arcpy.sa.Float(Raster(Blue) - Raster(NIR))
Denom = arcpy.sa.Float(Raster(Blue) + Raster(NIR))
NIR_eq = arcpy.sa.Divide(Num, Denom)
NIR_eq.save(outws)
print "Processing complete"