ENVIRaster::Save

This method closes the ENVIRaster for writing and converts it to read-only mode. After calling Save, the ENVIRaster is still available for display and for accessing data as input for processing.

Note: You must call Save when you are finished writing data to the new raster, or the resulting ENVIRaster object will be left in an incomplete state (you can not display it or retrieve data from it).

Saving an ENVIRaster overwrites any associated auxiliary files such as pyramid files (.enp) that are automatically created.

Example

; Launch the application

e = ENVI()

 

; Create an ENVIRaster

file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $

SUBDIRECTORY = ['data'])

raster = e.OpenRaster(file)

 

; Create an output raster that contains a single band from original

newFile = e.GetTemporaryFilename()

 

; Retrieve data from original raster

origData = raster.GetData(BANDS=0)

 

; Create raster and save it in newFile

newRaster = ENVIRaster(origData, URI=newFile, NBANDS=1)

newRaster.Save

 

; Display new data

view = e.GetView()

layer = view.CreateLayer(newRaster)

Syntax

ENVIRaster.Save [, ERROR=variable]

Keywords

Keywords are applied only during the initial creation of the object.

ERROR

Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.

When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.

See Manage Errors for more information on error handling in ENVI programming.

HIDDEN (optional)

Set this keyword if you do not want the resulting raster to be added to the Data Manager after it has been saved. If you do not set this keyword, the default behavior is to add it.

Version History

ENVI 5

Introduced

ENVI 5.4.2

Added HIDDEN keyword

API Version

4.2

See Also

ENVIRaster, ENVIRaster::Close, ENVIRaster::SetData, ENVIRaster::SetTile