Available with Spatial Analyst license.
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
Usage
The value of each cell of the position raster determines which input will be used to obtain the output raster value. For example, if a cell in the position raster has a value of 1, the value from the first input in the raster list will be used for the output cell value. If the position input has a value of 2, the output value will come from the second input in the raster list, and so on.
The order of the input list is relevant for this tool. If the order of rasters changes, the results will change.
If a cell value in the position raster is zero or negative, the result will be NoData. If the position value is larger than the number of rasters in the list, the result will be NoData.
If the position raster is floating point, the values will be truncated to be integers before they are processed.
Any cell with a NoData value on the position raster will receive NoData on the output raster.
If any of the rasters in the input list is floating point, the output raster will be floating point. If they are all integer, the output raster will be integer.
See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.
Syntax
Pick(in_position_raster, in_rasters_or_constants)
Parameter | Explanation | Data 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
Name | Explanation | Data 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
Licensing information
- Basic: Requires Spatial Analyst
- Standard: Requires Spatial Analyst
- Advanced: Requires Spatial Analyst