I am trying to extract monthly layers from a multi-year stack and then re-stack them by month. I am using make raster layer to make temporary layers and append them to a list to use Composite Bands tool for re-stacking. However, it appears that the composite band tool does not recognize the input (ERROR 000732: Input Rasters: Dataset ... does not exist or is not supported). I used a similar method to create temporary layers before, however not from a stack but from a list of individual files, the composite band tool recognized the input and functioned well.

How can I identify the problem?

import arcpy, os
arcpy.env.workspace = 'D:/GIMMSdata'
from arcpy.sa import *
arcpy.CheckOutExtenstion = 'Spatial' 

list_NDVI = []

for i in range(1, 205, 12):
    lyrName = 'GimmsNDVI' + str(i) + '.tif' + '_temp'
    list_NDVI.append(arcpy.MakeRasterLayer_management('D:/GIMMSdata/GIMMS50N.tif',lyrName, '', '', i))
    i = i + 12

arcpy.CompositeBands_management(list_NDVI, 'd:/GIMMSdata/GimmsNDVIJan.dat')
  • 1
    Why bother with layers? Also I don't think .dat file is legit extension for raster. – FelixIP Sep 23 '17 at 5:53
  • @FelixIP .dat format is eligible output format as I tried with another project. The problem I am having is the composite band input since it does not recognize the list I created. I am trying to extract data from a 204 band stack which was created with 17 year's monthly data ascending sequence. I am trying to create all Jan, Feb, Mar, etc stacks hopefully with this loop but it's not working. Do you have any insights on solving this, preferably through ArcGIS or ENVI? Your help is greatly appreciated! – Ruby Sep 24 '17 at 0:02
  • Create layer as separate line of code and append lyrName to list. Make lyrName less funcy, e.g. str(i) .zfill(3) – FelixIP Sep 24 '17 at 1:14

By using this script:

import arcpy
from arcpy import env
env.overwriteOutput = True
layersList = []
for i in range(3):
    lyrName = 'GRID%s' %str(i).zfill(2)
    arcpy.MakeRasterLayer_management(source,lyrName, "", "", i+1)
arcpy.CompositeBands_management(layersList, 'C:/FELIX_DATA/three_Bands.dat')
for item in layersList:arcpy.Delete_management(item)

I managed succesfully extract individual bands from 3 bands raster and restore original source image but in dat format.

Try to follow above structure and see if it will help.

Out of curiosity if you extract any band from your source using GUI from current mxd, what type is this band? Is it "unsigned integer" or something else? NDVI in raster name sounds a wee bit alarming.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.