Solved! Go to Solution.
import sys, os, arcpy from arcpy import env from arcpy.sa import * if arcpy.CheckExtension("Spatial"): arcpy.CheckOutExtension("Spatial") else: print "No SA licence" exit HomeDir = "c:/Path to directory here/" fgdb = "Name of your fgdb.gdb" InData = os.path.join(HomeDir, fgdb) env.workspace = InData env.overwriteOutput = True ListRast = arcpy.ListRasters() for r in ListRast: print "Processing", r Ras = arcpy.Raster(r) NullRas = IsNull(Ras) NCol = NullRas.width NRow = NullRas.height NCell = NCol * NRow Mean = NullRas.mean NNull = Mean * NCell print "{} % Null {}".format(r, NNull / NCell * 100)
Neil
To loop through a raster table you can use.
input = "myIntRaster"
cursor = arcpy.da.SearchCursor(input, ['value', 'count'])
for row in cursor:
print (row)
-Steve