Pick from list

This tool outputs the value from a raster stack specified by a position raster. The user must specify the name of the position raster, the names of the raster files contained in the stack (i.e. group of images), and an output raster file name. The tool, working on a cell-by-cell basis, will assign the value to the output grid cell contained in the corresponding cell in the stack image in the position specified by the cell value in the position raster. Importantly, the positions raster should be in zero-based order. That is, the first image in the stack should be assigned the value zero, the second raster is assigned 1, and so on.

See Also:

Scripting:

The following is an example of a Python script using this tool:

wd = pluginHost.getWorkingDirectory()
positionRaster = wd + "position.dep"
# You may have multiple input files but they must
# be separated by semicolons in the string.
inputFiles = wd + "input1.dep" + ";" + wd + "input2.dep" + ";" + wd + "input3.dep"
outputFile = wd + "output.dep"
args = [positionRaster, inputFiles, outputFile]
pluginHost.runPlugin("PickFromList", args, False)

This is a Groovy script also using this tool:

def wd = pluginHost.getWorkingDirectory()
def positionRaster = wd + "position.dep"
// You may have multiple input files but they must
// be separated by semicolons in the string.
def inputFiles = wd + "input1.dep" + ";" + wd + "input2.dep" + ";" + wd + "input3.dep"
def outputFile = wd + "output.dep"
String[] args = [positionRaster, inputFiles, outputFile]
pluginHost.runPlugin("PickFromList", args, false)

Credits: