<?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 Passing variable value into MosaicToNewRaster (python) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/passing-variable-value-into-mosaictonewraster/m-p/203690#M15643</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="line-height: 1.5;"&gt;I have the following for loop which subsets 420 DEM's into 20 DEM's.:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px; margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;for i in range(0,420,21):&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; low = i&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; high = i + 21&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; interval = high / 21&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AK_in = 'str_dems_AK' + str(interval)&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AK_out = 'NED_AK' + str(interval)&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; subset_AK = AK_in + ' = str_dems_AK[' + str(low) + ':' + str(high) + ']'&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exec subset_AK&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="line-height: 1.5; color: #e23d39;"&gt;arcpy.MosaicToNewRaster_management(AK_in, r"H:\dmf\pds\ned\grid\raster_mosaics", AK_out, "", "", "", "1", "", "")&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.BuildPyramids_management(AK_out, "", "", "", "", "", "SKIP_EXISTING") &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px; margin-bottom: .0001pt;"&gt;&lt;SPAN style="line-height: 1.5;"&gt; &lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;which results in the following error:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px; margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; File "H:\NED_BuildPyramids_Mosaic_test.py",&lt;SPAN style="color: #e23d39;"&gt; line 85&lt;/SPAN&gt;, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; arcpy.MosaicToNewRaster_management(AK_in, r"H:\dmf\pds\ned\grid\raster_mosaics", AK_out, "", "", "", "1", "", "")&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 11619, in MosaicToNewRaster&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;ExecuteError: ERROR 000582: Error occurred during execution.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;If I manually run the following command it works so I assume the problem is passing the value of “AK_out” into the mosaic command:&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; arcpy.MosaicToNewRaster_management(AK_in, r"H:\dmf\pds\ned\grid\raster_mosaics",”NED_AK1”, "", "", "", "1", "", "")&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px; margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;If have tried a variety of alternatives but I always get an error so I'm hoping that someone can tell me how to (a) pass the value of &lt;EM&gt;AK_out&lt;/EM&gt; into the mosiac command or (b) if that's not the problem, identify what is causing the eror.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px; margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Thanks,&lt;BR /&gt;Mike.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Oct 2014 17:23:58 GMT</pubDate>
    <dc:creator>MikeKnowles</dc:creator>
    <dc:date>2014-10-23T17:23:58Z</dc:date>
    <item>
      <title>Passing variable value into MosaicToNewRaster (python)</title>
      <link>https://community.esri.com/t5/python-questions/passing-variable-value-into-mosaictonewraster/m-p/203690#M15643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="line-height: 1.5;"&gt;I have the following for loop which subsets 420 DEM's into 20 DEM's.:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px; margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;for i in range(0,420,21):&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; low = i&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; high = i + 21&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; interval = high / 21&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AK_in = 'str_dems_AK' + str(interval)&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AK_out = 'NED_AK' + str(interval)&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; subset_AK = AK_in + ' = str_dems_AK[' + str(low) + ':' + str(high) + ']'&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exec subset_AK&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="line-height: 1.5; color: #e23d39;"&gt;arcpy.MosaicToNewRaster_management(AK_in, r"H:\dmf\pds\ned\grid\raster_mosaics", AK_out, "", "", "", "1", "", "")&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.BuildPyramids_management(AK_out, "", "", "", "", "", "SKIP_EXISTING") &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px; margin-bottom: .0001pt;"&gt;&lt;SPAN style="line-height: 1.5;"&gt; &lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;which results in the following error:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px; margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; File "H:\NED_BuildPyramids_Mosaic_test.py",&lt;SPAN style="color: #e23d39;"&gt; line 85&lt;/SPAN&gt;, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; arcpy.MosaicToNewRaster_management(AK_in, r"H:\dmf\pds\ned\grid\raster_mosaics", AK_out, "", "", "", "1", "", "")&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 11619, in MosaicToNewRaster&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;ExecuteError: ERROR 000582: Error occurred during execution.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;If I manually run the following command it works so I assume the problem is passing the value of “AK_out” into the mosaic command:&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; arcpy.MosaicToNewRaster_management(AK_in, r"H:\dmf\pds\ned\grid\raster_mosaics",”NED_AK1”, "", "", "", "1", "", "")&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px; margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;If have tried a variety of alternatives but I always get an error so I'm hoping that someone can tell me how to (a) pass the value of &lt;EM&gt;AK_out&lt;/EM&gt; into the mosiac command or (b) if that's not the problem, identify what is causing the eror.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px; margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Thanks,&lt;BR /&gt;Mike.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 17:23:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/passing-variable-value-into-mosaictonewraster/m-p/203690#M15643</guid>
      <dc:creator>MikeKnowles</dc:creator>
      <dc:date>2014-10-23T17:23:58Z</dc:date>
    </item>
  </channel>
</rss>

