Statistics

概要

Calculates statistics for each cell of an image based on a defined focal neighborhood.

ディスカッション

For more information about the methods and band orders used with this function, see the Statistics 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.

構文

Statistics (raster, kernel_columns, kernel_rows, stat_type, {fill_no_data_only})
パラメーター説明データ タイプ
raster

The input raster on which to perform focal statistics.

Raster
kernel_columns

The number of pixel columns to use in your focal neighborhood dimension.

(デフォルト値は次のとおりです 3)

Integer
kernel_rows

The number of pixel rows to use in your focal neighborhood dimension.

(デフォルト値は次のとおりです 3)

Integer
stat_type

Specify the type of statistics to calculate.

  • Max Calculates the maximum value of the pixels within the neighborhood.
  • Mean Calculates the average value of the pixels within the neighborhood. This is the default.
  • Min Calculates the minimum value of the pixels within the neighborhood.
  • StandardDeviationCalculates the standard deviation value of the pixels within the neighborhood.

(デフォルト値は次のとおりです Mean)

String
fill_no_data_only

Specify whether NoData values are ignored in the analysis.

  • True—Fills NoData pixels only. This is the default.
  • False—NoData pixels will not be filled.

(デフォルト値は次のとおりです False)

Boolean
戻り値
データ タイプ説明
Raster

The output raster.

コードのサンプル

Statistics example

Perform a neighborhood statistics calculation.

import arcpy
from arcpy import env
from arcpy.ia import *

# Set environment settings
env.workspace = "C:/statistics_example/data"

# Set local variables
inRaster = "elevation.tif"
kernel_columns=5
kernel_rows=5
stat_type="Mean"
fill_no_data_only = True

# for each pixel, calculate the average value of pixels within its neighborhood. the neighborhood size is 5x5
output = Statistics(imagePath1, kernel_columns, kernel_rows, stat_type, fill_no_data_only)
output.save("statistics_mean_5_by_5.tif")

関連トピック