Scratch Workspace?

Discussion created by BrokenLegMike on Feb 27, 2014
Latest reply on Feb 27, 2014 by curtvprice
I am writing a script and started reading through the docs for creating/setting a scratch workspace. So far, all I am getting out of it is that it is a place for temporal data and that it garantees that the scratch workspace will exist if the tool is to be ported. It will also default to the users temp directory which is definied in os when Arc was installed (or you have changed that location). Before I came across the documentation, I was doing this:

if arcpy.Exists(r"C:\GIS\temp_data.gdb"):


Which seems to me that does the same thing as creating the scratch workspace but also satisfies clearing out the temp data (in my case, that's what I want)

So in a workflow, let's say I wanted:

  1. Clip some feature classes and send output to a temporary workspace

  2. Maybe do some analysis on the clipped data (areas of clipped polygons, buffering, summarizing fields, etc)

  3. Output analysis to a report (excel, word, pdf, etc)

  4. And then have the temp clipped data go away. In my case, the original feature classes are quite dynamic and change on a regular basis, so my report will be considered a "Snaphot in Time"

Can anyone enlighten me as to why I would use a scratch worksapce over this method? Does it speed up performace in some way?

Documentation here

Blog here