Select to view content in your preferred language

ArcGIS 10.2.2 arcpy Cell Statistics giving Incorrect Values

9046
22
Jump to solution
03-09-2016 02:08 PM
StephenPalka1
Occasional Contributor

Hey everyone, I've been having some issues using the cell statistics tool in a python script recently. The issue is occurring in a stand alone script. I am trying to calculate standard deviation across 30 tif's representing annual cumulative rainfall for the globe.

While most of the values in the resulting raster (also a tif) are correct, there are large pockets of data that have extremely high standard deviation values (around 2000 - 3000 when they should be around 150).

When I run the same analysis in ArcGIS using the cell statistics geoprocessing tool the output is correct and I do not see these irregular values.

Does anyone have any idea why this would be happening? I assumed at first it was something wrong with my script but how could only some of the values be incorrect? There are also no no data values in these issue areas that could be causing the miscalculation although there is a no data value set in all of the input rasters.

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

script output:
min = 0
max = 6697.9404296875
mean = 75.83343676729601
std. dev. = 333.72000491046

arcmap output:
min = 0
max = 1507.4833984375
mean = 35.804817248754
std. dev. = 84.35107381816201

0 Kudos
22 Replies
XuguangWang
Esri Contributor

Thank you for your information. This is a bug in ArcGIS 10.2.2, which was fixed in the 10.4 release. As you have pointed out, a workaround to use with versions prior to 10.4 is to convert the input raster pixel type to 32 bit integer with the Copy Raster tool, or to a floating-point raster with the Float tool.

StephenPalka1
Occasional Contributor

Is the issue with the cell statistics tool documented anywhere yet?

0 Kudos
DanPatterson_Retired
MVP Emeritus

Sum 6,000+ rasters - Python script

6,000+ rasters the follow-up

plus other show the use of numpy arrays to perform those calculations for multidimensional data quickly accounting for nodata values of all types.  Not much use this time, but if you are working with more than a raster or two covering an area, consider using this alternative.  Sample code is included in the last link and in a recent blog post on raster reclassification I did in the Py Links.