or
look at the GetRasterProperties gp tool
-Steve
Here is an example of getting the % of nulls in a raster.
# calculate % no data cells in a raster. 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:/Data/Swala/BurkinaFaso/IPSurvey/" fgdb = "IPRasterData.gdb" InData = os.path.join(HomeDir, fgdb) env.workspace = InData env.overwriteOutput = True ListRast = arcpy.ListRasters() # ListTable = arcpy.ListTables() 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)
Hi - I'm just trying to work round this error in my script....
"To test if a Raster has all NoData run the IsNull tool. If the output is all 1 then it only has NoData"
How do you test whether the whole raster is 1?
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.