I'm trying to do a math operation in raster calculator using the rasters from other two raster calculators.

My calculation is a simple NDVI formula:

(rastcalc4 - rastcalc3)/(rastcalc4 + rastcalc3)

It works well in most of the cases, but, sometimes it fails and this error shows up:

ERROR 000539: Error running expression: rcexec()

Traceback (most recent call last):

File "", line 1, in

File "", line 8, in rcexec

RuntimeError: ERROR 999998: Unexpected Error.

Failed to execute (Raster Calculator (3)).

I don't understand what that means, how can i fix it?

  • As you are running this tool within model builder and it runs OK most of the time (equation looks ok), it strongly suggests that it's the inputs that are failing. So what ever is creating the rastcalc4 and rastcalc3 is failing. If you are setting extents for example may be you are setting an extent that is not covering one of your input rasters thus creating nodata output. Also you give no indication of how many times your model run? I find it can be a bit flakey if you are running it thousands of times with an iterator, then it's probably a memory issue. – Hornbydd Sep 20 '17 at 14:24
  • May be you can edit your question to include the model? – Hornbydd Sep 20 '17 at 14:24
  • 1
    Thanks! Now it works! It was a problem in the inputs extents, now it's running perfectly, thank you so much! – Charlera Sep 20 '17 at 15:43