Select to view content in your preferred language

Error with Zonal statistics

4513
11
07-23-2014 12:15 AM
DanRosauer
Deactivated User

Hi

I am using the spatial analyst zonal statistics tool to get the standard deviation of elevation.  For zones, I have a coarser raster with each cell uniquely numbered.

The tool runs without error, but the results for standard deviation (std) have zero in all zones.

Running the same analysis for mean or maximum gives the correct values.

And, running the same analysis after converting the zonal grid to polygons gives correct values.

Is this a known bug?  Or perhaps I missed something important.

cheers

Dan

0 Kudos
11 Replies
DanPatterson_Retired
MVP Emeritus

Did you set the analysis extent and cell size in the Environments tab of the tool prior to running the analysis?  it could be that the initial vector version automatically set this prior to running the statistics, although this wouldn't necessarily account for the mean working.  In any event, you should set the cell size and output extent so that they match the input layer prior to running any SA tools...don't assume they will be correct

DanRosauer
Deactivated User

Thanks Dan

I just set the analysis extent, cell size and snap to, in the environment settings.  The result cells now align correctly to the zones.

But the problem remains of STD results being zero, while mean and max are fine.  I don't need a solution any more, as the work-around of converting the zones grid to polygons worked. 

It does look like a possible error in the software though.  Has anyone else hit the same issue?  How do we report it to ESRI?  (do they monitor these discussions?)

cheers

Dan

0 Kudos
DanPatterson_Retired
MVP Emeritus

Dan there is a support request form on this site, but I don't know if individuals can submit one, or if you belong to an organization, your rep may have to.  Good luck and report to this thread should you find a solution

0 Kudos
DanPatterson_Retired
MVP Emeritus

By the way...is this Zonal Statistics as table?  If so, what do you expect the standard deviation to be given your dataset AND if you are examining results within a table, did you expressly format the column for the expected number of decimal points?

0 Kudos
DanRosauer
Deactivated User

No, not as table.  It returns a grid.  And for the mean statistic it correctly gives floating point values.

0 Kudos
curtvprice
MVP Esteemed Contributor

I would look carefully at your input data. Is there variation within each zone at all?

DanPatterson_Retired
MVP Emeritus

Excellent idea, this is the only one that would account for a 0 std dev outside of pure error.  There is no indication on any zonal statistics thread of this behaviour being reported before.  You might also want to examine the statistics of the std dev raster to confirm non-visually that the values are indeed all 0 (which I am sure you have)

DanRosauer
Deactivated User

Hi Curtis and Dan

Good questions, but I can assure you that I wouldn't have posted to the forum without checking for such basic causes first.

As I mentioned, when I replaced the zonal grid with a polygon feature class covering the identical areas, the standard deviation gave results which were about as expected.

For some context, if needed, the zones are each a single pixel of 2.5 minutes, roughly 4.5km.  The data being summarised is a DEM at 9 second (roughly 250 metre) resolution.  So there are about 277 elevation pixels in each zone, except along the coast.  The elevations range from sea level up to about 1300m.

The only way I can think of  that these data could give varying mean values but 0 standard devation, is if for each zone, defined in this case by a single pixel, it is taking only one sample, rather than sampling all 277 of the finer resolution data pixels which it overlaps.

A way to check for this second possibility, would be to see if the mean values are actually correct, or just reflecting the value of a single elevation pixel within each zone.

I could post data online, but will take some fiddling to cut it down to a managabe test size.  So only if someone definitely wants to test it.

cheers

Dan

0 Kudos
DanPatterson_Retired
MVP Emeritus

Dan
The differing cell size intrigues me...could you try to rasterize your zonal polygon file using the same cell size as your DEM and rerun the analysis ... just humor me

0 Kudos