malnunn

Con tool: unable to assign constant value for false condition

Discussion created by malnunn on Jan 19, 2014
Latest reply on Jul 23, 2014 by gyetmanesri-ca-esridist
Hi

I'm attempting to build a tool that will use Con to highlight overlap between two input raster values by producing an output raster with 1s and 0s.
However, even in a most simple form with a single raster and condition I can't seem to assign a constant value for the false condition. The code below results in the error:
"0" does not exist

Currently using 10.2.

import arcpy
import arcpy.sa as sa

# input raster
ras1 = r"D:\mal\Soil_Type.tif"

# value of ras1 to be evaluated as true
class1 = 3

# Define output layer
ras_output = (r"D:\mal\soils.gdb\soiltype_overlap")

ras3 = sa.Con(ras1 == class1, 1, 0)

ras3.save(ras_output)


I can't work out what I am doing wrong here, as the syntax seems to be consistent with all help examples.

Any advice appreciated

Cheers
Malcolm

Outcomes