<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Script Zonal statistics percentiles, using Float rasters in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261584#M20103</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you guys both for your help and suggestions.&amp;nbsp; I was able to get it to run overnight and used a 100x multiplier.&amp;nbsp; This is great.&lt;/P&gt;&lt;P&gt;Sincerely,&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 04 Mar 2016 20:03:25 GMT</pubDate>
    <dc:creator>BrianPowell</dc:creator>
    <dc:date>2016-03-04T20:03:25Z</dc:date>
    <item>
      <title>Script Zonal statistics percentiles, using Float rasters</title>
      <link>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261576#M20095</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Branched from: &lt;A href="https://community.esri.com/message/592636"&gt;Re: Script Zonal statistics percentiles, using Float rasters&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to do the exact same thing for 25, 50, and 75 percentiles.&amp;nbsp; I have an integer DEM and a set of continuous polygons.&amp;nbsp; Here is the error I'm getting:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "C:\Python27\ArcGIS10.3\Lib\percentiles.py", line 100, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pixval =&amp;nbsp; GetPixelValueForPercentile(dct_per, perc_dec)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "C:\Python27\ArcGIS10.3\Lib\percentiles.py", line 10, in GetPixelValueForPercentile&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return pix_val&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UnboundLocalError: local variable 'pix_val' referenced before assignment&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not a python programmer, any insight is most appreciated.&amp;nbsp; 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.&amp;nbsp; Ideally, if it's possible, I would like to run this on a float raster instead of an integer raster.&lt;/P&gt;&lt;P&gt;Much thanks,&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Mar 2016 17:43:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261576#M20095</guid>
      <dc:creator>BrianPowell</dc:creator>
      <dc:date>2016-03-03T17:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Script Zonal statistics percentiles, using Float rasters</title>
      <link>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261577#M20096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're not using the latest script posted in this thread. Line 4 should read.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14570307622681937" data-renderedposition="60_8_872_16" jivemacro_uid="_14570307622681937" modifiedtitle="true"&gt;&lt;P&gt;pix_val = sorted(dctper.keys())[0] &lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... but is missing in your script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To run this on float raster data, would require a different approach. Only integer rasters have an attribute table and this is used in the script to determine the percentiles. However, one could implement a procedure that takes an float raster as input, converts it to integer (applying a multiplication factor to reduce the loss of precision) and apply the factor in the results too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the data range of the float raster you have?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Mar 2016 18:49:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261577#M20096</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2016-03-03T18:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: Script Zonal statistics percentiles, using Float rasters</title>
      <link>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261578#M20097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The data range of the float raster is -26.9159 to 334.042.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Mar 2016 21:22:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261578#M20097</guid>
      <dc:creator>BrianPowell</dc:creator>
      <dc:date>2016-03-03T21:22:04Z</dc:date>
    </item>
    <item>
      <title>Re: Script Zonal statistics percentiles, using Float rasters</title>
      <link>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261579#M20098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The script ran a lot longer now that I incorporated your prior suggestions.&amp;nbsp; Now I am getting this at line 60.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "C:\Python27\ArcGIS10.3\Scripts\percentiles_edit.py", line 60, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; x, y = pnt.X, pnt.Y&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AttributeError: 'NoneType' object has no attribute 'X'&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Failed to execute (Percentiles).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Failed at Thu Mar 03 13:35:22 2016 (Elapsed Time: 7 minutes 36 seconds)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any thoughts?&lt;/P&gt;&lt;P&gt;Much thanks,&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Mar 2016 21:39:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261579#M20098</guid>
      <dc:creator>BrianPowell</dc:creator>
      <dc:date>2016-03-03T21:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: Script Zonal statistics percentiles, using Float rasters</title>
      <link>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261580#M20099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Xander,&lt;/P&gt;&lt;P&gt;I like the idea of using a multiplier and converting to an integer raster as a work around, that will work fine for the float issue.&amp;nbsp; I am still getting the error on line 60:&lt;/P&gt;&lt;P&gt;x, y = pnt.X, pnt.Y&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AttributeError: 'NoneType' object has no attribute 'X'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is happening after it has already processed a handful of polygons.&amp;nbsp; I ran the check geometry and repair geometry tools to check for null geometries and the feature class seems fine.&amp;nbsp; Any ideas of why it may be erring out? &lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Mar 2016 00:21:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261580#M20099</guid>
      <dc:creator>BrianPowell</dc:creator>
      <dc:date>2016-03-04T00:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: Script Zonal statistics percentiles, using Float rasters</title>
      <link>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261581#M20100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;do you have polygons with holes? a polygon with a hole will have a null separater between the inner and outer parts.&amp;nbsp; This case will complicate the process... then try a multipart polygon with multiple holes and you are pushing towards a full implementation of geometry checks and processing.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Mar 2016 01:06:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261581#M20100</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-03-04T01:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: Script Zonal statistics percentiles, using Float rasters</title>
      <link>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261582#M20101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As &lt;A href="https://community.esri.com/migrated-users/3116"&gt;Dan Patterson&lt;/A&gt;​ states, most likely you have a polygon with a hole in it. The Nonetype point indicates the start of an inner ring. To avoid this you could use the code posted here:&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.esri.com/thread/95403#555075" title="https://community.esri.com/thread/95403#555075"&gt;https://community.esri.com/thread/95403#555075&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of using ExtractByPolygon it uses ExtractByMask.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Mar 2016 01:14:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261582#M20101</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2016-03-04T01:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: Script Zonal statistics percentiles, using Float rasters</title>
      <link>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261583#M20102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What precision are you trying to obtain. Would in this case a multiplier by 10 be sufficient, the range would be changed at the end of the run to &lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-size: 14px;"&gt;-26.9 to 334.0. You could test this manually by using the Raster Calculator (in Spatial Analyst Tools\Map Algebra) and use a formula like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-size: 14px;"&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/188720_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Mar 2016 01:21:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261583#M20102</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2016-03-04T01:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Script Zonal statistics percentiles, using Float rasters</title>
      <link>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261584#M20103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you guys both for your help and suggestions.&amp;nbsp; I was able to get it to run overnight and used a 100x multiplier.&amp;nbsp; This is great.&lt;/P&gt;&lt;P&gt;Sincerely,&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Mar 2016 20:03:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261584#M20103</guid>
      <dc:creator>BrianPowell</dc:creator>
      <dc:date>2016-03-04T20:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: Script Zonal statistics percentiles, using Float rasters</title>
      <link>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261585#M20104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad to hear that it worked. Did you use the code with ExtractByMask or ExtractByPolygon?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 06 Mar 2016 19:31:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261585#M20104</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2016-03-06T19:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Script Zonal statistics percentiles, using Float rasters</title>
      <link>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261586#M20105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I used the ExtractByPolygon code.&amp;nbsp; I ran it on a very large polygon (n=14,500) set over the weekend.&amp;nbsp; It took 62 hours but it did finish successfully. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Mar 2016 17:16:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261586#M20105</guid>
      <dc:creator>BrianPowell</dc:creator>
      <dc:date>2016-03-07T17:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Script Zonal statistics percentiles, using Float rasters</title>
      <link>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261587#M20106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Will the script run on a multipart polygon dataset?&amp;nbsp; And if it will, should I use ExtractByPolygon or ExtractByMask?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Mar 2016 18:07:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261587#M20106</guid>
      <dc:creator>BrianPowell</dc:creator>
      <dc:date>2016-03-07T18:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Script Zonal statistics percentiles, using Float rasters</title>
      <link>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261588#M20107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Te be sure, I would recommend the ExtractByMask for multipart polygons and for polygons with holes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Mar 2016 20:03:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-zonal-statistics-percentiles-using-float/m-p/261588#M20107</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2016-03-07T20:03:51Z</dc:date>
    </item>
  </channel>
</rss>

