<?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 in Arcmap Desktop Python Script in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7457#M42</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/spatial-analyst/extract-by-mask.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/spatial-analyst/extract-by-mask.htm"&gt;Extract by Mask—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;no clue what water_body_feature_class is&lt;/P&gt;&lt;P&gt;no clue what WaterMask is&lt;/P&gt;&lt;P&gt;and why you have 3 parameters and there are only 2 listed in the help for ArcGIS Pro.&lt;/P&gt;&lt;P&gt;Check the code samples towards the end of the help topic.&lt;/P&gt;&lt;P&gt;also, saving to the root of a folder isn't a wise idea, you are generally better off saving to a folder therein&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Dec 2019 07:21:22 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2019-12-30T07:21:22Z</dc:date>
    <item>
      <title>Raster Calculator in Arcmap Desktop Python Script</title>
      <link>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7452#M37</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a model builder in ARCMap desktop 10.5 which is executing fine. I have converted it to python script to make a batch script. But at the last step, where I am using raster calculator in model builder, getting an error. The line is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #242729; background-color: #f4eaea;"&gt;arcpy.gp.RasterCalculator_sa(constant_raster * float(value), rastercalc)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #242729; background-color: #f4eaea;"&gt;(where value is a variable and&amp;nbsp;&lt;SPAN&gt;constant_raster&amp;nbsp;is a raster dataset)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #242729; background-color: #f4eaea;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #242729; background-color: #f4eaea;"&gt;&lt;SPAN&gt;From the link&amp;nbsp;&lt;A class="link-titled" href="https://desktop.arcgis.com/en/arcmap/10.3/tools/spatial-analyst-toolbox/raster-calculator.htm" title="https://desktop.arcgis.com/en/arcmap/10.3/tools/spatial-analyst-toolbox/raster-calculator.htm"&gt;Raster Calculator—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp; I came to know that&amp;nbsp;&lt;SPAN style="background-color: #f4eaea;"&gt;RasterCalculator only function in model builder.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #242729; background-color: #f4eaea;"&gt;&lt;SPAN style="background-color: #f4eaea; "&gt;Is it any other wayaround that I could implement the raster calculator in my script?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #242729; background-color: #f4eaea;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #242729; background-color: #f4eaea;"&gt;&lt;SPAN style="background-color: #f4eaea; "&gt;Your response will be highly appreciated.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #242729; background-color: #f4eaea;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #242729; background-color: #f4eaea;"&gt;&lt;SPAN style="background-color: #f4eaea; "&gt;Thanks&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #242729; background-color: #f4eaea;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Dec 2019 06:59:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7452#M37</guid>
      <dc:creator>MudassarAli2</dc:creator>
      <dc:date>2019-12-18T06:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator in Arcmap Desktop Python Script</title>
      <link>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7453#M38</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am sure ArcMap had arithmetic operators equivalent to 'multiply'&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/spatial-analyst/arithmetic-times-operator.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/spatial-analyst/arithmetic-times-operator.htm"&gt;*—Spatial Analyst module | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;check your version of the help for Spatial Analyst and 'Operators' for basic math functionality&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Dec 2019 10:14:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7453#M38</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-12-18T10:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator in Arcmap Desktop Python Script</title>
      <link>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7454#M39</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have read the article but can not found solution. I have a raster dataset which I want to multiply by a constant value, how could i achieve this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Dec 2019 10:01:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7454#M39</guid>
      <dc:creator>MudassarAli2</dc:creator>
      <dc:date>2019-12-20T10:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator in Arcmap Desktop Python Script</title>
      <link>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7455#M40</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;part way down the help link...&lt;/P&gt;&lt;P&gt;Assume your raster is called "elevation" and you want to multiply it by a number (say 0.3048).&amp;nbsp; You do the multiplication, then save it and give it a name.&amp;nbsp; If you want to save it to a *.tif, you would add that extension to the output raster name&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #595959; background-color: #f8f8f8;"&gt;outTimes = Raster(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;"elevation"&lt;/SPAN&gt;&lt;SPAN style="color: #595959; background-color: #f8f8f8;"&gt;) * &lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;0.3048&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #595959; background-color: #f8f8f8;"&gt; outTimes.save(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;"C:/sapyexamples/output/outtimes"&lt;/SPAN&gt;&lt;SPAN style="color: #595959; background-color: #f8f8f8;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Dec 2019 10:40:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7455#M40</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-12-20T10:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator in Arcmap Desktop Python Script</title>
      <link>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7456#M41</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have executed the following&amp;nbsp;&lt;/P&gt;&lt;P&gt;rastercalc=arcpy.sa.Raster(constant_raster_)*&lt;SPAN style="color: #595959; background-color: #f6f6f6;"&gt;0.3048&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;arcpy.gp.ExtractByMask_sa(&lt;SPAN&gt;rastercalc,water_body_feature_class,WaterMask&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;WaterMask.save("H:\\output.tif")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But its giving me an error "AttributeError: 'str' object has no attribute 'save' "&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whats the issue is this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Dec 2019 04:33:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7456#M41</guid>
      <dc:creator>MudassarAli2</dc:creator>
      <dc:date>2019-12-30T04:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator in Arcmap Desktop Python Script</title>
      <link>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7457#M42</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/spatial-analyst/extract-by-mask.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/spatial-analyst/extract-by-mask.htm"&gt;Extract by Mask—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;no clue what water_body_feature_class is&lt;/P&gt;&lt;P&gt;no clue what WaterMask is&lt;/P&gt;&lt;P&gt;and why you have 3 parameters and there are only 2 listed in the help for ArcGIS Pro.&lt;/P&gt;&lt;P&gt;Check the code samples towards the end of the help topic.&lt;/P&gt;&lt;P&gt;also, saving to the root of a folder isn't a wise idea, you are generally better off saving to a folder therein&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Dec 2019 07:21:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7457#M42</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-12-30T07:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator in Arcmap Desktop Python Script</title>
      <link>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7458#M43</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have successfully created the following code which is running fine on my system (Arcmap 10.5)&lt;/P&gt;&lt;P&gt;&lt;A href="https://onlinegdb.com/SkvkqiWeU"&gt;https://onlinegdb.com/SkvkqiWeU&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code is running fine on my system but giving following error on the other system,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Executing: script "G:\image\s.img" "G:\river_splitted" "G:\output"&lt;BR /&gt;Start Time: Tue Jan 07 09:40:43 2020&lt;BR /&gt;Running script script...&lt;BR /&gt;Failed script script...&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt; File "E:\script.py", line 53, in &amp;lt;module&amp;gt;&lt;BR /&gt; arcpy.gp.ExtractMultiValuesToPoints_sa(point_feature, DEM + " elevation", "NONE")&lt;BR /&gt; File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\geoprocessing\_base.py", line 510, in &amp;lt;lambda&amp;gt;&lt;BR /&gt; return lambda *args: val(*gp_fixargs(args, True))&lt;BR /&gt;RuntimeError: Object: Error in executing tool&lt;/P&gt;&lt;P&gt;Failed to execute (script).&lt;BR /&gt;Failed at Tue Jan 07 09:40:45 2020 (Elapsed Time: 2.11 seconds)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2020 06:53:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7458#M43</guid>
      <dc:creator>MudassarAli2</dc:creator>
      <dc:date>2020-01-07T06:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator in Arcmap Desktop Python Script</title>
      <link>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7459#M44</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;has the original question been answered?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Questions have been posed to you for follow up and you haven't responded and nothing seems to have helped.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you script now works on your system and it doesn't on a new machine, then the issue lies in the differences.&lt;/P&gt;&lt;P&gt;You might begin by why you are writing to the root director of a drive... or worse, a thumb drive.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps someone else will pick up this thread and provide further assistance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2020 07:25:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7459#M44</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-01-07T07:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator in Arcmap Desktop Python Script</title>
      <link>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7460#M45</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is the complete script which I have written whose one part I had questioned above. Secondly I am not writing to the root folder, I have just deleted the complete path from the error log.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2020 07:45:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7460#M45</guid>
      <dc:creator>MudassarAli2</dc:creator>
      <dc:date>2020-01-07T07:45:18Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator in Arcmap Desktop Python Script</title>
      <link>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7461#M46</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That examine the simplified path, that may be where the problem lies&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2020 12:26:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7461#M46</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-01-07T12:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator in Arcmap Desktop Python Script</title>
      <link>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7462#M47</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is no issue of the path as the same script is running on one system but gives an error on the second one, which I have mentioned above. Is it any drivers conflict? How could I track it?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jan 2020 07:26:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7462#M47</guid>
      <dc:creator>MudassarAli2</dc:creator>
      <dc:date>2020-01-08T07:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator in Arcmap Desktop Python Script</title>
      <link>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7463#M48</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anyone here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2020 04:47:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/raster-calculator-in-arcmap-desktop-python-script/m-p/7463#M48</guid>
      <dc:creator>MudassarAli2</dc:creator>
      <dc:date>2020-01-09T04:47:13Z</dc:date>
    </item>
  </channel>
</rss>

