I'm trying to run Con on a specific band of a multiband geotif. It works fine when I use arcpy.gp.Con_sa but it does nothing when I use arcpy.sa.Con. And when I say nothing I mean no errors, no results, nothing i.e. it's a NoOp.
Anyway here's my code:
from arcpy.sa import *
# set my workspace to a multiband tif.
arcpy.env.workspace = "D:/lf_composite.tif"
# now run arcpy.gp.Con_sa on one band (DEM) of the tif
arcpy.gp.Con_sa("DEM", "400", "d:/test1.tif", "1")
# Now I have test1.tif with all pixel values of 400 - as expected.
# Now run arcpy.sa.Con on same band.
new_raster = Con("DEM", 400, 1)
# Also tried this
new_raster = Con(arcpy.Raster("DEM"), 400, 1)
# Con runs with no errors but type of new_raster doesn't print i.e. it doesn't have a type.
# I expect it to be <type 'Raster'>
How can I make arcpy.sa.Con work with a mutiband tif? I want to use arcpy.sa.Con because I'll be stringing together muliple cons in sequence and don't want to have to deal with intermediate files that arcpy.gp.Con_sa produces.
Thanks for you help.