Select to view content in your preferred language

Classification failing in ArcPy script, returning Failed to read a pixel block.

311
2
09-16-2024 01:54 PM
StevenDiFalco1
Occasional Contributor

Hi All, I've been running into an issue that I cannot seem to diagnose. I'm looping through a folder of imagery, mosaicking the imagery, segmenting, classifying (step currently failing), and then vectorizing. The naming of the files all ties to the folder name, which was the easiest way for me to keep things organized and run one town at a time. I tried running at a whole county but my computer could not handle that. 

As reference, the .ecd file was created in ArcPro through the Image Classification Wizard run on imagery with the same attributes as the current inputs. When I run on a folder full of different imagery, some of the towns fail to run while others work perfectly. I cannot figure out why this is occurring.

Attached is the full code. Also attached the output results of another example with both successful and unsuccessful runs; some completed the classification other failed after segmentation. Any suggestions would be helpful. I've tried on three different machines (32 & 64 RAM if relevant) with varying specs on them, with similar results. 

Error comes out with this, and seems to attempt to try running again but also failing. Many thanks to any ideas!

 

 

Process started at: 2024-09-16 15:27:09.294956
Classifying raster for folder twn_Colonie_sp21
Error executing tool for folder twn_Colonie_sp21: ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds.
Failed to read a pixel block.
Failed to read a pixel block.
Failed to read a pixel block. [IRasterCursor::Next()]
Function Read Error [Raster Function Template]
Function Read Error [Mosaic Function]
Failed to read a pixel block.
Failed to read a pixel block.
Failed to read a pixel block.
Failed to read a pixel block. [IRasterCursor::Next()]
Function Read Error [Raster Function Template]
Function Read Error [Mosaic Function]
Failed to read a pixel block.
Failed to execute (ClassifyRaster).

Start Time: Monday, September 16, 2024 3:27:11 PM
WARNING 002087: Inter index raster not found with segmented raster. Need to compute it as a temporary raster.
Distributing operation across 10 parallel instances.
ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds.
Failed to read a pixel block.
Failed to read a pixel block.
Failed to read a pixel block. [IRasterCursor::Next()]
Function Read Error [Raster Function Template]
Function Read Error [Mosaic Function]
Failed to read a pixel block.
Failed to read a pixel block.
Failed to read a pixel block.
Failed to read a pixel block. [IRasterCursor::Next()]
Function Read Error [Raster Function Template]
Function Read Error [Mosaic Function]
Failed to read a pixel block.
Failed to execute (ClassifyRaster).
Failed at Monday, September 16, 2024 4:19:36 PM (Elapsed Time: 52 minutes 25 seconds)

 

0 Kudos
2 Replies
DuncanHornby
MVP Notable Contributor

Looking at your log it seems to me it errors when the tool tries to distribute the work across the cores of your CPU. How about running the code with parallel processing turned off?

0 Kudos
StevenDiFalco1
Occasional Contributor

Thanks Duncan, great suggestion. I'll have to give that a try next time. I'm worried it may slow down processing significantly if I remove that, but your point stands if it functions it's worth it. 

I'll add that including Exclude Duplicates from the AddRastersToMosaic step and had success running the code. Not sure if that has any relevance but it worked on that run. 
Thanks again!

0 Kudos