Conditional statement using python!

Discussion created by fabeosu on Jul 14, 2011
Latest reply on Jul 14, 2011 by Dan_Patterson
hi all,

I am trying to compute conditional statement as below in python:
Con(("Raster1" - "Raster2") > 0,0,1)
I want to create a raster that has value of 0 or 1 depending on the values of raster1 and raster2 in the pixels. My python code looks like this:

if Raster1>Raster2:
      Raster = 0
      Raster= 1
raster.save(os.path.join(outPath, "test"))

This code is not working. I would really appreciate if you have solution for it.