I have a raster with 4 bands.
I would like to create a new raster (its individual bands called new_band) from this raster (its individual bands called old_band) in with :
new_band1 = old_band1 * 2 new_band2= old_band2 * 4 new_band3= old_band3 * 6 new_band4 = old_band4 * 8
My code is:
import sys, os, math, time import arcpy from arcpy import env from arcpy.sa import * arcpy.CheckOutExtension("spatial") raster = r"D:\IMAGERY.tif" bands = [['band1', 2], ['band2',4],['band3',6], ['band4', 8]] outfolder =r"D:\Radiance" for band in bands: num = band[4:] thisBand = raster + '\\band_' + num Radiance = arcpy.sa.Float(Raster(thisBand)/float(band)) outname = 'B' + num + '.tif' Radiance.save(os.path.join(outfolder,outname)) #and then combine different bands arcpy.CompositeBands_management("D:\Radiance\B1.tif;D:\Radiance\B2.tif;D:\Radiance\B3.tif;D:\Radiance\B4.tif", "D:\CANGIO\Anh_SOPT5\Radiance\compbands.tif")
In this code, I created both images for individual bands and a new raster.
As I just would like to create a new raster file, not rasters of individual bands, how can I do this?