1

I have 2 input rasters of rainfall for summer/winter and I want to make a 3rd output based on which one has the max value for that cell. So if the max value at the cell is summer it will assign 1, or winter 2 for the new output raster. That way I will have a raster showing which season has the max amount of rainfall across the different areas of the region.

For example if,

Summer(1) was,

200 300

300 350

and Winter(2) was,

300 350

350 200

The output would be,

2 2

2 1

I understand that the logic should be: If max = summer output = 1 else max = winter output = 2

But I am unsure how to actually translate this into something like raster calculators conditional statements.

I am currently using ArcMap 10.2

3

If you had a raster representing your summer rainfall named "Summer.tif" and a raster representing winter rainfall named "Winter.tif" loaded in the ArcMap table of contents, the following conditional statement could be used in raster calculator to get the desired output:

Con("Summer.tif">"Winter.tif",1,2)

The syntax is as follows:

Con(Conditional statement, true value, false value)

Meaning that the raster calculator will evaluate the conditional statement and if the result is true the cell will be assigned the true value and if the value is false it will be assigned the false value.

If your rasters are not already loaded in the ArcMap table of contents you will need to supply full file paths. Additionally, be aware that you may want to use greater than or equal to (>=) rather than just the greater than (>) to avoid undesired behavior when the two values are equal to each other.

For more information about how to use the conditional statement in raster calculator refer to the ESRI link here.

  • That is exactly what I needed thank you very much. I did not realize you could assign a false value to the conditional statement as well. – T.Fazio Sep 24 '15 at 6:55
1

While @JamesSLC's answer works for two rasters, if you want to do the same thing with any number of rasters, I'd use the Highest Position tool instead:

Determines on a cell-by-cell basis the position of the raster with the maximum value in a set of rasters.

0

In addition to @JamesSLC answer, you could also include a value for equal state by nesting two conditional statements.

Con("Summer.tif">"Winter.tif", 1, Con("Summer.tif"=="Winter.tif", 3, 2))

This statement does the following:

  1. If Summer greater Winter then assign 1
  2. Check the remaining pixel with the second conditional statement
  3. If Summer equals Winter assign 3
  4. Assign 2 to the remaining pixel (These are all pixel where Summer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.