ZonalStatisticsAsTable

Title  ZonalStatisticsAsTable

Summary

Calculates the values of a raster within the zones of another dataset and reports the results to a table.


Illustration

Zonal Statistics As Table tool Zonal Statistics As Table tool

Usage


Syntax

Parameter Explanation
inputZoneRasterOrFeatures

The input that defines the zones.

Both raster and feature can be used for the zone input.

inputValueRaster

Raster that contains the values on which to summarize a statistic.

outputTableName

The name of the output table.

If the table already exists, you will be prompted to provide another name.

zoneField

The field that defines each zone.

It can be an integer or a string field of the zone dataset.

ignoreNodata (Optional)

Denotes whether NoData values in the value input will influence the results of the zone that they fall within.

  • Checked—Within any particular zone, only cells that have a value in the input value raster will be used in determining the output value for that zone. NoData cells in the value raster will be ignored in the statistic calculation. This is the default.
  • Unchecked—Within any particular zone, if any NoData cells exist in the value raster, it is deemed that there is insufficient information to perform statistical calculations for all the cells in that zone; therefore, the entire zone will receive the NoData value on the output raster.
statisticType (Optional)

Choose the statistic to calculate.

The available options when the value raster is integer are All, Mean, Majority, Maximum, Median, Minimum, Minority, Percentile, Range, Standard deviation, Sum, Variety, Minimum and Maximum, Mean and Standard deviation, and Minimum, Maximum and Mean.

If the value raster is float, the options are All, Mean, Maximum, Minimum, Range, Standard deviation, and Sum.

  • All— All of the statistics will be calculated. This is the default.
  • Mean—Calculates the average of all cells in the raster layer to be summarized that belong to the same zone as the output cell.
  • Majority— Determines the value that occurs most often of all cells in the raster layer to be summarized that belong to the same zone as the output cell.
  • Maximum— Determines the largest value of all cells in the raster layer to be summarized that belong to the same zone as the output cell.
  • Median— Determines the median value of all cells in the raster layer to be summarized that belong to the same zone as the output cell.
  • Minimum— Determines the smallest value of all cells in the raster layer to be summarized that belong to the same zone as the output cell.
  • Minority— Determines the value that occurs least often of all cells in the raster layer to be summarized that belong to the same zone as the output cell.
  • Percentile—Calculates a percentile of all cells in the value raster that belong to the same zone as the output cell. The 90th percentile is calculated by default. You can specify other values (from 0 to 100) using the Percentile Values parameter.
  • Range— Calculates the difference between the largest and smallest value of all cells in the raster layer to be summarized that belong to the same zone as the output cell.
  • Standard deviation— Calculates the standard deviation of all cells in the raster layer to be summarized that belong to the same zone as the output cell.
  • Sum— Calculates the total value of all cells in the raster layer to be summarized that belong to the same zone as the output cell.
  • Variety— Calculates the number of unique values for all cells in the raster layer to be summarized that belong to the same zone as the output cell.
  • Minimum and Maximum— Both the minimum and maximum statistics are calculated.
  • Mean and Standard deviation— Both the mean and standard deviation statistics are calculated.
  • Minimum, Maximum and Mean— The minimum, maximum and mean statistics are calculated.
percentileValues

The percentile to calculate. The default is 90, for the 90th percentile.

The values can range from 0 to 100. The 0th percentile is essentially equivalent to the Minimum statistic, and the 100th Percentile is equivalent to Maximum. A value of 50 will produce essentially the same result as the Median statistic.

This option is only available if the Statistics Type parameter is set to Percentile or All.

This option is only available if the statisticsType parameter is set to PERCENTILE or ALL.

processAsMultidimensional (Optional)

Determines how the input rasters will be processed if they are multidimensional.

  • Unchecked—Statistics will be calculated from the current slice of a multidimensional image service. This is the default.
  • Checked—Statistics will be calculated for all dimensions (such as time or depth) of a multidimensional image service.
  • CURRENT_SLICE— Statistics will be calculated from the current slice of a multidimensional image service. This is the default.
  • ALL_SLICES— Statistics will be calculated for all dimensions (such as time or depth) of a multidimensional image service.
percentileInterpolationType (Optional)

context (Optional)

Code Samples

ZonalStatisticsAsTable example 1 (Python window)

This example determines for each zone the average of cell values in the raster layer to be summarized.


import arcpy
arcpy.ZonalStatisticsasTable_ra('https://MyPortal.esri.com/server/rest/services/Hosted/landuse/ImageServer',
                           	'https://MyPortal.esri.com/server/rest/services/Hosted/elevation/ImageServer',
    				'outTable', 'Landuse', '', 'MEAN')
                    

ZonalStatisticsAsTable example 2 (stand-alone script)

This example determines for each zone the statistics value in the raster layer to be summarized.


#-------------------------------------------------------------------------------
# Name: ZonalStatisticsasTable_Ex_02.py
# Description: Calculates all statistics with defined percentile values  
#              for sea-surface temperature defined by ecological zones.
# Requirements: ArcGIS Image Server

# Import system modules
import arcpy

# Set local variables
inputZoneRasterOrFeatures = 'https://MyPortal.esri.com/server/rest/services/Hosted/zones/ImageServer'
inputValueRaster = 'https://MyPortal.esri.com/server/rest/services/Hosted/seaSurfaceTemperature/ImageServer'
outputTableName = 'outZSAT'
zoneField = 'temperature'
ignoreNodata = '' 
statisticType = 'ALL'
percentileValues = [25,75,90]
processAsMultidimensional = 'ALL_SLICES'

# Execute Multidimensional Zonal Statistics as Table
arcpy.ZonalStatisticsasTable_ra(inputZoneRasterOrFeatures, inputValueRaster, outputTableName, zoneField,
                                ignoreNodata, statisticType, percentileValues, processAsMultidimensional)

                    

Tags

Credits

Use limitations