TransWikia.com

Raster calculator giving error 000539

Geographic Information Systems Asked on July 1, 2021

I’m trying to do Subtraction between two rasters.
and I’m getting this error

000539 : Error message from Python.

Description
The calculation used by the Calculate Field or Calculate Value tool is invalid. The error message provided will list the specific Python error.

Solution
This error code covers a number of Python errors:

Example error 1: exceptions.TypeError: cannot concatenate ‘str’ and ‘int’ objects.
The above is a Python-specific error. The calculation is attempting to add or concatenate a string and a number.

Example error 2: Invalid field shape@distance
The above is an error using the geometry object. The distance method is not a valid method of the geometry object.

For specific Python issues, consult the external Python help for the version of Python you are using, or consult the Calculate Field or Calculate Value help for more information on these tools.

I could really use some more explanation..

One Answer

You are running some Python code (that you made in Modelbuilder, maybe) that is using the raster calculator. The raster calculator is not available in arcpy. See this from the ESRI website:

The Raster Calculator tool is intended for use in the 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.

And here is a link to your specific error code. You will need to do your subtraction using a minus function from the spatial analyst tools. Something like this:

outMinus = Minus(inRaster1, inRaster2) 
outMinus.save("C:/minus.tif")

Answered by GBG on July 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP