AnsweredAssumed Answered

ArcGIS 10.4.1 arcpy - Has Raster Attribute Table been built?

Question asked by myESRIUName on Sep 11, 2018
Latest reply on Sep 11, 2018 by myESRIUName

I have an arcpy script that I run in ArcGIS Catalog 10.4.1. The code creates a raster attribute table for a raster; a step which takes a couple of minutes to execute. Subsequent to that step, fields from a feature class are joined to it.


In an effort to make the code faster, I would like to check if the raster attribute table has already been created by a previous run and then check if the fields from the feature class have already been appended so I can skip these two processes. I know how to check the fields, but can't figure out how to find out if the RAT has already been built.


If I ListFields on the raster, it tells me that fields exist whether the RAT has been created or not; I imagine because they exist in memory. However, if I assume the existence of fields indicates the RAT exists, when I try to JoinFields, it fails because the RAT doesn't.


If worse comes to worst, I suppose I can try/except to JoinFields and if it fails because it can't find the table, I can build the RAT and then try JoinFields again. However, I am surprised I can't find a way to determine whether it already exists. ListTables doesn't return a RAT even it if does exist.


Is anyone aware of a method for finding out if a Raster Attribute Table has already been built?