Pick (Spatial Analyst)

License Level:BasicStandardAdvanced

Summary

The value from a position raster is used to determine from which raster in a list of input rasters the output cell value will be obtained.

Illustration

Pick illustration
OutRas = Pick(InRas1, [InRas2, InRas3])

Usage

Syntax

Pick (in_position_raster, in_rasters_or_constants)
ParameterExplanationData Type
in_position_raster

Input raster defining the position of the raster to use for the output value.

The input can be an integer or float raster.

Raster Layer
in_rasters_or_constants
[in_raster_or_constant,...]

The list of inputs from which the output value will be selected.

The inputs can be integer or float rasters. A number can also be used as an input.

Raster Layer | Constant

Return Value

NameExplanationData Type
out_raster

The output raster.

Raster

Code Sample

Pick example 1 (Python window)

This example assigns the output value based on the order of several input rasters.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outPick = Pick("cost", ["degs", "negs", "fourgrd"])
outPick.save("C:/sapyexamples/output/outpick.tif")
Pick example 2 (stand-alone script)

This example assigns the output value based on the order of several input rasters.

# Name: Pick_Ex_02.py
# Description: Assigns output values using one of a list of rasters
#              determined by the value of an input 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
inPositionRas = "cost"
inRas01 = "degs"
inRas02 = "negs"
inRas03 = "fourgrd"

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Execute Pick
outPick = Pick(inPositionRaster, [inRas01, inRas02, inRas03])

# Save the output 
outPick.save("C:/sapyexamples/output/outpick")

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Requires Spatial Analyst
ArcGIS for Desktop Standard: Requires Spatial Analyst
ArcGIS for Desktop Advanced: Requires Spatial Analyst
4/10/2014