<?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 attribute error 'str' object has no attribute 'save' in ArcGIS Spatial Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-attribute-error-str-object-has/m-p/40291#M495</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you!&amp;nbsp; I suspected that it was something simple.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Aug 2012 15:19:10 GMT</pubDate>
    <dc:creator>JoannaWhittier</dc:creator>
    <dc:date>2012-08-07T15:19:10Z</dc:date>
    <item>
      <title>raster calculator attribute error 'str' object has no attribute 'save'</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-attribute-error-str-object-has/m-p/40289#M493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am multiplying several .tif files by set values and adding the results together using raster calculator in arcgis 10.1.&amp;nbsp; If I manually load the files into raster calculator, the calculation completes.&amp;nbsp; Unfortunately I need to do this several hundred times so I would like to automate the process.&amp;nbsp; I created a model in model builder (and it worked) and then exported the code to python to see the format.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is that coding&lt;/SPAN&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;BR /&gt;&lt;SPAN&gt;# Local variables:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RT_v4_2027_0_albers_tif = "RT_v4_2027_0_albers.tif"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RT_v4_2027_1_albers_tif = "RT_v4_2027_1_albers.tif"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RT_v4_2027_2_albers_tif = "RT_v4_2027_2_albers.tif"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;rt_sum_2027_100_tif = "Y:\\RT_annual\\rt_sum_2027_100.tif"&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("((\"%RT_v4_2027_0_albers.tif%\" * 31) + (\"%RT_v4_2027_1_albers.tif%\" * 28) + (\"%RT_v4_2027_2_albers.tif%\" * 31)) * 100", rt_sum_2027_100_tif)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As a first step toward automating I then tried to calculate the above for the next set of files using this code:&lt;/SPAN&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;BR /&gt;&lt;SPAN&gt;# Local variables:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RT_v4_2028_0_albers_tif = "Y:\\RT_albers\\RT_v4_2028_0_albers.tif"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RT_v4_2028_1_albers_tif = "Y:\\RT_albers\\RT_v4_2028_1_albers.tif"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RT_v4_2028_2_albers_tif = "Y:\\RT_albers\\RT_v4_2028_2_albers.tif"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rt_sum_2028_100_tif = "Y:\\RT_annual\\rt_sum_2028_100.tif"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.gp.RasterCalculator_sa("((\"%RT_v4_2028_0_albers_tif%\" * 31) + (\"%RT_v4_2028_1_albers_tif%\" * 28) + (\"%RT_v4_2028_2_albers_tif%\" * 31)) * 100", rt_sum_2028_100_tif)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I get the following error whether I run the script in the ArcGIS python window or in IDLE:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error&amp;nbsp; Traceback (most recent call last):&amp;nbsp;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 24, in &amp;lt;module&amp;gt;&amp;nbsp;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\geoprocessing\_base.py", line 498, in &amp;lt;lambda&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return lambda *args: val(*gp_fixargs(args, True)) ExecuteError: ERROR 000539: Error running expression: rcexec()&amp;nbsp; Traceback (most recent call last):&amp;nbsp;&amp;nbsp; File "&amp;lt;expression&amp;gt;", line 1, in &amp;lt;module&amp;gt;&amp;nbsp;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 8, in rcexec AttributeError: 'str' object has no attribute 'save'&amp;nbsp; Failed to execute (RasterCalculator). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why does this script seem to be looking for an attribute called 'save'?&amp;nbsp; Any suggestions would be greatly appreciated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2012 20:35:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-attribute-error-str-object-has/m-p/40289#M493</guid>
      <dc:creator>JoannaWhittier</dc:creator>
      <dc:date>2012-08-02T20:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: raster calculator attribute error 'str' object has no attribute 'save'</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-attribute-error-str-object-has/m-p/40290#M494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;arcpy.gp.RasterCalculator_sa("((\"%RT_v4_2028_0_albers_tif%\" * 31) + (\"%RT_v4_2028_1_albers_tif%\" * 28) + (\"%RT_v4_2028_2_albers_tif%\" * 31)) * 100", rt_sum_2028_100_tif)&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The Raster Calculator tool is designed for use in ModelBuilder only. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For best results, if you are going to do this in Python you should rewrite the expression using &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/What_is_Map_Algebra/00p600000002000000/" rel="nofollow" target="_blank"&gt;Python map algebra.&lt;BR /&gt; &lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# Import arcpy module import arcpy from arcpy.sa import *&amp;nbsp; # Check out any necessary licenses arcpy.CheckOutExtension("spatial")&amp;nbsp; # Local variables: RT_v4_2027_0_albers_tif = "RT_v4_2027_0_albers.tif" RT_v4_2027_1_albers_tif = "RT_v4_2027_1_albers.tif" RT_v4_2027_2_albers_tif = "RT_v4_2027_2_albers.tif"&amp;nbsp; rt_sum_2027_100_tif = "Y:\\RT_annual\\rt_sum_2027_100.tif"&amp;nbsp; rast = (Raster(RT_v4_2027_0_albers_tif) * 31.0 +\ &amp;nbsp; Raster(RT_v4_2027_1_albers_tif) * 28.0 +\ &amp;nbsp; Raster(RT_v4_2027_2_albers_tif)) * 100 rast.save(RT_v4_2027_2_albers_tif)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2012 22:28:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-attribute-error-str-object-has/m-p/40290#M494</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2012-08-06T22:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: raster calculator attribute error 'str' object has no attribute 'save'</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-attribute-error-str-object-has/m-p/40291#M495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you!&amp;nbsp; I suspected that it was something simple.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2012 15:19:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-attribute-error-str-object-has/m-p/40291#M495</guid>
      <dc:creator>JoannaWhittier</dc:creator>
      <dc:date>2012-08-07T15:19:10Z</dc:date>
    </item>
  </channel>
</rss>

