Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have created a raster in ArcGIS Desktop 10 with a large number of holes (NoData) in it.

I want to fill the holes using something like the the following:

rOut = arcpy.sa.Con(arcpy.sa.IsNull(rGround),
arcpy.sa.FocalStatistics(rGround, arcpy.sa.NbrCircle(FillRadius,"CELL"), "MEAN"),
rGround)

It is desirable to fill the holes by averaging across a circle with a relatively small radius, but a small radius leaves larger holes unfilled, so I need to iterate this operation.

To do that I would like to be able to get the number of NoData values in my raster, once it reaches zero I can stop filling.

share|improve this question

1 Answer 1

Actually, it sounds like you want to find the smallest radius necessary to patch the raster. That can be obtained as the maximum of the Euclidean distance to the data cells.

To count the number of NoData cells in any raster, compute an indicator of those cells and sum it. The NoData indicator in ArcGIS is called IsNull (as shown in your sample code): by definition, it returns 1 at NoData cells and 0 elsewhere.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.