Skip to main content

Buffered

Summary

Stores the pixel block of the input raster in memory to optimize performance when the raster is used multiple times in an expression.

Discussion

The Buffered function is used to store the pixel block of the input raster object, for example, when the raster will be used multiple times in an expression. This is most common when using map algebra to combine multiple raster objects.

For example, the following expression uses raster 1 twice:

\(NewRaster \space = \space (Raster1+Raster2)/Raster1\)

The Buffered function can be inserted for raster 1 before running the expression to improve performance.

For more information on how this function works, see the Buffered 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.

Syntax

Buffered(raster)

Parameter Explanation Data Type

raster

The input raster.

Raster

Return value

Data Type Explanation

Raster

The output raster object that has been stored in memory.

Code sample

Buffered example

Stores the pixel block of two rasters in memory to improve performance for a complex expression.

# Import system modules
import arcpy
from arcpy.ia import *

# Set the analysis environments
arcpy.env.workspace = "C:/arcpyExamples/data"

# Set the local variables
Raster1 = arcpy.Raster("Band_3")
Raster2 = arcpy.Raster("Band_4")

# Run Buffered function
Raster1buff = arcpy.ia.Buffered(Raster1)
Raster2buff = arcpy.ia.Buffered(Raster2)

# Run complex expression
Output = (Raster1buff+Raster2buff)/(Raster1buff+Raster2buff)

# Save output
Output.save("C:/arcpyExamples/outputs/expressionOutput.tif")