Calculating statistics for raster datasets
There are several geoprocessing tools that allow you to calculate statistics (and the histogram) for raster datasets. You can even chain them together with other tools in models or create a Python script.
- Use Calculate Statistics if you have a single raster dataset.
- Use Batch Calculate Statistics, if you have multiple raster datasets, to calculate statistics for more than one raster at a time.
- Use Build Pyramids And Statistics if you have a folder or collection of folders, a raster catalog containing raster datasets, or a mosaic dataset for which you need to calculate statistics.
Setting statistics
The Set Raster Properties tool lets you define the statistics for a raster dataset or mosaic dataset if you do not want to have the application calculate them. You can either enter the minimum, maximum, standard deviation, and mean values for each band or extract the values from an XML file containing the statistics. This file can be created by exporting the statistics from another raster or mosaic dataset.
Calculating statistics for mosaic datasets
Statistics (and the histogram) are used to enable automated stretching of imagery and are important for some types of analysis. They can exist at three locations within a mosaic dataset:
- The mosaic dataset
- With each source raster dataset
- On each raster item in the mosaic dataset after the functions have been applied
Mosaic dataset statistics
These statistics are applied to the entire mosaic dataset when it is displayed.
When you calculate statistics for a mosaic dataset, the base pixels are examined; that is, the source raster datasets with the lowest pixel sizes are examined and the statistics are generated across the entire mosaic. This is why it is recommended that you use a skip factor. One way to identify a reasonable skip factor value is to divide the number of columns by 1,000 and use the quotient (integer) as the skip factor. However, if your mosaic dataset has overviews, the statistics are generated using the overviews. When building overviews, statistics are generated automatically.
To calculate statistics on the mosaic dataset, right-click the mosaic dataset in the Catalog window and click Calculate Statistics; the Calculate Statistics tool opens. You can also open this tool directly.
Source raster dataset statistics
These are the statistics of the source raster datasets within the mosaic dataset. They are necessary if you plan to color balance the raster dataset.
Statistics are not automatically generated for each raster dataset in the mosaic dataset; however, when adding the raster data to a mosaic dataset, you can check Calculate Statistics to calculate the statistics for each source raster dataset if they don't already exist. Or you can use the Build Pyramids And Statistics tool, add the mosaic dataset as the input, then check the Calculate Statistics and Include Source Datasets options.
Raster item statistics
Each row in the mosaic dataset's attribute table represents a raster item in the mosaic dataset. There is not always a one-to-one relationship with the raster datasets and raster items in the mosaic dataset; therefore, they are considered separately. For example, a raster item may represent a pan-sharpened image that is created from two datasets. Each raster item can have its own function chain, which may cause the statistics to be altered significantly (thereby affecting the rendering); for example, the NDVI function, Arithmetic function, or Stretch function can alter the pixel values and change the statistics. Like with the source raster datasets, the statistics are not automatically generated for each raster item in the mosaic dataset.
To calculate statistics on the raster items in the mosaic dataset
- Use the Build Pyramids And Statistics tool, check the Calculate Statistics option, then uncheck the Include Source Datasets option.
- Use the Synchronize Mosaic Dataset tool and check the Calculate Statistics option to calculate the statistics for each raster item. This tool honors selections, so statistics can be computed for a subset of the complete mosaic dataset.
Calculating statistics for raster catalogs
Raster catalogs do not have statistics, but you can use a raster catalog as the input to the Build Pyramids And Statistics tool to calculate the statistics for each raster dataset it contains.