Applying a simple sum using Python in the 'Raster Calculator'

917
6
05-11-2012 05:58 AM
CliveCartwright
Occasional Contributor
It's Friday and I'm getting nowhere looking through the forum(s). So, here's hoping...?

I've got 3 rasters that need to be mangled through the following sum using the Raster Calculator:

("mean_curv" x "mean_curv") - (("plan"-"prof") x ("plan"-"prof") x 0.5) = Output Raster



I'm sure I used to do this using the old VB, but my head hurts now. 😞

Any help would be much appreciated.
Tags (2)
0 Kudos
6 Replies
JakeSkinner
Esri Esteemed Contributor
Hi Clive,

What is the error you are receiving when you attempt to execute the equation in the Raster Calculator?
0 Kudos
CliveCartwright
Occasional Contributor
Hi Clive,

What is the error you are receiving when you attempt to execute the equation in the Raster Calculator?


It comes out with the following:

ERROR 000989: Python syntax error: Parsing error <type
'exceptions.SyntaxError'>:invalid syntax (line1)


Then a big hand comes out from behind the monitor and slaps me across the top of my head. It's beginning to upset me now. 😞
0 Kudos
JakeSkinner
Esri Esteemed Contributor
The Raster Calculator needs to be executed in Desktop or Model Builder.  See here:

The Raster Calculator tool is intended  for use in the ArcGIS Desktop application only as a GP tool dialog box  or in ModelBuilder. It is not  intended for use in scripting and is not  available in the ArcPy Spatial Analyst module.

Are you attempting to run a script in PythonWin or IDLE?
0 Kudos
CliveCartwright
Occasional Contributor
Are you attempting to run a script in PythonWin or IDLE?


Neither, from what I can tell. I'm in ArcGIS10 with the Raster Calculator open. All three raster layers are in the .gdb and await the simple function.

I'll keep trying.

Oh, it's working now... User error. Thanks chaps.
0 Kudos
JakeSkinner
Esri Esteemed Contributor
Can you send a screen shot of your Raster Calculator dialog?  Also, what are the properties of your raster datasets?  Ex:

ESRI GRID
32 bit floating point

Also, what is the coordinate system of the raster datasets?
0 Kudos
DanPatterson_Retired
MVP Emeritus
several suggestions
1  type as little as possible in the raster calculator, select available buttons
2  I think x should be *
3  ensure that there are spaces between gridnames and operators, which be automatic if you select buttons
4  Output Raster will fail since there is a space and it is on the wrong side of the equal sign
Give some of these ideas a try
0 Kudos