RasterCalculator

Disponible con licencia de Image Analyst.

Disponible con una licencia de Spatial Analyst.

Resumen

Provides access to all existing math functions and returns a raster object with the mathematical operation applied.

Debate

For more information about how this function works, see the Raster Calculator raster function.

The referenced raster dataset for the raster object is temporary. To make it permanent, you can call the raster object's save method.

Sintaxis

RasterCalculator (rasters, input_names, expression, {extent_type}, {cellsize_type})
ParámetroExplicaciónTipo de datos
rasters
[rasters,...]

The list of input rasters.

Raster
input_names
[input_names,...]

The user-defined variable names.

String
expression

Build an algebraic expression to perform spatial analysis on the input raster.

String
extent_type

The spatial extent used to create the output raster.

  • FirstOfThe extent of the first raster variable
  • IntersectionOfThe minimum area common to all input rasters
  • UnionOfThe combined extent of all input rasters
  • LastOfThe extent of the last raster variable

(El valor predeterminado es FirstOf)

String
cellsize_type

The cell size used to create the output raster.

  • FirstOfThe cell size of the first raster variable
  • MinOfThe minimum cell size of the input rasters
  • MaxOfThe maximum cell size of the input rasters
  • MeanOfThe average cell size of the input rasters
  • LastOfThe cell size of the last raster variable

(El valor predeterminado es FirstOf)

String
Valor de retorno
Tipo de datosExplicación
Raster

The output raster.

Muestra de código

RasterCalculator example 1

Example of a map algebraic expression using a raster calculator.

from arcpy.ia import *
out_rc_multi_raster = RasterCalculator(["raster1.tif", "raster2.tif"],
                                       ["x", "y"], "x*y")
out_rc_multi_raster.save("C:/arcpyExamples/raster_rc_multi.tif")
RasterCalculator example 2

Example of a map algebraic expression using a raster calculator.

from arcpy.ia import *
out_rc_multi_raster = RasterCalculator(["raster1.tif", "raster2.tif"],
                                       ["x", "y"], "x*y")
out_rc_multi_raster.save("C:/arcpyExamples/raster_rc_multi.tif")