Error 999999 while calculating Zonal Statistics as Table for 300k features

192
2
11-30-2020 07:34 PM
Labels (1)
BraundtLau
New Contributor

Am running zonal statistics as table for overlapping polygons, and my original dataset has 320k buffers. 

I've already changed my raster processing extent to >65k, and also made sure the projection is the same for all features, but still Error 999999 occurs. 

Furthermore the script works alright on a polygon dataset of 45k features but now with this larger dataset i run into issues. 

Also the tool doesnt just give me the error right away- i've tested multiple times and usually it happens after running for 1 or 2 hours - which is very frustrating. 

The code is as below -  

 

 

 

 

 

 

def calZonalStat(gdb, buffers, in_ras,name):
    #pcd = postcodes
    now = datetime.datetime.now()
    print("Start_time: "+ str(now))
    #code
    
    out_table = gdb + name+"_ztbl"+appx
    ztbl = arcpy.ia.ZonalStatisticsAsTable(in_zone_data=buffers, zone_field="pcd", in_value_raster=in_ras, out_table=out_table, ignore_nodata="DATA", statistics_type="ALL", process_as_multidimensional="CURRENT_SLICE", percentile_values=[100])
    
    #end time
    later = datetime.datetime.now()
    elapsed = later - now
    print("End_time: "+str(later))
    print("calZonalStat time: " + str(elapsed))

    return ztbl

Air_PM25_RC_ztbl_al1= calZonalStat(loc_gdb, buffers_al1, Air_PM25_RC, 'Air_PM25_RC')

 

 

 

 

 

 

And here's the error message 

 

 

 

 

 

 

# Start_time: 2020-11-25 13:46:12.085096
# Traceback (most recent call last):
#   File "<string>", line 1, in <module>
#   File "<string>", line 8, in calZonalStat
#   File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\ia\Functions.py", line 3956, in ZonalStatisticsAsTable
#     percentile_values)
#   File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\sa\Utils.py", line 53, in swapper
#     result = wrapper(*args, **kwargs)
#   File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\ia\Functions.py", line 3946, in Wrapper
#     percentile_values)
#   File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\geoprocessing\_base.py", line 511, in <lambda>
#     return lambda *args: val(*gp_fixargs(args, True))
# arcgisscripting.ExecuteError: ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds.
# Failed to execute (ZonalStatisticsAsTable).
# 

 

 

 

 

 

 

 

Am wondering if it might be because of limited memory? in my C drive there's only 15GB out of my 100GB SSD. Or any other ways to speed up the process? 

 

Any advice would be appreciated - Thanks!!!!!

 

0 Kudos
2 Replies
DavidPike
MVP Regular Contributor

You might need to calculate statistics on your input raster for it to run the percentiles (just a guess). I'd also check your raster has integer values not float.

out_table = gdb + name+"_ztbl"+appx

also not sure where appx (above) is as a parameter. 

I'd recommend running the tool manually with those parameters on a subset of your data to narrow-down the issue.

0 Kudos
TarenWoelk
Esri Contributor

Hello,

Here (https://support.esri.com/en/Technical-Article/000015210) is an article that addresses common Zonal Statistics as Table error causes. I would absolutely recommend running check/repair geometry, then moving onto the other troubleshooting options.  

0 Kudos