I am experiencing a problem with the raster calculator in the ModelBuilder under ArcMap 10.

I need to combine two layers:

  1. a drainage map (issued from a series of previous operations on a DEM) and
  2. a slope map reclassed in 8 classes.

The formula used in the calculator is the following:

Con(("surf_drainee" > 12) & ("surf_drainee" <= 80) & ("pente_rclass" <= 24),"pente_rclass"+1, Con(("surf_drainee" > 20) & ("pente_rclass" < 24),"pente_rclass" + 2, Con(("surf_drainee" > 80) & ("pente_rclass" == 24), "pente_rclass" + 1, "pente_rclass")))

When I enter this in the calculator, using the buttons to enter the expression, it sends back a python syntax error. I discussed it with a colleague, who told me to write it out completely with the keyboard.

This works in the Raster Calculator, when used alone from the Toolbox. But when this is done in the ModelBuilder, it does not connect my two layers to the calculator, but creates numerous duplicates in entry to the calculator (pente_rclass (2), pente_rclass (3)...).

Is there a way of getting around this problem? I was thinking maybe a script could replace the raster calculator, but I don't really have the knowledge to set that up without a few hints.

  • I'm not sure if this will make a difference or not, but for best coding practice you need a few more braces in your expression, surrounding the parameters linked by &. For example, ("surf_drainee" > 80) & ("pente_rclass" == 24), should actually be: (("surf_drainee" > 80) & ("pente_rclass" == 24)),
    – L_Holcombe
    Jan 29, 2013 at 8:18
  • I think this question will need the precise wording of the Python Syntax Error edited into it before its resolution can be progressed.
    – PolyGeo
    Dec 5, 2014 at 7:53

1 Answer 1


Try setting the input rasters as variables - see Building expressions in Raster Calculator, especially the example on ModelBuilder. Or perhaps try setting up your expression in the Con tool.

To pursue the python script option, see the code samples at the bottom of the Con tool help, as well as the multiple condition statement examples in the Conditional evaluation with Con help file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.