Available with Spatial Analyst license.
Summary
Generates a reduced-resolution version of a raster. Each output cell contains the Sum, Minimum, Maximum, Mean, or Median of the input cells that are encompassed by the extent of that cell.
Illustration
Usage
For the Aggregation technique settings of Maximum, Minimum, or Sum, the output raster type will be the same as that of the input raster. If the technique is Mean or Median, the output type will always be float.
The geoprocessing analysis environments Extent and Cell size are recognized by this tool. To determine the output raster's resolution when an integer cell size has been specified, multiply the cell resolution of the analysis environment by the input cell factor parameter. If the cell size for the analysis environment is set to the minimum or maximum of the inputs, the resolution of the output raster will be the product of the input raster's resolution multiplied by the specified cell factor.
See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.
Syntax
Aggregate(in_raster, cell_factor, {aggregation_type}, {extent_handling}, {ignore_nodata})
Parameter | Explanation | Data Type |
in_raster | The input raster to aggregate. It can be of integer or floating point type. | Raster Layer |
cell_factor | The factor by which to multiply the cell size of the input raster to obtain the desired resolution for the output raster. For example, a cell factor value of three would result in an output cell size three times larger than that of the input raster. The value must be an integer greater than 1. | Long |
aggregation_type (Optional) | Establishes how the value for each output cell will be determined. The values of the input cells encompassed by the coarser output cell are aggregated by one of the following statistics:
| String |
extent_handling (Optional) | Defines how to handle the boundaries of the input raster when its rows or columns are not a multiple of the cell factor.
If the number of rows and columns in the input raster is a multiple of the cell_factor, these keywords are not used. | Boolean |
ignore_nodata (Optional) | Denotes whether NoData values are ignored by the aggregation calculation.
| Boolean |
Return Value
Name | Explanation | Data Type |
out_raster | The output aggregated raster. It is a reduced-resolution version of the input raster. | Raster |
Code sample
This example aggregates a raster by averaging the values with a cell factor of 3 and outputs a TIFF raster.
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outAggreg = Aggregate("highres", 3, "MAXIMUM", "TRUNCATE", "DATA")
outAggreg.save("C:/sapyexamples/output/aggregate.tif")
This example aggregates a raster by averaging the values with a cell factor of 3 and outputs a Grid raster.
# Name: Aggregate_Ex_02.py
# Description: Generates a reduced resolution version of a raster.
# Requirements: Spatial Analyst Extension
# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *
# Set environment settings
env.workspace = "C:/sapyexamples/data"
# Set local variables
inRaster = "highres"
cellFactor = 3
# Execute Aggregate
outAggreg = Aggregate(inRaster, cellFactor, "MEAN", "TRUNCATE", "NODATA")
# Save the output
outAggreg.save("C:/sapyexamples/output/aggregate02")
Environments
Licensing information
- Basic: Requires Spatial Analyst
- Standard: Requires Spatial Analyst
- Advanced: Requires Spatial Analyst