<?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: SingleOutputMapAlgebra to v10.0 syntax - lookup() function in a loop? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/singleoutputmapalgebra-to-v10-0-syntax-lookup/m-p/229380#M17781</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I am trying to rewrite some v9.3 SingleOutputMapAlgebra Python code in v10.0. Basically I have a bunch of rasters called "nst_*" (example: nst_lp_1, nst_lp2, nst_lp_3, ...) that have an integer field in their attribute tables called "NST", and I am wanting to produce a single output raster that represents the maximum "NST" value of all the input rasters. In v9.3 this was easy using dot notation and string SOMA string construction... But now in v10 I am running into some issues with the confounded Lookup() tool and how to best do this in an efficient manner. My v9.3 code:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;#Process: Produce a grid that is the max nesting habitat value from all scenarios and all decades
maxString = ""
gp.workspace = root
gridList = gp.listrasters("nst_*")
for grid in gridList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; maxString = maxString + grid + ".NST" + ","
somaExp = "max(" + maxString[:-1] + ")"
maxNestingScoreGrd = root + "\\max_nesting"
gp.SingleOutputMapAlgebra_sa(somaExp, maxNestingScoreGrd, "")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;BTW: I know I have to replace good ole' max() with CellStatistics()... max() is no longer with us.&lt;BR /&gt;&lt;BR /&gt;Basically, I'm looking for an clean way to incorporate the lookup() function in a loop inside another function... Any one have ideas how to do this elegantly in v10.0 synax?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi How are you&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If I am sending this to as&amp;nbsp; a mistake please transfer to right forum.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am new to spatial analyst and I need to create maps using regression in GIS&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;would you able to help me&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jayan&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="mailto:Jayank30@gmail.com" rel="nofollow noopener noreferrer" target="_blank"&gt;Jayank30@gmail.com&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 11:08:59 GMT</pubDate>
    <dc:creator>JayanKarunasinghe</dc:creator>
    <dc:date>2021-12-11T11:08:59Z</dc:date>
    <item>
      <title>SingleOutputMapAlgebra to v10.0 syntax - lookup() function in a loop?</title>
      <link>https://community.esri.com/t5/python-questions/singleoutputmapalgebra-to-v10-0-syntax-lookup/m-p/229378#M17779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to rewrite some v9.3 SingleOutputMapAlgebra Python code in v10.0. Basically I have a bunch of rasters called "nst_*" (example: nst_lp_1, nst_lp2, nst_lp_3, ...) that have an integer field in their attribute tables called "NST", and I am wanting to produce a single output raster that represents the maximum "NST" value of all the input rasters. In v9.3 this was easy using dot notation and string SOMA string construction... But now in v10 I am running into some issues with the confounded Lookup() tool and how to best do this in an efficient manner. My v9.3 code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;#Process: Produce a grid that is the max nesting habitat value from all scenarios and all decades
maxString = ""
gp.workspace = root
gridList = gp.listrasters("nst_*")
for grid in gridList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; maxString = maxString + grid + ".NST" + ","
somaExp = "max(" + maxString[:-1] + ")"
maxNestingScoreGrd = root + "\\max_nesting"
gp.SingleOutputMapAlgebra_sa(somaExp, maxNestingScoreGrd, "")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;BTW: I know I have to replace good ole' max() with CellStatistics()... max() is no longer with us.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Basically, I'm looking for an clean way to incorporate the lookup() function in a loop inside another function... Any one have ideas how to do this elegantly in v10.0 synax?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2012 20:57:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/singleoutputmapalgebra-to-v10-0-syntax-lookup/m-p/229378#M17779</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2012-09-20T20:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: SingleOutputMapAlgebra to v10.0 syntax - lookup() function in a loop?</title>
      <link>https://community.esri.com/t5/python-questions/singleoutputmapalgebra-to-v10-0-syntax-lookup/m-p/229379#M17780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I guess this works, but it's not as pretty and takes longer making all the lookup scratch files.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;gridList = arcpy.ListRasters("nst_*")
i = 0
for grid in gridList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; i = i + 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; tmpGrd = arcpy.sa.Lookup(grid, "NST")
&amp;nbsp;&amp;nbsp;&amp;nbsp; tmpGrd.save("tmp_" + str(i))
gridList = arcpy.ListRasters("tmp_*")
nstMaxGrd = arcpy.sa.CellStatistics(gridList, "MAXIMUM")
nstMaxGrd.save("max_nesting")
for grid in gridList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(grid)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:08:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/singleoutputmapalgebra-to-v10-0-syntax-lookup/m-p/229379#M17780</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2021-12-11T11:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: SingleOutputMapAlgebra to v10.0 syntax - lookup() function in a loop?</title>
      <link>https://community.esri.com/t5/python-questions/singleoutputmapalgebra-to-v10-0-syntax-lookup/m-p/229380#M17781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I am trying to rewrite some v9.3 SingleOutputMapAlgebra Python code in v10.0. Basically I have a bunch of rasters called "nst_*" (example: nst_lp_1, nst_lp2, nst_lp_3, ...) that have an integer field in their attribute tables called "NST", and I am wanting to produce a single output raster that represents the maximum "NST" value of all the input rasters. In v9.3 this was easy using dot notation and string SOMA string construction... But now in v10 I am running into some issues with the confounded Lookup() tool and how to best do this in an efficient manner. My v9.3 code:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;#Process: Produce a grid that is the max nesting habitat value from all scenarios and all decades
maxString = ""
gp.workspace = root
gridList = gp.listrasters("nst_*")
for grid in gridList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; maxString = maxString + grid + ".NST" + ","
somaExp = "max(" + maxString[:-1] + ")"
maxNestingScoreGrd = root + "\\max_nesting"
gp.SingleOutputMapAlgebra_sa(somaExp, maxNestingScoreGrd, "")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;BTW: I know I have to replace good ole' max() with CellStatistics()... max() is no longer with us.&lt;BR /&gt;&lt;BR /&gt;Basically, I'm looking for an clean way to incorporate the lookup() function in a loop inside another function... Any one have ideas how to do this elegantly in v10.0 synax?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi How are you&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If I am sending this to as&amp;nbsp; a mistake please transfer to right forum.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am new to spatial analyst and I need to create maps using regression in GIS&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;would you able to help me&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jayan&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="mailto:Jayank30@gmail.com" rel="nofollow noopener noreferrer" target="_blank"&gt;Jayank30@gmail.com&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:08:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/singleoutputmapalgebra-to-v10-0-syntax-lookup/m-p/229380#M17781</guid>
      <dc:creator>JayanKarunasinghe</dc:creator>
      <dc:date>2021-12-11T11:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: SingleOutputMapAlgebra to v10.0 syntax - lookup() function in a loop?</title>
      <link>https://community.esri.com/t5/python-questions/singleoutputmapalgebra-to-v10-0-syntax-lookup/m-p/229381#M17782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;"I am new to spatial analyst and I need to create maps using regression in GIS&lt;BR /&gt;would you able to help me"&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That is a pretty tall order there... but here's something to get you started: &lt;/SPAN&gt;&lt;STRONG&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//005p00000023000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//005p00000023000000&lt;/A&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You might want to check out these forums instead:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/forums/110-Spatial-Statistics"&gt;http://forums.arcgis.com/forums/110-Spatial-Statistics&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/forums/107-Spatial-Analyst"&gt;http://forums.arcgis.com/forums/107-Spatial-Analyst&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/forums/100-Geostatistical-Analyst"&gt;http://forums.arcgis.com/forums/100-Geostatistical-Analyst&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Sep 2012 15:17:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/singleoutputmapalgebra-to-v10-0-syntax-lookup/m-p/229381#M17782</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2012-09-21T15:17:22Z</dc:date>
    </item>
  </channel>
</rss>

