# Con statement in raster calculator ArcGIS 10.3

I have four rasters (A, B, C, D) based on which my classification works. The con statement I have been using is posted below.

My problem is when A_01 is 2. Area when A=2, if value of B is less than 3, it categorizes the ares under 2, but when B is between 3 and 12, and value for C is exactly 0.24, it is categorizing the area under 3.

For eg: any area where A=2, B=3.56 and C=0.24, I assume it should fall under category 2, since value for B is less than 12 and C is exactly 0.24, but it is being categorized as 3. Can anybody help me figure the error in this statement?

``````Con(("%A_01.tif%" == 1) & ("%B_01.tif%" > 12), 3,
Con(("%A_01.tif%" == 1) & ("%B_01.tif%" <= 12), 4,
Con(("%A_01.tif%" == 1) & ("%D_01.tif%" == 1), 4,
Con(("%A_01.tif%" == 2) & ("%B_01.tif%" <= 12) & ("%C_01.tif%" >= 0.24), 2,
Con(("%A_01.tif%" == 2) & ("%B_01.tif%" > 12), 2,
Con(("%A_01.tif%" == 2) & ("%B_01.tif%" >= 3) & ("%B.tif%" <= 12) & ("%C_01.tif%" < 0.24), 3,
Con(("%A_01.tif%" == 2) & ("%B_01.tif%" < 3) & ("%C_01.tif%" < 0.24), 4,
Con(("%A_01.tif%" == 2) & ("%D_01.tif%" == 1), 4,
Con(("%A_01.tif%" == 3) & ("%D_01.tif%" == 0), 2,
Con(("%A_01.tif%" == 3) & ("%D_01.tif%" == 1), 4,
Con(("%A_01.tif%" == 4) & ("%D_01.tif%" == 0), 1,
Con(("%A_01.tif%" == 4) & ("%D_01.tif%" == 1), 4))))))))))))
``````
• These nested Cons always get too messy to make sense of. How do you feel about arcpy/numpy? – Tom Mar 2 '16 at 21:56
• You've got a "%B.tif%" in there. Should that be "%B_01.tif%"? – Tom Mar 2 '16 at 21:58
• Thanks, It is B_01.tif, just got a typo error when I was changing the name of my raster to B. – user65127 Mar 2 '16 at 22:01
• Another check you should do to make sure its not the data but the logic that is the problem. Try running Con(("%A_01.tif%" == 2) & ("%B_01.tif%" <= 12) & ("%C_01.tif%" >= 0.24), 2, 0) by itself. If it is processing correctly you'll get 2's where you want and 0 everywhere else, so you have confidence that your data is correct and it's not some weird rounding issue? – Hornbydd Mar 2 '16 at 22:02
• Seeing as these are integer rasters (do IsNull c<0.24 to get an integer of C) why not combine resources.arcgis.com/en/help/main/10.1/index.html#//… them, add a field and use a field calculation instead, an advanced field calculation with nested elif statements has to be better (and more readable) than nested Con statements. Each Con needs to be evaluated to a temporary raster, which adds processing time and space, combine and field calc would only be one SA operation and there's a good chance the results tab would tell you where any logic faults are in an error message. – Michael Stimson Mar 2 '16 at 22:39