Using conditional statement in ModelBuilder on multiband file

2264
0
05-21-2013 10:55 AM
MelaniePhillips
New Contributor
I'm trying to run an NDVI on a multiband file; however, some of the pixels within each band have reflectance values less than 0 or greater than 1.  I want to set up a conditional statement to run an NDVI if the pixels are not null and set the pixel values to null if they already are.  Here's the formula I'm using:

Con("%B4_RC.tif%"  ==  Null OR "%B3_RC.tif%" == Null , Null , (("%B4_RC.tif%" - "%B3_RC.tif%") / ("%B4_RC.tif%" + "%B3_RC.tif%")))

My total model flow consists of:

1. make raster layer (to separate each of the 6 bands in the multiband file)
2. raster calculator ('SetNull Band# < 0, Band#' which was calculated for each of the 6 bands to set values less than 0 to null)
3. raster calculator (this is where I'm having the problem.  I need to run an NDVI just on bands 3 and 4 but only if BOTH bands have non-null values)

Is there something wrong with my code format?
0 Kudos
0 Replies