Script Zonal statistics percentiles, using Float rasters

8187
12
Jump to solution
03-03-2016 09:43 AM
BrianPowell
Emerging Contributor

Branched from: Re: Script Zonal statistics percentiles, using Float rasters

Hello,

I'm trying to do the exact same thing for 25, 50, and 75 percentiles.  I have an integer DEM and a set of continuous polygons.  Here is the error I'm getting:

Traceback (most recent call last):

  File "C:\Python27\ArcGIS10.3\Lib\percentiles.py", line 100, in <module>

    pixval =  GetPixelValueForPercentile(dct_per, perc_dec)

  File "C:\Python27\ArcGIS10.3\Lib\percentiles.py", line 10, in GetPixelValueForPercentile

    return pix_val

UnboundLocalError: local variable 'pix_val' referenced before assignment

I am not a python programmer, any insight is most appreciated.  I've attached the script with the changes I made, which were only the list of percentiles (line 25) and the paths to my datasets.  Ideally, if it's possible, I would like to run this on a float raster instead of an integer raster.

Much thanks,

Brian

0 Kudos
12 Replies
BrianPowell
Emerging Contributor

Hi, I used the ExtractByPolygon code.  I ran it on a very large polygon (n=14,500) set over the weekend.  It took 62 hours but it did finish successfully.

0 Kudos
BrianPowell
Emerging Contributor

Will the script run on a multipart polygon dataset?  And if it will, should I use ExtractByPolygon or ExtractByMask?

0 Kudos
XanderBakker
Esri Esteemed Contributor

Te be sure, I would recommend the ExtractByMask for multipart polygons and for polygons with holes.