2015-08-10 21:33:59 8 Comments

**Update: The bug has been fixed in the ArcGIS 10.4 release**

I am using ArcGIS 10.2.2 to determine zonal statistics for a number of zones. If there is any NoData in the value raster, I want the zone results to be "NoData", precisely as advertised by the tools description. This tool description states:

DATA — Within any particular zone, only cells that have a value in the input Value raster will be used in determining the output value for that zone. NoData cells in the Value raster will be ignored in the statistic calculation.

NODATA — Within any particular zone, if any NoData cells exist in the Value raster, it is deemed that there is insufficient information to perform statistical calculations for all the cells in that zone; therefore, the entire zone will receive the NoData value on the output raster.

Please have a look at my setup in this picture:

I am using the NODATA option with a value raster that has one NoData pixel, and therefore expect the resulting zone value (zone 61154) to be 'NoData'. Instead, I get a value of 12.74 (rounded to 13 in the image), which confuses me on two levels: First, I expected 'NoData', and second, the resulting value of 12.74 is mathematically impossible, because the mean cannot be larger than the maximum value in the value raster, which is 10 in this case.

If I am using the DATA option, I get a value of about 9.1, which makes sense. We tested this on different datasets, computers, and ArcGIS versions.

What am I missing here?

Edit / Additional comment: I just noticed that the 'Count' attribute is also wrong for that particular zone. There are indeed 421 cells in that zone, but the tool only counted 297. Calculating 421 minus 297 results in 124 - oddly enough, this is the "position" where the NoData pixel is located, if one counts the pixels from upper left to lower right in the zone. The tool might be getting the cell count wrong (too low), which might explain the increase of the average.

Edit: Here is a link to the data I am using.

Edit: Dan Patterson and I did some further debugging here at the ESRI forum.

### Related Questions

#### Sponsored Content

#### 3 Answered Questions

### [SOLVED] Wrong min value from ArcGIS 10.4 zonal statistics as table

**2016-06-29 16:11:01****Mouse****729**View**6**Score**3**Answer- Tags: arcgis-desktop zonal-statistics srtm arcgis-10.4

#### 1 Answered Questions

### [SOLVED] Using Zonal Statistics to determine percent forest cover in grid cells?

**2019-01-22 20:05:27****Jordan Rogan****61**View**0**Score**1**Answer- Tags: arcgis-desktop spatial-analyst zonal-statistics raster-conversion

#### 2 Answered Questions

### [SOLVED] How does QGIS Zonal Statistics handle partially overlapping pixels?

**2018-03-22 16:09:00****Jon****583**View**7**Score**2**Answer- Tags: qgis zonal-statistics

#### 0 Answered Questions

### Zonal statistics tool excluding some features in ArcMap?

**2018-07-18 02:05:44****Frank****35**View**0**Score**0**Answer- Tags: raster arcmap spatial-analyst zonal-statistics

#### 1 Answered Questions

### [SOLVED] Zones missing after running zonal statistics in ArcGIS Spatial Analyst?

**2017-05-17 14:42:29****Oh-No****249**View**5**Score**1**Answer- Tags: arcgis-desktop spatial-analyst zonal-statistics missing-data

#### 1 Answered Questions

### [SOLVED] Zonal statistics discrepancy between ArcGIS Desktop versions?

**2014-09-16 15:08:21****SharonB****122**View**4**Score**1**Answer- Tags: arcgis-desktop arcgis-10.0 arcgis-10.2 spatial-analyst zonal-statistics

#### 1 Answered Questions

### [SOLVED] Missing 0 values of a Rasterlayer prevent correct calculation with Zonal Statistics tool in Qgis

**2018-01-22 15:02:51****Okoto****62**View**3**Score**1**Answer- Tags: qgis statistics zonal-statistics

#### 0 Answered Questions

### ArcGIS Focal Statistics Circular Radius Bug Work-Around

**2017-01-17 17:39:53****gis_user****154**View**1**Score**0**Answer- Tags: arcgis-desktop spatial-analyst arcgis-10.4 focal-statistics

#### 2 Answered Questions

### [SOLVED] What to do when raster cell size is larger than zonal vector feature in order to collect statistics?

**2013-05-23 12:02:18****XNSTT****4341**View**1**Score**2**Answer- Tags: arcgis-10.0 raster arcgis-desktop spatial-statistics zonal-statistics

#### 0 Answered Questions

### Reshape Matrix and perform Zonal Statistics in Matlab

**2013-05-18 21:40:01****Tomek****388**View**1**Score**0**Answer- Tags: statistics matlab zonal-statistics

## 3 comments

## @Mike T 2015-08-19 07:06:53

Similar to another answer, move the raster data into NumPy masked arrays to calculated your statistics. Assuming two overlaying rasters with same shape, this is simple:

Shows:

## @GISGe 2015-08-18 11:42:10

There is a bug that seems to correspond to what you're experiencing - it's registered as

BUG-000084883 - The 'Ignore NoData in calculations' option in Zonal Statistics as Table tool {and Zonal Statistics tool} is not honored when checked off, producing incorrect results.It occurs with 10.3 and 10.2.2 but not 10.1. Did you try the tool with this version?

## @UdderlyAstray 2015-08-18 17:52:47

This sounds like a good approach although I personally do not know how to run older versions of the tool. Does someone know where to point me to attempt this work around?

## @G-wizard 2015-08-18 21:24:58

Thanks @GISGe. Where did you find this? Is there a link where this bug is documented?

## @GISGe 2015-08-19 06:03:39

@G-wizard - I've added the link in my answer. As an Esri international staff I have access to a more detailed description than what you can see, that's how I can tell you the bug also applies to the Zonal Statistics tool and is not found in 10.1.

## @GISGe 2015-08-19 06:04:48

@UdderlyAstray - if you want to run an older version of the tool, you have to install that older version of ArcGIS.

## @G-wizard 2015-08-19 18:02:29

Thanks again, @GISGe, since this is what I'm looking for (bug officially confirmed), I'm marking this answer as the correct one, although others have also confirmed this by doing tests.

## @GISGe 2015-08-19 19:06:57

@G-wizard - Thanks! Hopefully it will be solved in 10.4, but we need a bit of patience to be sure (the beta program will start end of this month).

## @FelixIP 2015-08-17 03:34:34

It is a bug. Something terribly wrong with cell count.

Correctmean (9.0452380952381) timescorrectnumber of non-empty cells (420) divided by 297 (that is a cell count reported bytool) results in 12.7912457912458. That is a wrong average reported by tool.Results of my own toy size grids test:

## @radouxju 2015-08-17 10:49:22

I confirm I have the same problem with 10.3 , NODATA and "MEAN"

## @G-wizard 2015-08-17 15:17:41

Thanks both for confirming this. But differences in mean value aside, am I wrong in assuming that the result should actually not be any value, but 'NODATA'? The describtion of the tool leads me to believe that. Says: "NODATA — Within any particular zone, if any NoData cells exist in the Value raster, it is deemed that there is insufficient information to perform statistical calculations for all the cells in that zone; therefore, the entire zone will receive the NoData value on the output raster." Since there is one pixel with "NODATA", the zonal stats should also be "NODATA'. Correct?

## @c0ba1t 2015-08-17 16:01:18

@G-wizard, you are correct, as stated in the Tool Description. somewhat analogous to the #DIV/0! in excel.