<?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 getRasterProperties as variable in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/getrasterproperties-as-variable/m-p/464157#M36370</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm trying to convert some 16 bit raster images to 8 bit.&amp;nbsp; What I have done is saved my image files as ESRI GRIDS.&amp;nbsp; I'll then planing on cycling through each band and scaling them to fit between 0-255.&amp;nbsp; To do this, I need to store the min and max values from each band as a variable to use in some mathmatical functions.&amp;nbsp; The min value for this exzample is "0" and the max is "9269".&amp;nbsp; I get an error &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;on the "b1plus" calcualtion stating "ERROR 000732: Input Raster: Dataset 0 does not exist or is not supported".&amp;nbsp; The correct values are getting stored in "b1min" and "b1max".&amp;nbsp; the calculation for "b1Numerator" works fine.&amp;nbsp; doesn't like any of the calculations that involve the variables "b1min" or b1max".&amp;nbsp; Any ideas out there?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wade&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
 b1min = (arcpy.GetRasterProperties_management("tempc1", "MINIMUM"))
 b1max = (arcpy.GetRasterProperties_management("tempc1", "MAXIMUM"))
 b1plus = arcpy.sa.Plus("tempc1", b1min)
 b1Numerator = arcpy.sa.Times(b1plus, 255)
 b1Denominator = arcpy.sa.Plus(b1max, b1min)
 b1Int = arcpy.sa.Int(arcpy.sa.Divide(b1Numerator, b1Denominator))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
 b1Int.save("band1.tif")
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Aug 2011 17:22:27 GMT</pubDate>
    <dc:creator>WadeGivens</dc:creator>
    <dc:date>2011-08-29T17:22:27Z</dc:date>
    <item>
      <title>getRasterProperties as variable</title>
      <link>https://community.esri.com/t5/python-questions/getrasterproperties-as-variable/m-p/464157#M36370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm trying to convert some 16 bit raster images to 8 bit.&amp;nbsp; What I have done is saved my image files as ESRI GRIDS.&amp;nbsp; I'll then planing on cycling through each band and scaling them to fit between 0-255.&amp;nbsp; To do this, I need to store the min and max values from each band as a variable to use in some mathmatical functions.&amp;nbsp; The min value for this exzample is "0" and the max is "9269".&amp;nbsp; I get an error &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;on the "b1plus" calcualtion stating "ERROR 000732: Input Raster: Dataset 0 does not exist or is not supported".&amp;nbsp; The correct values are getting stored in "b1min" and "b1max".&amp;nbsp; the calculation for "b1Numerator" works fine.&amp;nbsp; doesn't like any of the calculations that involve the variables "b1min" or b1max".&amp;nbsp; Any ideas out there?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wade&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
 b1min = (arcpy.GetRasterProperties_management("tempc1", "MINIMUM"))
 b1max = (arcpy.GetRasterProperties_management("tempc1", "MAXIMUM"))
 b1plus = arcpy.sa.Plus("tempc1", b1min)
 b1Numerator = arcpy.sa.Times(b1plus, 255)
 b1Denominator = arcpy.sa.Plus(b1max, b1min)
 b1Int = arcpy.sa.Int(arcpy.sa.Divide(b1Numerator, b1Denominator))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
 b1Int.save("band1.tif")
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Aug 2011 17:22:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getrasterproperties-as-variable/m-p/464157#M36370</guid>
      <dc:creator>WadeGivens</dc:creator>
      <dc:date>2011-08-29T17:22:27Z</dc:date>
    </item>
  </channel>
</rss>

