Finding the value from an input list meeting a specified criteria

Available with Spatial Analyst license.

There are two local tools that assign an output value for a cell based on which value or values meet a specified criteria from a list of values obtained from a group of input rasters. The tools are Popularity and Rank.

Popularity

The Popularity tool determines for each location the value that is the nth most popular value of the input values identified from the input rasters. It requires a list of input rasters and the popularity value, which can either be a constant or raster, identifying the nth most popular value.

Example for one cell location with five input rasters

For example, if the popularity value specified is 2, then for each cell, the second most popular value from a list of the values derived from the input rasters should be output. If the input values for a specific location are as follows

PopularityInRas1InRas2InRas3InRas4InRas5

2

3

3

5

3

5

Example input cell values for Popularity

Then the values will be sorted in the following way:

ValueInput raster

3

InRas1

3

InRas2

3

InRas4

5

InRas3

5

InRas5

Sorted values list

As a result, the most popular value in the list is 3, with three occurrences, and the next most popular value is 5, with two instances. Since the specified popularity value is 2, then the output from the tool for this cell location will be 5.

Example for three input rasters

For another example, the following graphic identifies the second most popular value for the three input rasters.

Popularity illustration
OutRas = Popularity(2, [InRas1, InRas2, InRas3])

If a cell for any location on any of the input rasters is NoData, that location will receive NoData for the output.

If a particular location has no value that is second in popularity, the cell location will receive NoData. This situation can occur under the following conditions:

  • All values are unique.
  • There are equal numbers of different values.

Rank

The Rank tool creates for each cell an internal argument list of the values from the input rasters. The values in the argument list are ordered from smallest to largest. The value at the rank order position defined by the input rank raster (the nth smallest value) is output.

Example

For example, the input rank raster is RankRas, and the input list of rasters is InRas1, InRas2, InRas3 and InRas4. The RankRas raster has all cell values with a constant value of 3, indicating that the third smallest value is to be returned.

InRas1InRas2InRas3InRas4

4

6

3

8

Example input values for Rank tool

These values are ranked:

PositionCell value

1

3

2

4

3

6

4

8

Rank order argument list

Since the position defined by the value in the rank input is the third position (3), the output value for this cell will be 6.

Related topics


In this topic
  1. Popularity
  2. Rank