<?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: Excluding &amp;quot;NoData&amp;quot; from raster percentile calculation.  in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/excluding-quot-nodata-quot-from-raster-percentile/m-p/748673#M57860</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have many options, depending on what your nodata values were converted to,&lt;/P&gt;&lt;P&gt;There is &lt;A href="http://docs.scipy.org/doc/numpy/release.html" title="http://docs.scipy.org/doc/numpy/release.html"&gt;Release Notes — NumPy v1.9 Manual&lt;/A&gt;&amp;nbsp; if you are using Numpy 1.9 or your version supports&amp;nbsp; it&lt;/P&gt;&lt;P&gt;EDIT&lt;/P&gt;&lt;P&gt;these comments were for means...but whatever, there is a nan_stat for every equivalent o any stat but you can create masked arrays or use where functions to mask nodata values in a raster.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;np.nanmean&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;A href="http://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.nanmean.html" title="http://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.nanmean.html"&gt;numpy.nanmean — NumPy v1.10.dev-19c3cf1 Manual&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;create a masked array and use&amp;nbsp; &lt;A href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.ma.mean.html" title="http://docs.scipy.org/doc/numpy/reference/generated/numpy.ma.mean.html"&gt;numpy.ma.mean — NumPy v1.9 Manual&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;plus oodles of other where you can use np.where( myarray &amp;gt; whatever is 'null') then take the mean&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;so check the details of how you created &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-functions/rastertonumpyarray-function.htm" title="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-functions/rastertonumpyarray-function.htm"&gt;RasterToNumPyArray—Help | ArcGIS for Desktop&lt;/A&gt; and the option you used regarding nulls&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jul 2015 15:01:20 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2015-07-16T15:01:20Z</dc:date>
    <item>
      <title>Excluding "NoData" from raster percentile calculation.</title>
      <link>https://community.esri.com/t5/python-questions/excluding-quot-nodata-quot-from-raster-percentile/m-p/748672#M57859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to calculate percentiles out of a floating point raster. It works but it includes NoData in the calculation so I'm not getting what I need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wonder if someone knows how to exclude the "NoData" from the calculation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;env.workspace = r"D:\PROGRAMMES\LFP_Source_Rocks\ArcGIS\00_LFP_GLOBAL\00_UPWELLING\OUTPUT_Test.gdb"
raster = env.workspace + "\\" + "percentile"
array = arcpy.RasterToNumPyArray(raster)
array = scipy.sort(array)
per = 10
a = scipy.percentile(array,per)
print a&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:49:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/excluding-quot-nodata-quot-from-raster-percentile/m-p/748672#M57859</guid>
      <dc:creator>anTonialcaraz</dc:creator>
      <dc:date>2021-12-12T07:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding "NoData" from raster percentile calculation.</title>
      <link>https://community.esri.com/t5/python-questions/excluding-quot-nodata-quot-from-raster-percentile/m-p/748673#M57860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have many options, depending on what your nodata values were converted to,&lt;/P&gt;&lt;P&gt;There is &lt;A href="http://docs.scipy.org/doc/numpy/release.html" title="http://docs.scipy.org/doc/numpy/release.html"&gt;Release Notes — NumPy v1.9 Manual&lt;/A&gt;&amp;nbsp; if you are using Numpy 1.9 or your version supports&amp;nbsp; it&lt;/P&gt;&lt;P&gt;EDIT&lt;/P&gt;&lt;P&gt;these comments were for means...but whatever, there is a nan_stat for every equivalent o any stat but you can create masked arrays or use where functions to mask nodata values in a raster.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;np.nanmean&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;A href="http://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.nanmean.html" title="http://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.nanmean.html"&gt;numpy.nanmean — NumPy v1.10.dev-19c3cf1 Manual&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;create a masked array and use&amp;nbsp; &lt;A href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.ma.mean.html" title="http://docs.scipy.org/doc/numpy/reference/generated/numpy.ma.mean.html"&gt;numpy.ma.mean — NumPy v1.9 Manual&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;plus oodles of other where you can use np.where( myarray &amp;gt; whatever is 'null') then take the mean&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;so check the details of how you created &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-functions/rastertonumpyarray-function.htm" title="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-functions/rastertonumpyarray-function.htm"&gt;RasterToNumPyArray—Help | ArcGIS for Desktop&lt;/A&gt; and the option you used regarding nulls&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jul 2015 15:01:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/excluding-quot-nodata-quot-from-raster-percentile/m-p/748673#M57860</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-07-16T15:01:20Z</dc:date>
    </item>
  </channel>
</rss>

