<?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: Batch process to find nodata values = 0 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/batch-process-to-find-nodata-values-0/m-p/356926#M28098</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If they are multiple bands what are your no data values you are looking for? 0,0,0?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Apr 2014 16:10:28 GMT</pubDate>
    <dc:creator>MathewCoyle</dc:creator>
    <dc:date>2014-04-23T16:10:28Z</dc:date>
    <item>
      <title>Batch process to find nodata values = 0</title>
      <link>https://community.esri.com/t5/python-questions/batch-process-to-find-nodata-values-0/m-p/356921#M28093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am wondering if it is possible to query a directory, returning results of any raster that has no data values of 0. I have been building mosaics, making the nodata values = 1. However, some have been built with nodata values= 0. Is there a way to find these 0 values without checking each one individually?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any and all input.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 14:33:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-process-to-find-nodata-values-0/m-p/356921#M28093</guid>
      <dc:creator>NathanWest1</dc:creator>
      <dc:date>2014-04-23T14:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: Batch process to find nodata values = 0</title>
      <link>https://community.esri.com/t5/python-questions/batch-process-to-find-nodata-values-0/m-p/356922#M28094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Check if the ANYNODATA or ALLNODATA properties of GetRasterPorperties_management will do what you want:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//0017000000m7000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//0017000000m7000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is an exmple of running thru the Default.gdb on my system and reporting the raster name and ANYNODATA value&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

ws = r'H:\Documents\ArcGIS\Default.gdb'
arcpy.env.workspace = ws
rasters = arcpy.ListRasters()
for raster in rasters:
&amp;nbsp;&amp;nbsp;&amp;nbsp; nodatval = arcpy.GetRasterProperties_management(raster, "ANYNODATA")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print str(raster) + " NoData = " + str(nodatval)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
sys.exit()

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:41:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-process-to-find-nodata-values-0/m-p/356922#M28094</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-11T16:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: Batch process to find nodata values = 0</title>
      <link>https://community.esri.com/t5/python-questions/batch-process-to-find-nodata-values-0/m-p/356923#M28095</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If they are single band rasters this should work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;desc = arcpy.Describe(raster)
desc.noDataValue&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:41:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-process-to-find-nodata-values-0/m-p/356923#M28095</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T16:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: Batch process to find nodata values = 0</title>
      <link>https://community.esri.com/t5/python-questions/batch-process-to-find-nodata-values-0/m-p/356924#M28096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;They are multiple bands. Neither of the above seemed to work. Is there a way to query rasters for pixel values of 0 instead of going the nodata route?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 15:58:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-process-to-find-nodata-values-0/m-p/356924#M28096</guid>
      <dc:creator>NathanWest1</dc:creator>
      <dc:date>2014-04-23T15:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Batch process to find nodata values = 0</title>
      <link>https://community.esri.com/t5/python-questions/batch-process-to-find-nodata-values-0/m-p/356925#M28097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Check if the ANYNODATA or ALLNODATA properties of GetRasterPorperties_management will do what you want:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//0017000000m7000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//0017000000m7000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Here is an exmple of running thru the Default.gdb on my system and reporting the raster name and ANYNODATA value&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

ws = r'H:\Documents\ArcGIS\Default.gdb'
arcpy.env.workspace = ws
rasters = arcpy.ListRasters()
for raster in rasters:
&amp;nbsp;&amp;nbsp;&amp;nbsp; nodatval = arcpy.GetRasterProperties_management(raster, "ANYNODATA")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print str(raster) + " NoData = " + str(nodatval)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
sys.exit()

&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This seems to give me a "nodata = 1" no matter whether the nodata values are 0 or 1. is there a way to query for pixel value? If i could query for pixel values of 0 then that would solve my problems competely. Thanks for the input!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:41:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-process-to-find-nodata-values-0/m-p/356925#M28097</guid>
      <dc:creator>NathanWest1</dc:creator>
      <dc:date>2021-12-11T16:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: Batch process to find nodata values = 0</title>
      <link>https://community.esri.com/t5/python-questions/batch-process-to-find-nodata-values-0/m-p/356926#M28098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If they are multiple bands what are your no data values you are looking for? 0,0,0?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 16:10:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-process-to-find-nodata-values-0/m-p/356926#M28098</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2014-04-23T16:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Batch process to find nodata values = 0</title>
      <link>https://community.esri.com/t5/python-questions/batch-process-to-find-nodata-values-0/m-p/356927#M28099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;If they are multiple bands what are your no data values you are looking for? 0,0,0?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;yes. and would it have to be done from within a GDB?&amp;nbsp; Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 16:16:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-process-to-find-nodata-values-0/m-p/356927#M28099</guid>
      <dc:creator>NathanWest1</dc:creator>
      <dc:date>2014-04-23T16:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: Batch process to find nodata values = 0</title>
      <link>https://community.esri.com/t5/python-questions/batch-process-to-find-nodata-values-0/m-p/356928#M28100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can try searching each band. And no it shouldn't matter if it is in a GDB or not, but I can't speak to every raster format possible. I'm sure some formats don't support this. Give this a try, assuming you are dealing with bands 1,2,3.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;bands = ['Band_1', 'Band_2', 'Band_3']
for band in bands:
&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(os.path.join(raster, band))
&amp;nbsp;&amp;nbsp;&amp;nbsp; desc.noDataValue&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:41:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-process-to-find-nodata-values-0/m-p/356928#M28100</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T16:41:47Z</dc:date>
    </item>
  </channel>
</rss>

