- You execute the model using its dialog.
- You execute the model from the command line or a script.
NOTE: By default, ModelBuilder assumes that all derived data (with the exception of In/Out derived data) is considered intermediate, even derived data that is the final result of a model, as shown in the figure below.It's rare that you would want your final output to be deleted, because it means the model has no permanent result. In most cases, these final variables are marked as model parameters, and model parameters cannot be intermediate data. Learn more about model parameters If you want to preserve intermediate data, you have three choices:
- Always run the model from ModelBuilder, since intermediate data is never deleted when the model is run from ModelBuilder. Conversely, never run the model using its dialog, from the command line, or in scripting. This is an impractical solution, since there is nothing to prevent you from running a model using any of these methods.
- Make the data variable a model parameter. Since model parameters are exposed to the user in the tool dialog, the expectation is that they want to preserve the data, so model parameters cannot be flagged as intermediate.
- Remove the intermediate flag by right-clicking the data variable and clicking Intermediate. The intermediate option is unavailable if the data variable is a model parameter, an In/Out data variable, or project data.
Auto-generated locationsWhen you open a tool from ArcToolbox or inside ModelBuilder and provide the necessary input datasets, the location (the workspace pathname followed by the dataset name) of the derived output data is automatically generated. This auto-generated name is constructed using the following logic:
- The location in the Scratch Workspace environment variable. If this variable is blank, then
- the location of the Current Workspace environment variable. If this variable is blank, then
- the location of the first project data you add to the tool. If this location is read-only, then
- your system temp directory.
Setting the scratch workspaceHere are some things you should be aware of regarding writing intermediate scratch data:
- If the scratch workspace is an ArcSDE workspace, there is additional computational cost communicating with the database. You should always avoid having an ArcSDE connection as your scratch workspace.
- As with any computer application that writes data, you need to have enough space on disk to write the data. Avoid disks that are nearly full.
- If the scratch workspace is somewhere other than a disk on your computer, there is computational overhead involved with writing data across the network.
NOTE: It is recommended that you use a file geodatabase for your scratch workspace.
NOTE: Only tables and feature classes (points, lines, polygons) can be written to the in_memory workspace. The in_memory workspace does not support extended geodatabase elements such as subtypes, domains, representations, topologies, geometric networks and network datasets. Only simple features and tables can be written.To write to your computer's memory, use the pathname in_memory, as follows:
You can think of in_memory as a special geodatabase workspace. You can use in_memory to write intermediate data.
NOTE: Do not set your scratch workspace environment to the in_memory workspace. Use in_memory only for outputs that you know to be simple features and tables.The example below shows using in_memory with the Frequency tool. Rules about using in_memory workspace are
NOTE: Only tables and feature classes (points, lines, polygons) can be written to the in_memory workspace. The in_memory workspace does not support extended geodatabase elements such as subtypes, domains, representations, topologies, geometric networks and network datasets. Only simple features and tables can be written.
- You cannot create feature datasets or folders in the in_memory workspace.
- Data written to memory will be deleted when you exit the application (such as ArcMap or ArcCatalog), so only use in_memory for intermediate (temporary) data.
- You cannot edit or modify features contained in an in_memory feature class.
NOTE: Do not set your scratch workspace environment to the in_memory workspace. Use in_memory only for outputs that you know to be simple features and tables.