Extract statistics

This tool can be used to extract common descriptive statistics associated with the distribution of some underlying Data Raster Image based on area units defined by a Feature Definition Raster Image. For example, this tool can be used to measure the maximum or average slope gradient (data image) for each of a group of watersheds (feature definitions). Although the Data Raster Image can contain any type of data, the Feature Definition Raster Image must be categorical, i.e. it must define area entities using integer values.

If an output image name is specified, the tool will assign the descriptive statistic value to each of the spatial entities defined in the Feature Definition Image. If text output is selected, a table will be output, which can then be readily copied into a spreadsheet program for further analysis. This is a very powerful and useful tool for creating numerical summary data from spatial data which can then be interrogated using statistical analyses. At least one output type (image or text) must be specified for the tool to operate.

NoData values in either of the two input images are ignored during the calculation of the descriptive statistic.

See Also:

Scripting:

The following is an example of a Python script that uses this tool:

wd = pluginHost.getWorkingDirectory()
dataFile = wd + "data.dep"
featureFile = wd + "features.dep"
outputFile = wd + "output.dep"
stat = "average"
textOutput = "true"
args = [dataFile, featureFile, outputFile, stat, textOutput]
pluginHost.runPlugin("ExtractStatistics", args, False)

This is a Groovy script also using this tool:

def wd = pluginHost.getWorkingDirectory()
def dataFile = wd + "data.dep"
def featureFile = wd + "features.dep"
def outputFile = wd + "output.dep"
def stat = "maximum"
def textOutput = "true"
String[] args = [dataFile, featureFile, outputFile, stat, textOutput]
pluginHost.runPlugin("ExtractStatistics", args, false)

Credits: