Select to view content in your preferred language

Raster Calculator in Arcpy

894
3
02-28-2023 03:37 AM
SoratoMarques
New Contributor III

Hi,

I have 2 rasters in 2 differents locations. I need to use the raster calculator in arcpy like below:

Float(input_biomassa - std_tif)

I was exported the code from Model Builder, but no work properly.

Someone can help me?

Thank´s

0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

showing the modelbuilder export code would help

otherwise look at

Plus (Spatial Analyst)—ArcGIS Pro | Documentation

Int (Spatial Analyst)—ArcGIS Pro | Documentation

paying attention to cell cize,alignment and extent if you want expected results

 


... sort of retired...
0 Kudos
SoratoMarques
New Contributor III

I´m using Arcmap, below the code:

arcpy.gp.RasterCalculator_sa("Float(input_biomassa - std_tif)", negativo_tif)

I was tried your suggests already, but no work too.

0 Kudos
DanPatterson
MVP Esteemed Contributor

Float("input_biomassa" - "std_tif"), "negativo_tif")

would be the case in Pro... the raster names are in " " not as you have it


... sort of retired...
0 Kudos