Focal Statistics

Running programmatically

Derives value for the output calls from a neighborhood of cells centered in the output cell. The neighborhood is with user defined shape (square or circle) and size (width or diameter) in number of cells.

Neighborhoods:

Inputs:

Outputs:

Notes:

Example:

Running Programmatically

(Go to TOP)

Parameters

Expression Explanation
Function Name FocalStatistics
<InputRaster> A String - full path to the input raster dataset.
<OutputRaster> A String - full path to the output raster dataset.
<StatisticsType> A String - the type of the statistics to be calculated. Valid values:
  • Sum
  • Min
  • Max
  • Range
  • Mean
  • STD
  • Median
  • Majority
  • Minority
  • Variety
<NeighborhoodType> A String - the neighborhood type. Valid values: Square and Circle.
<NeighborhoodSize> An integer - the side of the square or the diameter of the circle in pixels/number of cells. This should be an odd number.

Running the function

ETSPath used in the table below is the full path to ETSRun.exe (E.G. "C:\Program Files\ETSpatial Techniques\ETSurface\ETSRun.exe")

InputRaster
Language Syntax
Python subprocess.call([ETSPath, "FocalStatistics", "InputRaster", "OutputRaster", "InputRaster", "NeighborhoodType", "NeighborhoodSize"])
.NET using ETSRun.exe StartInfo.FileName = ETSPath
StartInfo.Arguments = "FocalStatistics" "InputRaster" "OutputRaster" "InputRaster" "NeighborhoodType" "NeighborhoodSize"
.NET using ETSOutX.dll FocalStatistics(InputRaster, OutputRaster, InputRaster, NeighborhoodType, NeighborhoodSize)
ArcPy arcpy.FocalStatistics("InputRaster", "OutputRaster", "InputRaster", "NeighborhoodType", "NeighborhoodSize")

Notes:

(Go to TOP)