<?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: how to replace RasterCalculator with arcpy in ArcGIS Spatial Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-replace-rastercalculator-with-arcpy/m-p/335253#M4705</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Bert,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Try something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy from arcpy.sa import *&amp;nbsp;&amp;nbsp; # settings (paths to input and output data) rasname1 = "Y:/Path/To/Input/Data.gdb/2010cl3" # edit this rasname2 = "Y:/Path/To/Input/Data.gdb/2013cl5" # edit this rasnameout = "Y:/case13/first/scrap_db.gdb/outputras"&amp;nbsp;&amp;nbsp; # grab a SA license if arcpy.CheckExtension("Spatial") == "Available": &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CheckOutExtension("Spatial") else: &amp;nbsp;&amp;nbsp;&amp;nbsp; exit("No SA license available...")&amp;nbsp;&amp;nbsp; # make Raster objects for easy processing ras1 = arcpy.Raster(rasname1) ras2 = arcpy.Raster(rasname2)&amp;nbsp;&amp;nbsp; # apply math rasout = (Int(ras1 / 10) * 10) + Int(ras2 / 10)&amp;nbsp;&amp;nbsp; # save the result to disk rasout.save(rasnameout)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Nov 2013 08:34:43 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2013-11-25T08:34:43Z</dc:date>
    <item>
      <title>how to replace RasterCalculator with arcpy</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-replace-rastercalculator-with-arcpy/m-p/335252#M4704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello, newbie here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm combining two rasters into an output using the Rastercalculator tool and that work fine, got the tool into modelbuilder and that works great as well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Now I need to do additional steps like looping through more files to repeat the process and prompting the user for some choices so I'm looking into python using arcpy to do the rastermath. I cannot find the syntax to do this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT]arcpy.gp.RasterCalculator_sa("""(Int("2010cl3" / 10) * 10) + (Int("2013cl5" / 10))""","Y:/case13/first/scrap_db.gdb/outputras")[/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;in arcpy. I understand I should not use rastercalculator in python but instead use arcpy.sa, can someone give an example please?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 Nov 2013 09:00:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-replace-rastercalculator-with-arcpy/m-p/335252#M4704</guid>
      <dc:creator>Gisbert61</dc:creator>
      <dc:date>2013-11-24T09:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to replace RasterCalculator with arcpy</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-replace-rastercalculator-with-arcpy/m-p/335253#M4705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Bert,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Try something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy from arcpy.sa import *&amp;nbsp;&amp;nbsp; # settings (paths to input and output data) rasname1 = "Y:/Path/To/Input/Data.gdb/2010cl3" # edit this rasname2 = "Y:/Path/To/Input/Data.gdb/2013cl5" # edit this rasnameout = "Y:/case13/first/scrap_db.gdb/outputras"&amp;nbsp;&amp;nbsp; # grab a SA license if arcpy.CheckExtension("Spatial") == "Available": &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CheckOutExtension("Spatial") else: &amp;nbsp;&amp;nbsp;&amp;nbsp; exit("No SA license available...")&amp;nbsp;&amp;nbsp; # make Raster objects for easy processing ras1 = arcpy.Raster(rasname1) ras2 = arcpy.Raster(rasname2)&amp;nbsp;&amp;nbsp; # apply math rasout = (Int(ras1 / 10) * 10) + Int(ras2 / 10)&amp;nbsp;&amp;nbsp; # save the result to disk rasout.save(rasnameout)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Nov 2013 08:34:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-replace-rastercalculator-with-arcpy/m-p/335253#M4705</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2013-11-25T08:34:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to replace RasterCalculator with arcpy</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-replace-rastercalculator-with-arcpy/m-p/335254#M4706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Xander,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Got a result! thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Nov 2013 00:24:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-replace-rastercalculator-with-arcpy/m-p/335254#M4706</guid>
      <dc:creator>Gisbert61</dc:creator>
      <dc:date>2013-11-26T00:24:05Z</dc:date>
    </item>
  </channel>
</rss>

