Skip to content

Instantly share code, notes, and snippets.

@amarinelli
Created September 29, 2014 15:35
Show Gist options
  • Save amarinelli/119b2b5aaa0f2b4e57ed to your computer and use it in GitHub Desktop.
Save amarinelli/119b2b5aaa0f2b4e57ed to your computer and use it in GitHub Desktop.
Export all bands of raster imagery to a folder workspace
import arcpy
import os
in_raster = r"C:\gisworkspace\CASES\_DEVELOPMENT\156950\47_072.tif'"
out_folder = r"C:\gisworkspace\CASES\_DEVELOPMENT\156950"
desc = arcpy.Describe(in_raster)
for band in desc.children:
indiv_band = os.path.join(in_raster, band.name)
out_file = os.path.join(out_folder, band.name + '.tif')
arcpy.CopyRaster_management(indiv_band, out_file)
print "done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment