Skip to main content
3 of 5
deleted 40 characters in body; edited tags
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Accessing bands in .pix (PCIDSK) file in python/arcpy

I am trying to perform zonal statistics on a single band from a multi-band raster in .pix format.

I have things working great with a tiff file. I am able to access the bands using this code:

desc = arcpy.Describe(inRaster)

for band in desc.children:
    bandName = band.name
    currentBand = inRaster + "\\" + bandName

And then just using bandName as the input raster.

However, this code does not work with my .pix file ("Input value raster: testraster.pix\b does not exist.")

I think I can use the CopyRaster tool to convert the file to tiff format, but this is slow and seems like it should be unnecessary.

Does anyone know if there is an easier/more efficient way?

I've also tried the MakeRasterLayer tool to make a raster layer from a single band. I first tried this in ModelBuilder and it worked great. I extracted the ModelBuilder code to python to ensure I was running it with the exact same parameters, but alas, I get the following error:

ExecuteError: ERROR 010213: Error in reading raster band1. Zonal statistics program failed
ERROR 010067: Error in executing grid expression.
Failed to execute (ZonalStatisticsAsTable).

This is when using the exact same input files and the same tool, so I'm not quite sure why it isn't working.

BruceDoh
  • 511
  • 2
  • 13