Resample

Zusammenfassung

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.

Auswertung

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.

Syntax

Resample (raster, {resampling_type}, {input_cellsize}, {output_cellsize})
ParameterErklärungDatentyp
raster

The input raster.

Raster
resampling_type

The method used to change the spatial resolution of the input raster.

  • NearestNeighborPerforms 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.
  • BilinearPerforms 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.
  • CubicPerforms 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.
  • MajorityPerforms 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.
  • BilinearInterpolationPlusUses Bilinear, except the pixels along the edges are defined as NoData (since there are no surrounding pixels for an accurate calculation).
  • BilinearGaussBlurApplies a Gaussian convolution to the source raster and calculates pixel value using the distance-weighted value of four nearest pixels from the blurred raster.
  • BilinearGaussBlurPlusUses BilinearGaussBlur, except the pixels along the edges are defined as NoData (since there are no surrounding pixels for an accurate calculation).
  • AverageCalculates pixel values using the average value of all involved pixels, where the source pixels are covered by the target pixel.
  • MinimumCalculates pixel value using the minimum value of all involved pixels. If no source pixel exists, no new pixel can be created in the output.
  • MaximumCalculates pixel value using the maximum value of all involved pixels. If no source pixel exists, no new pixel can be created in the output.
  • VectorAverageCalculates 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.

(Der Standardwert ist None)

String
input_cellsize

The cell size of the input raster.

(Der Standardwert ist None)

Double
output_cellsize

The cell size of the output raster.

(Der Standardwert ist None)

Double
Rückgabewert
DatentypErklärung
Raster

The output raster.

Codebeispiel

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)