I have been trying this for hours and I know it should be easy but I can't make it work yet. I have a list of 50 rasters that I need to change the NoData to "0" values. I have the right arcpy function right but I can't get the loop to work yet (I'm a beginner) So far what I have is"
env.workspace = "My raster folder" rasterList = arcpy.ListRasters("*.img") print rasterList #works OutDir= "My output raster folder" + raster [0:7] + ".img" #Here is my loop that won't work for raster in rasterList: OutRaster = Con(IsNull(raster), 0, raster) outCon.save(OutDir) #this prodices only one raster out of the 50 rasters in the List.
I need to do the same iteration for all the 50 rasters and making sure that on each iteration both of the rasters entered in the Con function is the same each run, This is something like this:
Con(IsNull(raster1), 0, raster1) Con(IsNull(raster2), 0, raster2) Con(IsNull(raster50), 0, raster50)
Can someone help me?