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
If you run IsNull followed by Get Raster Properties with MEAN you will get the mean of the 1 and 0 output from IsNull. Multiply this number by 100 and you have the percentage NoData in the raster.
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.