I am trying to manipulate bad pixel values in a raster by using the Con-Statement via ArcPy. Using the build-in Map Algebra function "Raster Calculator", the results are good. To transfer the work flow to a script, the outcome is different. The pixel values should be between [-1;1].
arcpy.env.workspace = out_folder #path to my folder containing the raster files
list = arcpy.ListFiles('*.tif')
for ras in list:
outras1 = Con(ras > 1, 1, ras)
outras2 = Con(outras1 < -1, -1, outras1)
outras2.save(ras + '_mod.tif')
Can you tell, what I am doing wrong?
The results show only pixel values of 1. Additional information: I have large areas of NoData values in my raster.