Build Pyramids And Statistics (Data Management)

License Level:BasicStandardAdvanced

Summary

Traverses a folder structure, building pyramids and calculating statistics for all the raster datasets it contains. It can also build pyramids and calculate statistics for all the items in a raster catalog or mosaic dataset.

Usage

Syntax

BuildPyramidsAndStatistics_management (in_workspace, {include_subdirectories}, {build_pyramids}, {calculate_statistics}, {BUILD_ON_SOURCE}, {block_field}, {estimate_statistics}, {x_skip_factor}, {y_skip_factor}, {ignore_values}, {pyramid_level}, {SKIP_FIRST}, {resample_technique}, {compression_type}, {compression_quality}, {skip_existing})
ParameterExplanationData Type
in_workspace

The workspace that contains all the raster datasets to be processed, a mosaic dataset or a raster catalog.

If the workspace includes a raster catalog or mosaic dataset, then these items will not be included when the tool runs.

Mosaic Dataset; Mosaic Layer; Raster Catalog Layer; Raster Dataset; Text File; Workspace
include_subdirectories
(Optional)

Specify whether to include subdirectories.

  • NONEDoes not include subdirectories.
  • INCLUDE_SUBDIRECTORIESIncludes all the raster datasets within the subdirectories when loading. This is the default.

Raster catalogs and mosaic datasets must be specified as the input workspace. If the workspace includes a raster catalog or mosaic dataset, then these items will not be included when the tool runs.

Boolean
build_pyramids
(Optional)

Specify whether to build pyramids.

  • NONEDoes not build pyramids.
  • BUILD_PYRAMIDSBuilds pyramids. This is the default.
Boolean
calculate_statistics
(Optional)

Specify whether to calculate statistics.

  • NONEDoes not calculate statistics.
  • CALCULATE_STATISTICSCalculates statistics. This is the default.
Boolean
BUILD_ON_SOURCE
(Optional)

Specify whether to build pyramids and calculate statistics on the source raster datasets or calculate statistics on the raster items in a mosaic dataset. This option only applies to mosaic datasets.

  • NONEStatistics will be calculated for each raster item in the mosaic dataset (on each row in the attribute table). Any functions added to the raster item will be applied before generating the statistics. This is the default.
  • BUILD_ON_SOURCEBuilds pyramids and calculates statistics on the source data of the mosaic dataset.
Boolean
block_field
(Optional)

The name of the field within a mosaic dataset's attribute table used to identify items that should be considered one item when performing some calculations and operations.

String
estimate_statistics
(Optional)

Specify whether to calculate statistics for the mosaic dataset (not for the rasters within it). The statistics are derived from the existing statistics that have been calculated for each raster in the mosaic dataset.

  • NONEStatistics are not calculated for the mosaic dataset. This is the default.
  • ESTIMATE_STATISTICSStatistics will be calculated for the mosaic dataset.
Boolean
x_skip_factor
(Optional)

The number of horizontal pixels between samples.

The value must be greater than zero and less than or equal to the number of columns in the raster dataset. The default is 1 or the last skip factor used.

Long
y_skip_factor
(Optional)

The number of vertical pixels between samples.

The value must be greater than zero and less than or equal to the number of rows in the raster. The default is 1 or the last y skip factor used.

Long
ignore_values
[ignore_value,...]
(Optional)

The pixel values that are not to be included in the statistics calculation.

The default is no value.

Long
pyramid_level
(Optional)

Choose the number of reduced-resolution dataset layers that will be built. The default value is -1, which will build full pyramids. A value of 0 will result in no pyramid levels.

The maximum number of pyramid levels you can specify is 29. Any value that is 30 or higher will revert to a value of -1, which will create a full set of pyramids.

Long
SKIP_FIRST
(Optional)

Choose whether to skip the first pyramid level. Skipping the first level will take up slightly less disk space, but it will slow down performance at these scales.

  • NONEThe first pyramid level will be built. This is the default.
  • SKIP_FIRSTThe first pyramid level will not be built.
Boolean
resample_technique
(Optional)

The resampling technique used to build your pyramids.

  • NEARESTThe nearest neighbor resampling method uses the value of the closest cell to assign a value to the output cell when resampling. This is the default.
  • BILINEARThe bilinear interpolation resampling method determines the new value of a cell based on a weighted distance average of the four nearest input cell centers.
  • CUBICThe Cubic convolution resampling method determines the new value of a cell based on fitting a smooth curve through the 16 nearest input cell centers.
String
compression_type
(Optional)

The compression type to use when building the raster pyramids.

  • DEFAULTIf the source data is compressed using a wavelet compression, it will build pyramids with the JPEG compression type; otherwise, LZ77 will be used. This is the default compression method.
  • LZ77The LZ77 compression algorithm will be used to build the pyramids. LZ77 can be used for any data type.
  • JPEGThe JPEG compression algorithm to build pyramids. Only data that adheres to the JPEG compression specification can use this compression type. If JPEG is chosen, you can then set the compression quality.
  • JPEG_YCbCrA lossy compression using the luma (Y) and chroma (Cb and Cr) color space components.
  • NONENo compression will be used when building pyramids.
String
compression_quality
(Optional)

The compression quality to use when pyramids are built with the JPEG compression method. The value must be between 0 and 100. The values closer to 100 would produce a higher-quality image, but the compression ratio would be lower.

Long
skip_existing
(Optional)

Specify whether to calculate statistics only where they are missing or regenerate them even if they exist.

  • SKIP_EXISTINGStatistics will only be calculated if they do not already exist. This is the default.
  • OVERWRITEStatistics will be calculated even if they already exist. Therefore, existing statistics will be overwritten.
Boolean

Code Sample

BuildPyramidsAndStatistics example 1 (Python window)

This is a Python sample for the BuildPyramidsAndStatistics tool.

import arcpy
arcpy.BuildPyramidsAndStatistics_management(
     "C:/Workspace", "INCLUDE_SUBDIRECTORIES", "BUILD_PYRAMIDS",
     "CALCULATE_STATISTICS","BUILD_ON_SOURCE", "BlockField", 
     "ESTIMATE_STATISTICS", "10", "10", "0;255", "-1", "NONE",
     "BILINEAR", "JPEG", "50", "OVERWRITE")
BuildPyramidsAndStatistics example 2 (stand-alone script)

This is a Python script sample for the BuildPyramidsAndStatistics tool.

#Build pyramids and calculate statistics for all raster in a folder

import arcpy
arcpy.env.workspace = "C:/Workspace"

inws = "folder"
includedir = "INCLUDE_SUBDIRECTORIES"
buildpy = "BUILD_PYRAMIDS"
calcstats = "CALCULATE_STATISTICS"
buildsource = "NONE"
blockfield = "#"
estimatemd = "#"
skipx = "4"
skipy = "6"
ignoreval = "0;255"
pylevel = "3"
skipfirst = "NONE"
resample = "BILINEAR"
compress = "JPEG"
quality = "80"
skipexist = "SKIP_EXISTING"

arcpy.BuildPyramidsAndStatistics_management(
     inws, includedir, buildpy, calcstats, buildsource, blockfield,
     estimatemd, skipx, skipy, ignoreval, pylevel, skipfirst,
     resample, compress, quality, skipexist)

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
11/18/2013