<?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: Mosaic to New Raster (too simple, but yet wont work) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/mosaic-to-new-raster-too-simple-but-yet-wont-work/m-p/744512#M57558</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;A fix I saw: you have your variables in quotes, so they won't be interpreted. &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;bathtub = "C:/Temp/dustin.gdb/Coastal_WD_2040"
inRas = "C:/Temp/dustin.gdb/depth_2040"

# using a python list
arcpy.MosaicToNewRaster_management([bathub,inRas],
&amp;nbsp;&amp;nbsp;&amp;nbsp; "C:/Temp/dustin.gdb", "new_test", "#","32_BIT_FLOAT","#", "1", "MAXIMUM", "REJECT")
# this is the "old way" - packing up a ";" delimited string - which will work as well:
arcpy.MosaicToNewRaster_management(bathub + ";" + inRas,
&amp;nbsp;&amp;nbsp;&amp;nbsp; "C:/Temp/dustin.gdb", "new_test", "#","32_BIT_FLOAT","#", "1", "MAXIMUM", "REJECT")
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 07:40:49 GMT</pubDate>
    <dc:creator>curtvprice</dc:creator>
    <dc:date>2021-12-12T07:40:49Z</dc:date>
    <item>
      <title>Mosaic to New Raster (too simple, but yet wont work)</title>
      <link>https://community.esri.com/t5/python-questions/mosaic-to-new-raster-too-simple-but-yet-wont-work/m-p/744510#M57556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Greetings All&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've been stuck on this for most of this evening and would really like to know why its not working.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm doing a MosaicToNewRaster with a bunch of rasters that need to be mosaiced with a particular raster.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All I need is a simple ListRasters to get each raster from the bunch, keep the particular raster in a separate variable, feed the two to the Mosaic tool and it should be sweet.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But no.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At first, the loop script ran without errors, but the results were empty.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I decided to go back to basics and try to get that to work with two fixed variables&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;bathtub = "C:/Temp/dustin.gdb/Coastal_WD_2040"
inRas = "C:/Temp/dustin.gdb/depth_2040"

arcpy.MosaicToNewRaster_management("bathub;inRas","C:/Temp/dustin.gdb", "new_test", "#","32_BIT_FLOAT","#", "1", "MAXIMUM", "REJECT")
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But it keeps returning a generic "ERROR 000582: Error occurred during execution"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I put in the full paths then of course it works...but I need it to loop.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I thought I'd be smart about and get ModelBuilder to show me where I was going wrong.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I built the same two variables and feed it to the tool and it ran with full success.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I exported the model to python script and guess what? it creates the necessary variables but then does not use them in the tool. Instead it uses the full path #ESRIFAIL&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In past readings on this forum, I came across arcpy.Raster() which creates a Raster object from the raster.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried that too...and that didn't work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I subsituted the # for just "" for the optional values and that didn't work either.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried every combination of r"", \ and even // for the file paths but still nothing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2013 10:58:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/mosaic-to-new-raster-too-simple-but-yet-wont-work/m-p/744510#M57556</guid>
      <dc:creator>DustinEdge</dc:creator>
      <dc:date>2013-02-14T10:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: Mosaic to New Raster (too simple, but yet wont work)</title>
      <link>https://community.esri.com/t5/python-questions/mosaic-to-new-raster-too-simple-but-yet-wont-work/m-p/744511#M57557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;**UPDATE**&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I finally found something that worked.....and it really should be more prominent in all the help documentation involving multiple inputs.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyhoo...the arcpy.ValueTable() finally got the script to run.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But surely there is a more straight forward answer to this issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2013 11:41:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/mosaic-to-new-raster-too-simple-but-yet-wont-work/m-p/744511#M57557</guid>
      <dc:creator>DustinEdge</dc:creator>
      <dc:date>2013-02-14T11:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: Mosaic to New Raster (too simple, but yet wont work)</title>
      <link>https://community.esri.com/t5/python-questions/mosaic-to-new-raster-too-simple-but-yet-wont-work/m-p/744512#M57558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;A fix I saw: you have your variables in quotes, so they won't be interpreted. &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;bathtub = "C:/Temp/dustin.gdb/Coastal_WD_2040"
inRas = "C:/Temp/dustin.gdb/depth_2040"

# using a python list
arcpy.MosaicToNewRaster_management([bathub,inRas],
&amp;nbsp;&amp;nbsp;&amp;nbsp; "C:/Temp/dustin.gdb", "new_test", "#","32_BIT_FLOAT","#", "1", "MAXIMUM", "REJECT")
# this is the "old way" - packing up a ";" delimited string - which will work as well:
arcpy.MosaicToNewRaster_management(bathub + ";" + inRas,
&amp;nbsp;&amp;nbsp;&amp;nbsp; "C:/Temp/dustin.gdb", "new_test", "#","32_BIT_FLOAT","#", "1", "MAXIMUM", "REJECT")
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:40:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/mosaic-to-new-raster-too-simple-but-yet-wont-work/m-p/744512#M57558</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-12T07:40:49Z</dc:date>
    </item>
  </channel>
</rss>

