Change >1 values to 1

771
2
Jump to solution
12-22-2021 07:33 AM
Labels (3)
BeckB
by
New Contributor III

I'm using ArcGIS Pro 2.9.0. I'm calculating EVI, which has a range of -1 to 1, and my raster has a few outliers that fall outside of that range. I want to deal with these outliers by changing any value greater than 1 to be 1, and any value less than -1 to -1. 

I know that there is the function Greater Than, but this changes the values to either 1 or 0. I need to retain the non-outlier values, so this doesn't work for me.

The code in Raster Calculator that I have currently is:

Con("multvpm0000",1, "multvpm0000", "multvpm0000 >1")

where multvpm0000 is the name of the raster I'm trying to reassign the values on. Running this code gets me the error:

ERROR 000539: Traceback (most recent call last):
File "<expression>", line 1, in <module>
File "<string>", line 5, in rcexec_DC684390_0C54_4F14_9EBF_B34DF3F2E1B1
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\sa\Functions.py", line 1688, in Con
where_clause)
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\sa\Utils.py", line 55, in swapper
result = wrapper(*args, **kwargs)
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\sa\Functions.py", line 1682, in Wrapper
where_clause)
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 010416: Error in setting raster table filter for C:\Users\orang\Documents\ArcGIS\Projects\sentinel3\sentinel3.gdb\multvpm0000.
Failed to execute (Con).

How do I successfully reassign my values?

0 Kudos
1 Solution

Accepted Solutions
JayantaPoddar
MVP Esteemed Contributor

Try the following expression in Raster Calculator

 

Con("multvpm0000">1,1, Con("multvpm0000"<(-1),-1,"multvpm0000"))

 



Think Location

View solution in original post

2 Replies
JayantaPoddar
MVP Esteemed Contributor

Try the following expression in Raster Calculator

 

Con("multvpm0000">1,1, Con("multvpm0000"<(-1),-1,"multvpm0000"))

 



Think Location
BeckB
by
New Contributor III

That worked! Thank you!

0 Kudos