<?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: number of no NoData cells in raster in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/number-of-no-nodata-cells-in-raster/m-p/626355#M48830</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Check out the IsNull tool in the spatial analyst toolset, it will produce a grid of 0's or 1's, simply open its table to get the cell count.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Jan 2012 11:03:43 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2012-01-12T11:03:43Z</dc:date>
    <item>
      <title>number of no NoData cells in raster</title>
      <link>https://community.esri.com/t5/python-questions/number-of-no-nodata-cells-in-raster/m-p/626351#M48826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi is there some way how to find out number of no NoData cells in raster? (without looping whole raster)&amp;nbsp; thanks a lot.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jan 2012 06:21:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/number-of-no-nodata-cells-in-raster/m-p/626351#M48826</guid>
      <dc:creator>martinmaretta</dc:creator>
      <dc:date>2012-01-12T06:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: number of no NoData cells in raster</title>
      <link>https://community.esri.com/t5/python-questions/number-of-no-nodata-cells-in-raster/m-p/626352#M48827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;there´s probably a better way to do this, but i´d try with numpy:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
import numpy as np
import numpy.ma as ma

inRaster = r"E:\testraster.tif"

# convert inraster to numpy array, set nodata values to -9999
npArray = arcpy.RasterToNumPyArray(inRaster,"","","",-9999)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
# mask the non-nodata values, and take them out by compressing
npM = ma.masked_where(npArray &amp;lt;&amp;gt; -9999, npArray).compressed()
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
# print how many cells are nodata&amp;nbsp;&amp;nbsp;&amp;nbsp; 
print len(npM)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:41:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/number-of-no-nodata-cells-in-raster/m-p/626352#M48827</guid>
      <dc:creator>RaphaelR</dc:creator>
      <dc:date>2021-12-12T02:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: number of no NoData cells in raster</title>
      <link>https://community.esri.com/t5/python-questions/number-of-no-nodata-cells-in-raster/m-p/626353#M48828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;maybe with numpy?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
import numpy as np
import numpy.ma as ma


inRaster=r"E:\test1.tif"
# convert inraster to numpy array, set nodata values to -9999
npArray = arcpy.RasterToNumPyArray(inRaster,"","","",-9999)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
# mask the non-nodata values, and take them out by compressing
npM = ma.masked_where(npArray &amp;lt;&amp;gt; -9999, npArray).compressed()
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
print npM.size
&amp;nbsp;&amp;nbsp;&amp;nbsp; 

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:41:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/number-of-no-nodata-cells-in-raster/m-p/626353#M48828</guid>
      <dc:creator>RaphaelR</dc:creator>
      <dc:date>2021-12-12T02:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: number of no NoData cells in raster</title>
      <link>https://community.esri.com/t5/python-questions/number-of-no-nodata-cells-in-raster/m-p/626354#M48829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You might be able to use the bincount() function on numpy to do what you are looking for:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.bincount.html"&gt;http://docs.scipy.org/doc/numpy/reference/generated/numpy.bincount.html&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;the values have to be non-negative though.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jan 2012 09:53:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/number-of-no-nodata-cells-in-raster/m-p/626354#M48829</guid>
      <dc:creator>AndrewChapkowski</dc:creator>
      <dc:date>2012-01-12T09:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: number of no NoData cells in raster</title>
      <link>https://community.esri.com/t5/python-questions/number-of-no-nodata-cells-in-raster/m-p/626355#M48830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Check out the IsNull tool in the spatial analyst toolset, it will produce a grid of 0's or 1's, simply open its table to get the cell count.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jan 2012 11:03:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/number-of-no-nodata-cells-in-raster/m-p/626355#M48830</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2012-01-12T11:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: number of no NoData cells in raster</title>
      <link>https://community.esri.com/t5/python-questions/number-of-no-nodata-cells-in-raster/m-p/626356#M48831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If it's an integer raster, you can calculate the number of data cells by summing up COUNT in the raster table and subracting it from rows * columns. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For floating grids, you must convert the cells to 0/1 with IsNull and sniff the COUNT value from the output raster RAT (I'd do that with a cursor for a table view generated for VALUE = 1).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jan 2012 15:51:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/number-of-no-nodata-cells-in-raster/m-p/626356#M48831</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2012-01-12T15:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: number of no NoData cells in raster</title>
      <link>https://community.esri.com/t5/python-questions/number-of-no-nodata-cells-in-raster/m-p/626357#M48832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks a lot, all of you&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jan 2012 07:31:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/number-of-no-nodata-cells-in-raster/m-p/626357#M48832</guid>
      <dc:creator>martinmaretta</dc:creator>
      <dc:date>2012-01-13T07:31:12Z</dc:date>
    </item>
  </channel>
</rss>

