Model Builder and File Names ?

3525
6
01-25-2011 09:44 AM
JoelKinzie
New Contributor
Hello

I have a model that use to work but recently crashed during "Extract by Attributes" function.  It produced the following errors:

Error 010302 (Unable to create output raster) and Error 010067 (Error in executing grid)

I checked the ArcMap Help and it states that I either don't have write permissions to the folder I am storing the rasters in or I lack sufficient memory.  I double checked and I have tons of memory and I have write permissions.

I checked the parameters of the model and everything is fine. When I run the same process outside of model builder it works.

When I change the output file name of the raster the function works within Model Builder. However, if I delete the original raster output and try to use the original name again the function crashes.  It seems to be hung up on the file name that was used for the output at the time of the crash. If I try to use it again the function will not work ?

I have attached several screen shots to illustrate my problem.

Thanks
0 Kudos
6 Replies
FrankVignati
Occasional Contributor II
make sure that you have set the geoprocessing options to overwrite existing outputs

"Overwriting tool output
The Overwrite the outputs of geoprocessing operations check box controls whether tools automatically overwrite any existing output when run. When it is checked, you receive a warning before tool execution that the output exists, but the tool executes and overwrites the output dataset. With this option off, existing outputs are not overwritten, and the tool displays an error, preventing you from executing the tool."
0 Kudos
JonathanCusick
New Contributor II
I've had similar troubles with ModelBuilder not overwriting past files. I have the "Overwrite the outputs of geoprocessing operations" box checked, but regardless, it just adds a "_1" to the end of newly created files.

Is there another way to prompt ModelBuilder to overwrite outputs?
0 Kudos
markdenil
Occasional Contributor III
The best way is to write a script tool to test for the presence of an old output, and explicitly delete it.
Just setting the "Overwrite" environment option is not entirely reliable.
Look up "Using If-Then-Else logic for branching" in the help.

http://blogs.esri.com/esri/arcgis/2011/06/06/modelbuilderifthenelse1/
has some examples of using Calculate Value (which can execute a python test clause)
instead of writing a script tool from scratch....

By the way
if the input is a multi band raster, the output of Extract by Attributes is a GRID Stack.
GRIDs and GRID Stacks are restricted to 9 character names:
'Bob' will work, but not 't1_stream_6'....
0 Kudos
ShitijMehta
Esri Regular Contributor
Hi JoelK,

Were you able to resolve/check if the issue was a output name length? Let me know. Share your input data to the tool if you can. This will help us check the issue more efficiently. Which version of ArcGIS are you using? sp?

Thanks!
0 Kudos
JonathanCusick
New Contributor II
Thanks Mark! I was able to use the minimal python knowledge I have to put together a small script in the calculate value tool to test for the presence of an existing file name. I'm stuck now though because I can't get the delete tool to delete the old file that I want to overwrite. It either deleted the new, incoming version of the file (FCtoCheck) or as it is now, is trying to delete the new output GDB (OutputFGDB).

Is there a way to use the delete tool to finish up the job or should I try to delete the old files using another python script?

Thanks!
0 Kudos
markdenil
Occasional Contributor III
you seem to have the check and delete running in parallel to the new data creation
and then deleting the entire data base anyway....
You need to pass the file name to the 'find and delete' sub routine before starting the 'making a new one' routine

making the running of the 'find and delete' sub routine (whatever the outcome) a precondition for
starting the run of the 'making a new one' part would help.

if arcpy.Exists(dataNameVariable):
    arcpy.Delete_management(dataNameVariable)
else:
    pass
0 Kudos