Why does running statistics on an attribute field give me the wrong COUNT?

1345
7
Jump to solution
09-12-2018 12:05 PM
NatalieRobbins
New Contributor III

I am working on a land suitability analysis in ArcGIS Pro. I wanted to find out the total count of the are that I am working in. I was very exciting to see that when I right click on the Count field in the attribute table, the statistics option is back. I ran the statistics on the field, however when I went to look at them the total count that was calculated is WAY larger than what is possible for the area. Is this issue happening for anyone else? Does anyone have suggestions how to fix this? 

For reference the largest number I have is 151941, the second largest number I have is 58608 and they are increasingly smaller from there. There is no way these numbers could sum to a total of 850924

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
FloraVale
Esri Contributor

Hi Natalie Robbins 

I’ve spoken to my developer and I think we’ve uncovered the issue.

When looking at raster tables the COUNT field is the number of pixels for each value, and serves as a multiplier of the other fields. For example, if you ran statistics on the VALUE field, each value in the VALUE field would be multiplied by COUNT (e.g., there are 100 pixels with value 1, 200 pixels with value 2, etc) and then all summed up. So, running a statistic on the COUNT field doesn’t really make sense for rasters. Essentially, the Sum statistic for the COUNT field in the Statistics table ends up being the sum of COUNTs squared (each count value is multiplied by the number of pixels with that value (COUNT), and summed).

If I understand you correctly you are looking for the total number of non-null pixels in your dataset. If you were to subtract the number of Nulls in the statistics table from the Count number in the statistics table (Count includes nulls), then you would get the number of non-null pixels. Another way to do this would be to run the Summary Statistics tool on that COUNT field, which would return a table with the sum of the values in that column.

Let me know if you need further clarification, it's a tricky issue!

Thank you,

Flora

View solution in original post

7 Replies
FloraVale
Esri Contributor

HiNatalie Robbins,

The COUNT statistic tells you how many records exist in your dataset. So, for the Count field in your table, there are 850924 pixels, including pixels with no data. I think what you are after is the SUM. From the screenshot you provided it looks like the total sum of all of your Count fields is 31285214358.

Please let me know if I've misunderstood your question, I'd be happy to help you figure out this issue,

Flora

0 Kudos
NatalieRobbins
New Contributor III

Hi Flora,

You are right, I am looking for the SUM. With the sum, however that number is still way too big for the dataset that I have. The counts that I am summing to get a total count are screenshotted. When I manually add them together, they equal 356166, which is much lower than the SUM that I am given by the summary statistics. 

0 Kudos
DanPatterson_Retired
MVP Emeritus

Where did that table come from? A raster? If so, did you have lots of nodata areas in the raster?

0 Kudos
FloraVale
Esri Contributor

NNRobbins , would you be able to share this dataset with me? We'd like to figure out where the error is occuring.

0 Kudos
FloraVale
Esri Contributor

Hi Natalie Robbins 

I’ve spoken to my developer and I think we’ve uncovered the issue.

When looking at raster tables the COUNT field is the number of pixels for each value, and serves as a multiplier of the other fields. For example, if you ran statistics on the VALUE field, each value in the VALUE field would be multiplied by COUNT (e.g., there are 100 pixels with value 1, 200 pixels with value 2, etc) and then all summed up. So, running a statistic on the COUNT field doesn’t really make sense for rasters. Essentially, the Sum statistic for the COUNT field in the Statistics table ends up being the sum of COUNTs squared (each count value is multiplied by the number of pixels with that value (COUNT), and summed).

If I understand you correctly you are looking for the total number of non-null pixels in your dataset. If you were to subtract the number of Nulls in the statistics table from the Count number in the statistics table (Count includes nulls), then you would get the number of non-null pixels. Another way to do this would be to run the Summary Statistics tool on that COUNT field, which would return a table with the sum of the values in that column.

Let me know if you need further clarification, it's a tricky issue!

Thank you,

Flora

MikeStrong1
New Contributor

I know this is an old post but it is a potentially big problem for users so it bears repeating. This count-multiplication issue also comes up when doing a volume analysis utilizing the Cut/Fill tool. Running statistics on the Volume field in the cut/fill surface produces wildly inflated results. The resulting sum for the volume statistics is directly related to the count field, but this makes no sense in the context of the cut/fill results. The volume values have already taken the count/area into consideration. 

0 Kudos
KoryKramer
Esri Community Moderator

To close the loop on this thread, functionality has been added in ArcGIS Pro 2.4 (coming in June/July) to handle this:

0 Kudos