kpierce8

ZonalStats wicked fast in python window, deathly slow from stand-alone script

Discussion created by kpierce8 on Aug 15, 2012
I'm doing some zonal statistics as table and when I run it from a script it takes forever (between 50 minutes and crash). When I run it from the command line in Arc it takes 2-3 minutes.

Command Line syntax

arcpy.SelectLayerByAttribute_management("w15AAClassed","NEW_SELECTION",'"PolyID" >100000 AND "PolyID" < 110000')

arcpy.sa.ZonalStatisticsAsTable("w15AAClassed", "PolyID", "wria15_dem10.img", "D:/ps/outTest2", "DATA", "MEAN_STD")
 


Stand alone script

                   
 queryString = ' "%s" >=  %d And "%s" <=  %d' % ("PolyID", myStart, "PolyID", myEnd)
                     arcpy.SelectLayerByAttribute_management('features_Layer2', "NEW_SELECTION", queryString )
                     outTable09 = dataOut + raster + "_" + str(wria) + "_" + str(myGr) + ".dbf"
                     arcpy.sa.ZonalStatisticsAsTable('features_Layer2', zoneField, rasterDict[raster], outTable09, "DATA", "MEAN_STD")



Any ideas about the execution environment, or other miscellaneous thoughts that could impact this?

Outcomes