I have an ArcMap document open with LandSat images from one day in different bands as rasters. They're named:
LC80541162014003LGN00_B1.TIF
LC80541162014003LGN00_B2.TIF
and so on, B1 through to B9 (bands 1 to 9).
I want to do a calculation on each band and the result of the calculation should be a new raster for each band, with the name of it indicating which band it is. This is what I'm trying, but the string in the output name disallows the process. How do I achieve the same result, get output of TOA_B1, TOA_B2 etc.
import arcpy
from arcpy import env
from arcpy import mapping
from arcpy.sa import *
i = list(range(1,10))
while i<10:
TOAB_ + str(i) = Raster('LC80541162014003LGN00_B' + str(i)+ '.TIF')*2
To be clear, the calculation within it works on its own
Raster('LC80541162014003LGN00_B' + str(i)+ '.TIF')*2
I have simplified the script here for clarity, I know I could do each calculation separately but for various reasons it will be much more efficient to do it in a loop of some kind.