Zonal statistics - percentiles (reprise)

Discussion created by a.potgieter@uq.edu.au on Dec 20, 2018
Latest reply on Feb 28, 2019 by a.potgieter@uq.edu.au
Branched from an earlier discussion

Brached from Zonal statistics - percentiles 


Hi Xander Bakker 


I have also run your multiple raster percentile code. It runs upto loading the created polygon file:

Processing Raster 'after_raster'
- Processing polygon: 0
- ExtractByPolygon...
- saved raster as ras0pol0
- fill dict with Value x Count
Runtime error
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "F:\\data\\UAV\\Lodging_model\\GeoDatabase\\raster_percentile.py", line 171, in <module>
File "F:\\data\\UAV\\Lodging_model\\GeoDatabase\\raster_percentile.py", line 67, in main
dct = {row[0]:row[1] for row in arcpy.da.SearchCursor(outname, flds_ras)}
RuntimeError: cannot open 'ras0pol0'


here is the first part of the code:

import arcpy
import os

def main():
# settings
ras_ws = r"F:/data/UAV/Lodging_model/GeoDatabase/raster/" # input raster workspace
fc = r"F:/data/UAV/Lodging_model/GeoDatabase/Hermitage_Lodging_Grid.shp" # input polygons
tbl = r"F:/data/UAV/Lodging_model/GeoDatabase/raster/Zonal_Perc_A" # output related table

lst_perc = [2, 5, 10, 90, 95, 98] # list of percentiles to be calculated
fld_prefix = "Perc_"
fld_poloid = "POL_OID"
fld_rasname = "RasterName"



not sure why it cant load the ras0pol0 ?  It opens in acrgis no p[roblem from the geodatabase...