AnsweredAssumed Answered

Calculates NDSSI from multispectral composite images from a folder

Question asked by mohsinmeraj on Dec 31, 2016
Latest reply on Jan 1, 2017 by xander_bakker

I an new to arcpy and python. I have been trying to calculate NDSSI from 100 composite raster images from a folder using python script. Any how i tried my luck using a script but its not working. Taking list of rasters from one workspace and calculate NDSSI and store results in .tif format in another folder. 

import arcpy, string

from arcpy import envfrom 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"

 

Outcomes