I am trying to take the natural log and then calculate z-scores on cell values in several composite band GRID rasters in ArcGIS Desktop.

I am not fluent in Python and do not see a way to automate this within ArcGIS Desktop.

I am in need of some coding help or a suggestion on how to automate this within ModelBuilder.


It's usually easiest to represent univariate statistics as (constant) grids when they are to be employed in later grid operations. The trick is to create such grids. That is done by means of zonal statistics. For this to work, you first need to create a grid indicating that every cell is within a single "zone". That would just be a constant grid of the same size, dimensions, and location as the original. There are many ways to create such a grid, but one reliable method is simply to subtract the grid from itself. Convert the result to integer format to make sure it's acceptable as a zone grid.

The workflow, beginning with a grid "X" (say), therefore is

  1. Compute Y = Int("X" - "X").

  2. Compute M = Zonal mean of "X", using "Y" as the zone grid. "M" is a grid.

  3. Compute S = Zonal standard deviation of "X", using "Y" as the zone grid. "S" is a grid.

  4. Compute ("X" - "M") / "S".

  • Just for the record there is a create constant raster geo-processing tool. – Hornbydd Oct 11 '13 at 21:04
  • @Hornbydd Yes, but none of the rasters created for a Z-score is a "constant" in the sense of that tool, which requires the values to be provided externally. If you can describe a convenient way to query a grid dataset's statistics and pass those values to the create constant raster tool, then you will have an excellent answer. – whuber Oct 11 '13 at 21:30
  • I used a zone encompassing my entire raster to calculate a single mean and sd for the entire file, which then output a single-value raster for the extent of my study area. Thanks for the tips everyone, they were a great help! – Mo Correll Oct 24 '13 at 18:45

If you use an Iterator within model builder, you can grab a folder containing multiple rasters and it will separate them within and apply the next process to all of them congruently

Set raster format as GRID

Under data management tools> Calculate Statistics

If this isn't what you are looking for, you can always create a mosaic dataset with the desired raster GRIDs and select your preferences as it applies to composite bands. From here you can apply raster function chains to process different analyses and calculate statistics to display values correctly

To do this you need to first create a file geodatabase, then create a mosaic dataset, from here you right click and add rasters make sure format is correct and check boxes for Overview creation and calculate statistics

Hope this is a start, let me know if you need anymore assistance with this process

  • 1
    LMHall- thanks for the tips. My trouble is getting the values produced by Calculate Statistics and inputting them into a formula in raster calculator - for a Z-score I need the mean and the SD of each raster before calculating each individual cell's Z-score (Zscore = (cellval - mean)/SD). So, I need a way of drawing from the raster statistics once they are calculated and inputting them into raster calculator. – Mo Correll Oct 11 '13 at 14:57

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.