<?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: Arcpy.renameBand in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/arcpy-renameband/m-p/1149420#M26219</link>
    <description>&lt;P&gt;One side-note I will add for future users is that the script we ended up working with would not work in reference to rasters stored within a file geodatabase. When referring to a raster stored in a standard folder, it was successful.&lt;/P&gt;&lt;P&gt;See below the script used:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;im = r"C:\Users\jhughson\Documents\ArcGIS\Projects\Multiband\Multi_Band.TIF"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rast = arcpy.Raster(im)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;bandnames = [arcpy.Raster(b) for b in arcpy.ListRasters()]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rast.bandNames&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;['Band_1', 'Band_2', 'Band_3', 'Band_4']&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;rast = rast.renameBand('Band_1', 'The_Band')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rast = rast.renameBand('Band_2', 'The_Band2')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rast = rast.renameBand('Band_3', 'The_Band3')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rast = rast.renameBand('Band_4', 'The_Band4')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print(rast.bandNames)&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Mar 2022 02:28:15 GMT</pubDate>
    <dc:creator>JohnHughson</dc:creator>
    <dc:date>2022-03-02T02:28:15Z</dc:date>
    <item>
      <title>Arcpy.renameBand</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/arcpy-renameband/m-p/1146838#M26193</link>
      <description>&lt;P&gt;The function arcpy.renameBand is listed on the following article, however I have also seen mention elsewhere that the tool is not functional within ArcGIS Pro.&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/2.8/arcpy/classes/raster-object.htm" target="_blank" rel="noopener"&gt;Raster—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attempting to use the function yields the following:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AttributeError: module 'arcpy' has no attribute 'renameBand'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Might someone have some advice regarding the usage of this function, and if not, a viable arcpy alternative?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am aware that the "Create Mosaic Dataset" can do this, however it cannot be effectively scaled as I would like the arcpy tool to do.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2022 05:46:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/arcpy-renameband/m-p/1146838#M26193</guid>
      <dc:creator>JohnHughson</dc:creator>
      <dc:date>2022-02-23T05:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy.renameBand</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/arcpy-renameband/m-p/1146903#M26194</link>
      <description>&lt;LI-CODE lang="python"&gt;import arcpy
im = r'C:\Data\rasters\2.png'
rast = arcpy.Raster(im)
rast.bandNames
['Band_1', 'Band_2', 'Band_3', 'Band_4']
# -- now...
rast.renameBand('Band_1', 'The_Band')
['The_Band', 'Band_2', 'Band_3', 'Band_4']&lt;/LI-CODE&gt;&lt;P&gt;you need a raster object and renameBand is a method for that object&lt;/P&gt;&lt;LI-CODE lang="python"&gt;dir(rast)
['RAT',
snip
 'addDimension', 'appendSlices', 'bandCount', 'bandNames', 'bands', 
'blockSize', 'catalogPath', 'compressionType', 'exportImage', 'extent', 
'format', 'functions', 'getBandProperty', 'getColormap', 
'getDimensionAttributes', 'getDimensionNames', 'getDimensionValues', 
'getHistograms', 'getProperty', 'getRasterBands', 'getRasterInfo', 
'getStatistics', 'getVariableAttributes', 'hasRAT', 'hasTranspose', 'height',
 'isInteger', 'isMultidimensional', 'isTemporary', 'maximum', 'mdinfo', 
'mean', 'meanCellHeight', 'meanCellWidth', 'minimum', 'name', 'noDataValue', 
'noDataValues', 'path', 'pixelType', 'properties', 'read', 'readOnly', 
'removeVariables', 'renameBand', 'renameVariable', 'save', 'setBandProperty',
 'setColormap', 'setHistograms', 'setProperty', 'setStatistics', 
'setVariableAttributes', 'slices', 'spatialReference', 'standardDeviation', 
'uncompressedSize', 'variableNames', 'variables', 'vectorize', 'width', 
'write']&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 23 Feb 2022 11:38:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/arcpy-renameband/m-p/1146903#M26194</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-02-23T11:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy.renameBand</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/arcpy-renameband/m-p/1149419#M26218</link>
      <description>&lt;P&gt;Thank you kindly Dan, that was very helpful!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 02:26:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/arcpy-renameband/m-p/1149419#M26218</guid>
      <dc:creator>JohnHughson</dc:creator>
      <dc:date>2022-03-02T02:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy.renameBand</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/arcpy-renameband/m-p/1149420#M26219</link>
      <description>&lt;P&gt;One side-note I will add for future users is that the script we ended up working with would not work in reference to rasters stored within a file geodatabase. When referring to a raster stored in a standard folder, it was successful.&lt;/P&gt;&lt;P&gt;See below the script used:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;im = r"C:\Users\jhughson\Documents\ArcGIS\Projects\Multiband\Multi_Band.TIF"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rast = arcpy.Raster(im)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;bandnames = [arcpy.Raster(b) for b in arcpy.ListRasters()]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rast.bandNames&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;['Band_1', 'Band_2', 'Band_3', 'Band_4']&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;rast = rast.renameBand('Band_1', 'The_Band')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rast = rast.renameBand('Band_2', 'The_Band2')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rast = rast.renameBand('Band_3', 'The_Band3')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rast = rast.renameBand('Band_4', 'The_Band4')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print(rast.bandNames)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 02:28:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/arcpy-renameband/m-p/1149420#M26219</guid>
      <dc:creator>JohnHughson</dc:creator>
      <dc:date>2022-03-02T02:28:15Z</dc:date>
    </item>
  </channel>
</rss>

