I am trying to set all values in my raster that are not equal to -9999 to Null using Arcpy.
The problem is that using
!= operator gets me an
arcgisscripting.ExecuteError: ERROR 010416: Error in setting raster table filter for F:\Data\test.tif. However, other operators like
< works okay. Any ideas?
I solved the problem using
<> instead of
!=, but I still do not understand why ArcGIS and Arcpy use different operators for the same functions.
# Import arcpy module import arcpy # Set the current workspace arcpy.env.workspace = "F:/Data" # check out any necessary licenses arcpy.CheckOutExtension("Spatial") inRaster = arcpy.Raster('test.tif') outSetNull = arcpy.sa.SetNull(inRaster, in_false_raster_or_constant=1, where_clause='Value != -9999')