I'm using 366 band floating point raster data. Each band represents one day's climate data. I need to find a way to select around 100 of these bands (one season) in a manner that will not take years to complete, in order to view statistics for a season rather than a whole year. Is there any way of doing this and then being able to narrow this data down to the county level?
Sounds just like the sort of thing that can be automated in modelbuilder, what have you tried?
Here's how you can combine a sample of random raster bands into a new raster using Python. This assumes your bands are named "Band_1", "Band_2", etc. Change the numbers to suit your data - I don't have a 366 band raster to play with.
>>> import os, random ... bands = [] ... raster = r'C:\junk\comp_rast.tif' ... bandNumList = [] ... for i in range(1,7): # create list from 1 - 6 ... bandNumList.append(i) ... print bandNumList ... random.shuffle(bandNumList) # randomize list ... print bandNumList ... for i in range(3): # loop through first three in list ... bandx = os.path.join(raster,'Band_' + str(bandNumList)) ... bands.append(bandx) # add appropriate band path to list of raster band paths ... print bands ... arcpy.CompositeBands_management(bands,r'C:/junk/three.tif') # create new composite raster ... [1, 2, 3, 4, 5, 6] [3, 1, 2, 6, 4, 5] ['C:\\junk\\comp_rast.tif\\Band_3', 'C:\\junk\\comp_rast.tif\\Band_1', 'C:\\junk\\comp_rast.tif\\Band_2']
I've tried some simple tools involving rasters. spatial analysis, raster creation, raster processing, conversion tools. I'm very unfamiliar with python. I have access to use it, but have never had to do so at this point, so I'm more looking for a tool of some sort.
My example was overly complicated, selecting random bands and combining into one raster, but I don't think you're going to find a tool that does what you want without some customization. Below is code that will calculate the mean value for a range of bands and output that raster.
Python doesn't have to be scary. Just open the Python window in ArcMap and copy/paste. Change the band numbers and raster paths to suit your own needs (just the values after '=' in lines 2 - 5). Text after '#' is a Python comment and will be ignored.
>>> import os # import a library for later ... startBand = 1 # starting band number ... endBand = 5 # end band number ... inputRaster = r'C:\junk\YourInputRaster.tif' # input multiband raster ... outputRaster = r'C:\junk\YourOutputRaster.tif' # output single band raster ... rasterAdder = arcpy.Raster(os.path.join(inputRaster ,'Band_' + str(startBand))) ... for i in range(startBand+1,endBand+1): # loop through bands ... bandx = arcpy.Raster(os.path.join(inputRaster ,'Band_' + str(i))) # add bands together ... rasterAdder += bandx ... meanRaster = rasterAdder/((endBand - startBand) + 1) # calculate mean ... meanRaster.save(outputRaster) # save raster