When we have a shapefile we can add a field (e.g. "X") and then calculate it by using a Python code block inside the Calculate Field tool.
A visual example could be this one:
def x(w, v):
if w ==2: return 6
elif v >= 0.420001 : return 5
elif v >= 0.340001 and v<0.420001 : return 4
elif v >= 0.260001 and v< 0.340001 : return 3
elif v >= 0.180001 and v< 0.260001 : return 2
else: return 1
However, if I want to do something similar (see the code below) for a raster dataset (with two bands), the Raster Calculator and Con tools cannot provide such an option.
def reclassify (band1, band2):
if band1 == 3:return 3
elif band2 == 1: return 3
elif band2 == 2: return 2
elif band1 ==1 and band2 == 3:return 1
elif band1 == 2 and band2 == 3:return 2
else: return 0
Do you have any idea or plausible tool to do this in a raster?
P.S. A possible solution could be to convert the raster to polygon and then use the calculate field tool as shown in the example. However, I wanted to know if there is an other way by avoiding convert it into a feature.