I have two rasters depicting climate in two periods and I want to compare their values.

I want to create a third raster returning:

Values of raster 1 are within the minimum and maximum values of raster 2.

and fourth raster:

Values of raster 1 are within the 2.5 % and 97.5 % percentile of raster 2.

I have never worked with raster calculator and I do not know the syntax.

  • I don't know the exact syntax for raster calculator either, but I suggest you'd start with making 4 'compare' rasters from raster 2, one with the maximum value in every cell, one with the minimum, one with the 2.5% value, and one with the 97.5% value, and then compare raster 1's values with these. – Menno Nov 13 '14 at 10:25

The raster calculator syntax for you third raster is the following

Con( ("raster1" < "raster2".maximum) &  ("raster1" > "raster2".minimum) , 1, 0)

there is no built in method to get the percentiles, so you should compute them based on the histogram of you image and manually enter the values in the raster calculator. But you can approximate (if your distribution is close to a Gaussian) using mean + 1.96 * standard deviation

Con( ("raster1" < ( "raster2".mean + 1.96 * "raster2".standardDeviation ) ) &  ("raster1" > ( "raster2".mean - 1.96 * "raster2".standardDeviation ) ) , 1, 0)
  • Are you sure you can utilize the .maximum or .minimum methods in the raster calculator? I thought you had to generate separate raster objects outside the RC in order for these methods to be utilized. – Aaron Nov 13 '14 at 12:28
  • tested with ArcGIS 10.1 and 10.2, for 10.0 I don't know, and for 9.x it doesn't work. – radouxju Nov 13 '14 at 12:37
  • +1 This is great. My only sticking point is that it assumes a Gaussian distribution and so few of the phenomena that we deal with actually are normal. Does ArcGIS not have a tool to convert a raster to a cumulative distribution function ala uoguelph.ca/~hydrogeo/Whitebox/Help/… ? If so, that could be used to get the 2.5 and 97.5 percentiles. – WhiteboxDev Nov 13 '14 at 14:50
  • Thank you, radouxju, you saved my bachelor thesis, I used only the first syntax as all distributions were far from Gaussian. Thanks – Jane Nov 13 '14 at 15:01
  • If this answers your question, you should click the checkmark under the rating in the upper left of the answer to indicate that. – jbchurchill Nov 13 '14 at 16:38

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.