<?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/Map Algebra and NumPy? in ArcGIS Runtime SDK for WPF (Retired) Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/raster-calculator-map-algebra-and-numpy/m-p/236405#M1079</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Matthew,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You should be able to put together a script which does the same functionality using some of the math tools or SA math/raster functions to achieve this result. After talking with a colleague on the Spatial Analyst team, she put together a few lines of Python that might get you started on 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; #Checkout SA extension arcpy.CheckOutExtension("Spatial")&amp;nbsp; # May want to set environments Cellsize, extent, snap, and workspaces&amp;nbsp; #Cast datasets as Rasters MAR = Raster("C:/data/meanannurain") #this doesn't actually need to be cast b/c it's used in a GP tool not with operators SEFR = Raster("C:/data/soilerodfact") LS = Raster("C:/data/ls") LCR = Raster("C:/data/landcover")&amp;nbsp; #Universal Soil Loss Equation Result = 0.0012* (Float("MeanAnnualRain") ** 2) * SEFR * LS * LCR&amp;nbsp; #Save the temperary result Result.save("C:/output/result")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For reference, heres the operators you can use in SA on once you've converted to a raster object (as shown in the script):&lt;/SPAN&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.1/index.html#/An_overview_of_the_Map_Algebra_Operators/005m000000mm000000/" rel="nofollow" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#/An_overview_of_the_Map_Algebra_Operators/005m000000mm000000/&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Or if you'd perfer, you can continue using the tools which are supported in the Runtime. The ones you're after live in this toolset here: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.1/index.html#/An_overview_of_the_Math_toolset/009z0000008n000000/" rel="nofollow" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#/An_overview_of_the_Math_toolset/009z0000008n000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hopefully this moves you forward.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Feb 2013 17:26:38 GMT</pubDate>
    <dc:creator>KevinHibma</dc:creator>
    <dc:date>2013-02-28T17:26:38Z</dc:date>
    <item>
      <title>Raster Calculator/Map Algebra and NumPy?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/raster-calculator-map-algebra-and-numpy/m-p/236404#M1078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone suggest an efficient method for replacing the above tools? I have three map algebra equations that expand to over a dozen Math tools (FYI I'm implementing the Universal Soil Loss Equation). I could put these together with a Python script, but I'm not looking forward to that task. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would Numpy be able to accomplish something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;0.0012* Power(float(%Mean Annual Rainfall%),2) * "%soil erodibility factor raster%" * "%LS%" *"%landcover raster%"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Without creating spaghetti code?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2013 04:33:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/raster-calculator-map-algebra-and-numpy/m-p/236404#M1078</guid>
      <dc:creator>MatthewBrown1</dc:creator>
      <dc:date>2013-02-28T04:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator/Map Algebra and NumPy?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/raster-calculator-map-algebra-and-numpy/m-p/236405#M1079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Matthew,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You should be able to put together a script which does the same functionality using some of the math tools or SA math/raster functions to achieve this result. After talking with a colleague on the Spatial Analyst team, she put together a few lines of Python that might get you started on 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; #Checkout SA extension arcpy.CheckOutExtension("Spatial")&amp;nbsp; # May want to set environments Cellsize, extent, snap, and workspaces&amp;nbsp; #Cast datasets as Rasters MAR = Raster("C:/data/meanannurain") #this doesn't actually need to be cast b/c it's used in a GP tool not with operators SEFR = Raster("C:/data/soilerodfact") LS = Raster("C:/data/ls") LCR = Raster("C:/data/landcover")&amp;nbsp; #Universal Soil Loss Equation Result = 0.0012* (Float("MeanAnnualRain") ** 2) * SEFR * LS * LCR&amp;nbsp; #Save the temperary result Result.save("C:/output/result")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For reference, heres the operators you can use in SA on once you've converted to a raster object (as shown in the script):&lt;/SPAN&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.1/index.html#/An_overview_of_the_Map_Algebra_Operators/005m000000mm000000/" rel="nofollow" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#/An_overview_of_the_Map_Algebra_Operators/005m000000mm000000/&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Or if you'd perfer, you can continue using the tools which are supported in the Runtime. The ones you're after live in this toolset here: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.1/index.html#/An_overview_of_the_Math_toolset/009z0000008n000000/" rel="nofollow" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#/An_overview_of_the_Math_toolset/009z0000008n000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hopefully this moves you forward.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2013 17:26:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/raster-calculator-map-algebra-and-numpy/m-p/236405#M1079</guid>
      <dc:creator>KevinHibma</dc:creator>
      <dc:date>2013-02-28T17:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator/Map Algebra and NumPy?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/raster-calculator-map-algebra-and-numpy/m-p/236406#M1080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Kevin,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That looks a lot easier than I thought it would be! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGIS + Python = &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I had to use a couple of intermediate steps for operations like Sin. This didn't work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Z = (math.sin(slope * (3.14 / 180)) / 0.0896) ** 1.3&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(I guess that's where arcpy.RasterToNumPyArray would be useful?)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But this did:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;sinSlope = Sin((slope * (3.14 / 180))) 
Z = (sinSlope / 0.0896) ** 1.3&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:55:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/raster-calculator-map-algebra-and-numpy/m-p/236406#M1080</guid>
      <dc:creator>MatthewBrown1</dc:creator>
      <dc:date>2021-12-11T11:55:26Z</dc:date>
    </item>
  </channel>
</rss>

