Available with Image Analyst license.
The primary raster output of a Image Analyst Map Algebra expression is a Raster object. One of the most important behaviors of a Raster object is that when it is created as primary output from a Map Algebra expression, it references a temporary raster. Temporary data, unless it is explicitly saved, will be removed when the ArcGIS session or script ends.
Saving a temporary raster
A temporary raster can be permanently saved by using the save method on the Raster object. If the temporary data has a layer associated with it, the data can also be saved through the layer's context menu or by saving the map document. These methods of saving are expounded below:
- A temporary raster can be saved by using the save method. In the example below, the temporary output from the Float tool is saved to the specified output folder.
outraster = Float("C:/Data/elevation") outraster.save("C:/output/floatraster")
Where the data is saved depends on what you enter in the save method and what workspace environments you have set.
- When the full path, with dataset name, is specified, then this location is where the permanent data will be saved.
- If only a dataset name is specified, then the location of the saved data is determined by the geoprocessing workspace environments.
- If the scratch or the current workspace is set, then the saved data will be saved to the location of the set workspace.
- If both the current workspace and scratch workspace are set, then the saved data will be saved to the current workspace.
- If no workspace is set, an error will be returned.
- If you simply want to persist the data where it is with its default name, then call the save method without specifying a name, as shown in the example below:
outraster.save()
- To persist a temporary raster dataset associated with a map layer, save the Map Project. When the project is saved, the raster dataset persists to disk at its current location with its auto-generated name.
Interaction of a Raster object, layer, and dataset
A Raster object references a raster dataset and, if used in a map display, can be associated with a raster layer in the table of contents. The relationships between the raster dataset, the Raster object, and the raster layer are maintained in most cases, but it is important to understand these relationships to work productively with Map Algebra.
For more information on the interaction of Raster objects, see The interaction of the raster object in ArcGIS.