AnsweredAssumed Answered

arcpy.sa.ExtractByMask fails for enterprise geodatabase raster

Question asked by flspat on Jun 30, 2016
Latest reply on Jul 5, 2016 by flspat


Hi All,

 

I'm tracking on odd issue that's come up when I moved some code to the production environment. In that environment, the rasters used by the scripts are stored in an enterprise geodatabase.  When running arcpy.sa.ExtractByMask with an input raster from an enterprise geodatabase the following error is thrown:

 

Messages

Executing: ExtractByMask GIS.DATACREATOR.dem watershed C:\...\Default.gdb\Extract_GIS.1

Start Time: Wed Jun 29 14:14:06 2016

ERROR 999999: Error executing function.

The table name is invalid.

No spatial reference exists.

ERROR 010302: Unable to create the output raster: C:\...\Default.gdb\Extract_GIS.1

ERROR 010067: Error in executing grid expression.

Failed to execute (ExtractByMask).

Failed at Wed Jun 29 14:14:19 2016 (Elapsed Time: 13.04 seconds)

 

The stock system toolbox tool (System toolbox\Spatial Analyst Tools\Extraction\Extract By Mask) generates the same error. 

 

It appears that this is caused by the "default output raster name".  In this case, that string is 'Extract_GIS.1' - which is an illegal raster name.  This is the typical GP default value: part tool name, part input dataset name.  Since the input raster is from a database, it's name is fully qualified (database.schema.table): GIS.DATACREATER.dem and the default text string uses the first four characters including the dot character ".".  It's unclear why the default name is not being checked as a valid name for the workspace... this seems to happen everywhere else in the stock GP tools.

 

So...in the stock tool, modifying the default output name to something valid allows the tool to run correctly.  BUT the arcpy.sa.ExtractByVersion does not take an "output dataset parameter".  It only takes the input raster and mask features. It then creates some default scratch raster which, in the examples, is later saved to a specific name using the raster.Save() method.  But b/c the default name is invalid, this arcpy function can never complete successfully if the input raster is from an enterprise geodatabase.  Ugh.

 

Things I've tried:

1. creating a layer file for the input raster with a clean name... the function still tries to use the FQN as the base for the default output name and fails

2. Changing the scratch workspace to a folder rather than the file geodatabase... Same name issue occurs with slightly different message but the file based name is still invalid as well....Again why is an invalid default name being chosen?

 

Why is the method signature of stock toolbox tool and arcpy version different?

Outcomes