I have a lengthy raster calculator expression I'm running in a python script tool that keep throwing the following error:
RuntimeError: Failed to apply Raster Function: 'RasterCalculator' (The parameter is incorrect.
Bind failed in function 'Raster Calculator Function' [Raster Calculator Function].)
I narrowed it down to the Power() function. The calculation in the script works fine if I remove it
I simplified everything down to troubleshoot:
If I run the expression Power("x", 2) in the raster calculator everything works as advertised
If I run the script y = RasterCalculator([x], ["x"], "Power(x, 2)") I get the above error. (If I change Power() to another function like Sin(x) the script will run without error)
Is this a bug or am I just missing something simple?
I actually figured out the problem, which was an incorrect use of the ^ operator. Turns out that ^ is an xOR boolean operator, and not an exponent, and I should be using the Exp () function in its place. I'm glad someone caught it for me, otherwise I would've wasted days of frustration https://1921681254.mx/. Lol
Unless I've missed some point, seems like overkill the way you are doing it, why not simply call the power tool directly, see python code sample here.