Finding Band Count in Rasters using ArcPy?

المشرف العام

Administrator
طاقم الإدارة
I'm having troubles finding the band count for my raster files using ArcPy.

I need to first list all the raster files in a directory, and then display the band count for each file. I am able to list the files, but when it gets to the band count, it gives me an error stating that Method Band Count does not exist.

The following is what I have for my code so far:

import osimport arcpyarcpy.env.workspace = "C:\\Rasters" # Contains TIFF, IMG, GRID formatsfilePath = arcpy.env.workspacerasterList = arcpy.ListRasters("*", "ALL")desc = arcpy.Describe(filePath)for names in rasterList: print names print desc.bandCountAny ideas where I'm going wrong? I was using the Geoprocessor Programming Model as a reference.



أكثر...
 
أعلى