<?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: Raster calculator: Python script from Model Builder: Does not work in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/raster-calculator-python-script-from-model-builder/m-p/572647#M44894</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I know this is an outdated post, but I am really keen to know if anyone can help with it. I am having now exactly the same question.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 Jul 2013 05:40:59 GMT</pubDate>
    <dc:creator>AlexChen</dc:creator>
    <dc:date>2013-07-26T05:40:59Z</dc:date>
    <item>
      <title>Raster calculator: Python script from Model Builder: Does not work</title>
      <link>https://community.esri.com/t5/python-questions/raster-calculator-python-script-from-model-builder/m-p/572646#M44893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Following script imported from Model builder. I want run it for other states,&amp;nbsp; it did not work. If python does not support&amp;nbsp; "arcpy.gp.RasterCalculator_sa" funtion, if there any away to perform following expresion using a python script? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Raster calculator expresion: Con("ia_corn" == 1,"soilmu_in_90")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Where ia_corn is a binary gird ( 1 and 0) and soilmi_in_90 an interger grid.&amp;nbsp; I want to import values from soilmi_in_90&amp;nbsp; to ia_corn. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# ---------------------------------------------------------------------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# cornMUKEY.py&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Created on: 2011-08-19 15:54:25.00000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#&amp;nbsp;&amp;nbsp; (generated by ArcGIS/ModelBuilder)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Description: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# ---------------------------------------------------------------------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Import arcpy module&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Check out any necessary licenses&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.CheckOutExtension("spatial")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Local variables:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;in_corn ="K:\\CropLand\\STATE.gdb\\in_corn"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;soilmu_in_90 = "K:\\STATE_ MUKEY\\RASTER.gdb\\soilmu_in_90"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;csoilmu_in = "K:\\STATE_ MUKEY\\CORN_MUKEY.gdb\\csoilmu_in"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Raster Calculator&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.gp.RasterCalculator_sa("Con(\"%in_corn%\" == 1,\"%soilmu_in_90%\")", csoilmu_in)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print arcpy.GetMessages&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Warning (from warnings module):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SyntaxWarning: import * only allowed at module level&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "K:\SCRIPT\Python_Script\cornMUKEY.py", line 21, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.gp.RasterCalculator_sa("Con(\"%in_corn%\" == 1,\"%soilmu_in_90%\")", csoilmu_in)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\_base.py", line 474, in &amp;lt;lambda&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return lambda *args: val(*gp_fixargs(args))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: ERROR 000539: Error running expression: rcexec() &amp;lt;type 'exceptions.RuntimeError'&amp;gt;: ERROR 000732: Input Raster: Dataset %soilmu_in_90% does not exist or is not supported&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (RasterCalculator).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Aug 2011 19:05:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/raster-calculator-python-script-from-model-builder/m-p/572646#M44893</guid>
      <dc:creator>ZiaAhmed</dc:creator>
      <dc:date>2011-08-19T19:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: Raster calculator: Python script from Model Builder: Does not work</title>
      <link>https://community.esri.com/t5/python-questions/raster-calculator-python-script-from-model-builder/m-p/572647#M44894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I know this is an outdated post, but I am really keen to know if anyone can help with it. I am having now exactly the same question.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2013 05:40:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/raster-calculator-python-script-from-model-builder/m-p/572647#M44894</guid>
      <dc:creator>AlexChen</dc:creator>
      <dc:date>2013-07-26T05:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: Raster calculator: Python script from Model Builder: Does not work</title>
      <link>https://community.esri.com/t5/python-questions/raster-calculator-python-script-from-model-builder/m-p/572648#M44895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Note:The Raster Calculator tool is intended for use in the ArcGIS for Desktop application only as a GP tool dialog box or in ModelBuilder. It is not intended for use in scripting and is not available in the ArcPy Spatial Analyst module.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Note:In Python, Map Algebra expressions should be created and executed with the Spatial Analyst module, which is an extension of the ArcPy Python site package.&lt;BR /&gt;&lt;BR /&gt;See Map Algebra in Spatial Analyst to learn about how to perform your analysis in Python.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00p600000002000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//00p600000002000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2013 19:30:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/raster-calculator-python-script-from-model-builder/m-p/572648#M44895</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2013-07-29T19:30:08Z</dc:date>
    </item>
  </channel>
</rss>

