I'm having some issues with the Cell Statistics tool in a python script I am writing. I am using 30 years worth of global cumulative annual rainfall data as input and am getting strange values in some areas of my output raster.

In the image below the very bright areas have standard deviation values of around 2000. This is much higher than it should be. Besides these very bright areas the rest of the values in the raster look correct (tested by manually calculating standard deviation values). This is the standard deviation as calculated by my script.

std from script

Using the same set of input I calculated the standard deviation in ArcMap 10.2.2 using the cell statistics geoprocessing tool and got different results. The standard deviation seems to be correctly calculated across the entire extent of the raster.

I am providing statistics on the two raster in case it is helpful to anyone.

script raster:

min = 0  
max = 6697.9404296875  
mean = 75.83343676729601  
std. dev. = 333.72000491046  

arcmap raster:

min = 0  
max = 1507.4833984375  
mean = 35.804817248754  
std. dev. = 84.35107381816201  

There are no no data values under the issue areas that would be causing this. Why are only some of the values being calculated correctly when I process using arcpy? Any ideas about what is going on?

Edit: Added method from script where standard deviation is being calculated.

def calc_cv_raster(self, data_lst):
    print "\nCalculating coefficient of variation raster."
    std_dev = sa.CellStatistics(data_lst, 'STD', 'DATA')
    avg = sa.CellStatistics(data_lst, 'MEAN', 'DATA')
    cv = (std_dev / avg) * 100
    print "Calculated coefficient of variation raster."
    return cv

closed as unclear what you're asking by PolyGeo Aug 28 '16 at 3:11

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    What else is going on in the script? Are you sure that the raster objects on which the script is running the cell stats (i.e., the raster objects at the time they get to the cell stats function may not be the same as those that you feed into the script) are the exact same as those you're running in ArcMap? Can you post your code? – Tom Mar 8 '16 at 21:10
  • Calculating standard deviation is part of a much larger script that calculates other statistics on the input datasets and creates maps of the output. The input to the cell statistics tool (annual cumulatives) is saved to disk much earlier in the script and I double checked to make sure these are the same rasters I am using when testing in ArcMap. Might be able to post some code later. – spalka Mar 8 '16 at 21:24