<?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: Map Algebra statement to interpolate between two rasters in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/map-algebra-statement-to-interpolate-between-two/m-p/219887#M16953</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;What doesn't work, what's the error message?&lt;BR /&gt;You may want to try a double "\" when you save the output.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the very descriptive error I am getting:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;&amp;lt;type 'exceptions.RuntimeError'&amp;gt;: UNKNOWN&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried the double "\\" and it did not make a difference.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I should note that I simplified my equation just to test the map algebra and I was able to get a simple raster addition to work and save.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Apr 2014 16:16:54 GMT</pubDate>
    <dc:creator>BenRufenacht</dc:creator>
    <dc:date>2014-04-16T16:16:54Z</dc:date>
    <item>
      <title>Map Algebra statement to interpolate between two rasters</title>
      <link>https://community.esri.com/t5/python-questions/map-algebra-statement-to-interpolate-between-two/m-p/219884#M16950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am having some trouble converting a script I wrote for 9.3 to 10.0 using Map Algebra.&amp;nbsp; It is a linear interpolation between two rasters on a log-linear scale.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the 9.3 code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;gp.SingleOutputMapAlgebra_sa("POW(10 , LOG10(4) - %s * (LOG10(4) - LOG10(10)) / (%s - %s))" %(D25, D25, D10), X25, "'';''")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and here is what I have for 10, which does not work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;X25 = Power(((Log10(4)) - Raster("D25") * (Log10(4) - Log10(10)) / (Raster("D25") - Raster("D10")),10)
X25.save(ws + "\X25")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone have any suggestions on what I may be doing wrong?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Apr 2014 22:54:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/map-algebra-statement-to-interpolate-between-two/m-p/219884#M16950</guid>
      <dc:creator>BenRufenacht</dc:creator>
      <dc:date>2014-04-15T22:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: Map Algebra statement to interpolate between two rasters</title>
      <link>https://community.esri.com/t5/python-questions/map-algebra-statement-to-interpolate-between-two/m-p/219885#M16951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What doesn't work, what's the error message?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You may want to try a double "\" when you save the output.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Apr 2014 03:58:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/map-algebra-statement-to-interpolate-between-two/m-p/219885#M16951</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2014-04-16T03:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: Map Algebra statement to interpolate between two rasters</title>
      <link>https://community.esri.com/t5/python-questions/map-algebra-statement-to-interpolate-between-two/m-p/219886#M16952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am unsure if your Power() method is properly formed.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//009z00000097000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//009z00000097000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It takes two parameters but it doesn't look like you are supplying these.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

Power (in_raster_or_constant1, in_raster_or_constant2)

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, I noticed that there is an extra "(" paren char:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

X25 = Power&lt;STRONG&gt;(&lt;/STRONG&gt;((Log10(4)) - Raster("D25") * (Log10(4) - Log10(10)) / (Raster("D25") - Raster("D10")),10)

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:43:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/map-algebra-statement-to-interpolate-between-two/m-p/219886#M16952</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-11T10:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: Map Algebra statement to interpolate between two rasters</title>
      <link>https://community.esri.com/t5/python-questions/map-algebra-statement-to-interpolate-between-two/m-p/219887#M16953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;What doesn't work, what's the error message?&lt;BR /&gt;You may want to try a double "\" when you save the output.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the very descriptive error I am getting:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;&amp;lt;type 'exceptions.RuntimeError'&amp;gt;: UNKNOWN&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried the double "\\" and it did not make a difference.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I should note that I simplified my equation just to test the map algebra and I was able to get a simple raster addition to work and save.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Apr 2014 16:16:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/map-algebra-statement-to-interpolate-between-two/m-p/219887#M16953</guid>
      <dc:creator>BenRufenacht</dc:creator>
      <dc:date>2014-04-16T16:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: Map Algebra statement to interpolate between two rasters</title>
      <link>https://community.esri.com/t5/python-questions/map-algebra-statement-to-interpolate-between-two/m-p/219888#M16954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I am unsure if your Power() method is properly formed.&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//009z00000097000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//009z00000097000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;It takes two parameters but it doesn't look like you are supplying these.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

Power (in_raster_or_constant1, in_raster_or_constant2)

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Also, I noticed that there is an extra "(" paren char:&lt;BR /&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My first parameter is the map algebra statement and the second is the constant 10 to cancel out the log interpolation result.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for pointing out the extra "(".&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:43:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/map-algebra-statement-to-interpolate-between-two/m-p/219888#M16954</guid>
      <dc:creator>BenRufenacht</dc:creator>
      <dc:date>2021-12-11T10:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: Map Algebra statement to interpolate between two rasters</title>
      <link>https://community.esri.com/t5/python-questions/map-algebra-statement-to-interpolate-between-two/m-p/219889#M16955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Now I am thinking that my map algebra is fine.&amp;nbsp; I think my issues may be in how I am stetting the environmental variables.&amp;nbsp; Here is more of the script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import system modules
import arcpy, sys
from arcpy.sa import *

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Set workspace from input
ws = sys.argv[1]
db = sys.argv[2]
arcpy.env.workspace = db
arcpy.env.scratchWorkspace = db

# Set input rasters
D10 = sys.argv[3]
D25 = sys.argv[4]
D50 = sys.argv[5]
D100 = sys.argv[6]
D500 = sys.argv[7]

# Set environment variables from input rasters
arcpy.env.snapRaster = D10
arcpy.env.extent = D10
arcpy.env.outputCoordinateSystem = D10
cord = arcpy.env.outputCoordinateSystem
arcpy.env.cellSize = D10
cs = arcpy.env.cellSize
arcpy.env.overwriteOutput = True


# 10 and 25 Log-Linear Interpolation
#X25 = ws + "\Calc1.gdb\X25"
X25 = Power((Log10(4)) - Raster(D25) * ((Log10(4) - Log10(10)) / (Raster(D25) - Raster(D10))),10)
X25.save(ws + "\X25")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone see anything wrong here?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:43:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/map-algebra-statement-to-interpolate-between-two/m-p/219889#M16955</guid>
      <dc:creator>BenRufenacht</dc:creator>
      <dc:date>2021-12-11T10:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: Map Algebra statement to interpolate between two rasters</title>
      <link>https://community.esri.com/t5/python-questions/map-algebra-statement-to-interpolate-between-two/m-p/219890#M16956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I was able to get it working with the following code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import system modules
import arcpy
from arcpy.sa import *

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Set workspace from input
ws = arcpy.GetParameterAsText(0)
db = arcpy.GetParameterAsText(1)
arcpy.env.workspace = ws
arcpy.env.scratchWorkspace = db

# Set input rasters
D10 = arcpy.GetParameterAsText(2)
D25 = arcpy.GetParameterAsText(3)
D50 = arcpy.GetParameterAsText(4)
D100 = arcpy.GetParameterAsText(5)
D500 = arcpy.GetParameterAsText(6)

# Set environment variables from input rasters
arcpy.env.snapRaster = r"D10"
arcpy.env.extent = r"D10"
arcpy.env.outputCoordinateSystem = r"D10"
#cord = arcpy.env.outputCoordinateSystem
arcpy.env.cellSize = r"D10"
#cs = arcpy.env.cellSize
#arcpy.env.overwriteOutput = True


# 10 and 25 Log-Linear Interpolation Map Algebra
X25 = Power((Log10(4)) - Raster(D25) * ((Log10(4) - Log10(10)) / (Raster(D25) - Raster(D10))),10)
X25.save(ws + "\X25")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:43:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/map-algebra-statement-to-interpolate-between-two/m-p/219890#M16956</guid>
      <dc:creator>BenRufenacht</dc:creator>
      <dc:date>2021-12-11T10:43:46Z</dc:date>
    </item>
  </channel>
</rss>

