composite bands cannot open input dataset

3014
1
12-08-2012 07:59 AM
KatSuda
New Contributor
Hello,

I have been trying to composite 3 bands and keep getting  this error message:

ExecuteError: ERROR 000271: Cannot open the input datasets
Failed to execute (CompositeBands).

I have run several small tests to see if my names were OK - they seem to be.

I have also tried compositing tiffs, grids in a folder and grids in a file geodatabase.  I get the message every time.  I don't see anything in the CompositeBands description that indicates my parameters are off.

Do any of you have some ideas?

Here is the code:

()

#import system modules
import arcpy, os
from arcpy import env
arcpy.env.workspace = r"C:/FINAL/data.gdb"

#overwrite files with the same name
env.overwriteOutput = True

#list the rasters to be used 
#rasters in the geodatabase that start with 't' are 4-band images
rasters= arcpy.ListDatasets("t*", "Raster")
#rasters that start with ,p, are 4-band PCA results
PCA= arcpy.ListDatasets("p*", "Raster")

#make a combination of bands 1,4 and 2nd PC

for raster in rasters:
    raster1= raster + "/Band_1"
    raster4= raster + "/Band_4"
    r_index= raster[1] + raster[3]   
    for component in PCA:
        p2= (component, "/Band_2")
        print "processing: " + r_index
        outRaster = ("b14p" + r_index)       
        
        if r_index == component[1:3]:
            arcpy.CompositeBands_management("raster1; raster4; p2", outRaster)

            
            
print "Composites complete"

#


Maybe there's a work-around? 

Thanks for any insight.

Kat

edit:  I forgot to say that I am using ArcGIS 10.0 sp1 and that I am running the script as a stand-alone.

Also, I am using Python (IDLE) 2.6.5
Tags (2)
0 Kudos
1 Reply
KatSuda
New Contributor
I happened across the answer to this after giving up and trying something else.  It turns out that the map document I was re-using over and over for my tests had long ago had a scratch space set by me in a different folder.  And I had deleted that folder somewhere along the line.  So, of course the intermediate files didn't exist!

It was a stupid mistake.  I'm posting for any others new to python.  Just one more thing to check when you get that kind of error.

krs
0 Kudos