# Resample

## Resumen

Creates a raster object by changing the spatial resolution of the input raster and sets rules for aggregating or interpolating values across the new pixel sizes.

## Debate

For more information about how this function works, see the Resample raster function.

The referenced raster dataset for the raster object is temporary. To make it permanent, you can call the raster object's save method.

## Sintaxis

`Resample (raster, {resampling_type}, {input_cellsize}, {output_cellsize})`
 Parámetro Explicación Tipo de datos raster The input raster. Raster resampling_type The method used to change the spatial resolution of the input raster.NearestNeighbor—Performs a nearest neighbor assignment and is the fastest of the interpolation methods. It is used primarily for discrete data, such as a land-use classification, since it will not change the values of the cells. The maximum spatial error will be one-half the cell size.Bilinear—Performs a bilinear interpolation and determines the new value of a cell based on a weighted distance average of the four nearest input cell centers. It is useful for continuous data and will cause some smoothing of the data.Cubic—Performs a cubic convolution and determines the new value of a cell based on fitting a smooth curve through the 16 nearest input cell centers. It is appropriate for continuous data, although it may result in the output raster containing values outside the range of the input raster.Majority—Performs a majority algorithm and determines the new value of the cell based on the most popular values within the filter window. It is mainly used with discrete data, just as the nearest neighbor method; Majority tends to give a smoother result than Nearest. The majority resampling method will find corresponding 4 by 4 cells in the input space that are closest to the center of the output cell and use the majority of the 4 by 4 neighbors.BilinearInterpolationPlus—Uses Bilinear, except the pixels along the edges are defined as NoData (since there are no surrounding pixels for an accurate calculation).BilinearGaussBlur—Applies a Gaussian convolution to the source raster and calculates pixel value using the distance-weighted value of four nearest pixels from the blurred raster.BilinearGaussBlurPlus—Uses BilinearGaussBlur, except the pixels along the edges are defined as NoData (since there are no surrounding pixels for an accurate calculation).Average—Calculates pixel values using the average value of all involved pixels, where the source pixels are covered by the target pixel.Minimum—Calculates pixel value using the minimum value of all involved pixels. If no source pixel exists, no new pixel can be created in the output.Maximum—Calculates pixel value using the maximum value of all involved pixels. If no source pixel exists, no new pixel can be created in the output.VectorAverage—Calculates vector average of magnitude-direction using all involved pixels. This method is only applicable for two band rasters that represent magnitude and direction. It first converts magnitude-direction into U-V, and then it takes the arithmetic average across all involved pixels to get the U-V of the target pixel and converts it back to magnitude-direction.(El valor predeterminado es None) String input_cellsize The cell size of the input raster.(El valor predeterminado es None) Double output_cellsize The cell size of the output raster.(El valor predeterminado es None) Double
Valor de retorno
 Tipo de datos Explicación Raster The output raster.

## Muestra de código

Resample example

Resamples the input raster from a 1-meter spatial resolution to 3-meter resolution using the NearestNeighbor method.

``````Import arcpy

resampled_raster = arcpy.ia.Resample("NAIP_1_meter.tif", "NearestNeighbor", 1, 3)``````