1

I am running the zonal statistic tool on a raster with a shapefile that consists of several regional polygons. I would like the zonal statistic to include the regions that are completely NoData in the final table instead of just completely removing it. Is there a way to do this or am I limited to the Data or NoData options that are available?

My current code is simply:

arcsa.ZonalStatisticsAsTable(carPath, 'CARUID', os.path.join(tmpDir, "masked.tif"), os.path.join(tmpDir, "table"), 'DATA', 'ALL')
  • 2
    what do you mean by including the NoData values ? I only see two correct ways to handle NoData (ignore or absorb). Maybe what you want is replacing NoData with a value of 0, but then it is not NoData anymore. – radouxju Sep 25 '14 at 19:46
  • as radouxju says, sounds like you want the cell to count but not have a value so reclass nodata to 0 – If you do not know- just GIS Sep 25 '14 at 19:49
  • @radouxju Basically what I was trying to achieve is to have every "zone" in the original zone field to appear in the output table instead of simply skipping it even if the statistics are done on a zone that has NoData. It's my attempt at making the output data consistent when running zonal statistics on multiple images in a timeseries. – Dzinic Sep 26 '14 at 13:45
1

Zonal Statistics is only going to include data that is in a zone. If your zones are non-contiguous, the only way your are going to include data from your input raster is if it is in a zone. If you want statistics on areas outside of your current zones, you will need to modify your zone layer. For example you could create a polygon layer that is the same extent as your raster and then with some editing, merge your existing zones into that. Then you would have a zone for everything that is not in a zone. If I'm understanding you correctly, that would achieve your goal.

If I am misunderstanding that goal, as @user two seven two three nine suggests, you could make your NoData into 0 first with something like Con("input" > 0, "input", 0) and then it would be quantified in the table as 0.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.