I am trying to add two different rasters using the Con function. I am iterating the raster layer using the for loop to obtain two rasters belonging to the same species and their formats are in grid and tif format. On running the below scripts i am not able to execute the con function. If anyone has a way to solve this issue, let me know your suggestion.
# Import arcpy module
import arcpy
import os
from arcpy.sa import Con
# Check out any necessary licenses
arcpy.CheckOutExtension("spatial")
# Overwrite the ouptut
arcpy.env.overwriteOutput = 1
# set environmental settings # Location of the rasters
output_workspace = "C:\\GIS_Analysis_programming\\GAPanalysisData\\Output"
allMamRows = arcpy.SearchCursor("C:\\GIS_Analysis_programming\\GAPanalysisData\\Flmammal.dbf")
# loop through mammal list and load code to list
mamList = []
i=0
for row in allMamRows:
mamList.append(row.getValue("CODE"))
# print mamList[i]
i = i +1
# Local variables:
# Creating a list of rasters from the workspace.
# Iterations through (only 10) mammals
j=0
for species in mamList:
if j < 10 :
species_str = str(species)
rastersHab = arcpy.ListRasters("hab_species_str", "GRID")
rastersCnty = arcpy.ListRasters("cnty_species_str", ".tif")
species_richness = os.path.join(output_workspace, "_richness" + species_str + ".tif")
(Con(("%rastersHab%" > 0)&("%rastersCnty%" == 1),1,0),species_richness)
print j
j = j+1