The SAVE procedure saves variables, system variables, and IDL routines in a SAVE file using the XDR (eXternal Data Representation) format for later recovery by RESTORE. Note that variables and routines cannot be saved in the same file. Note also that SAVE files containing routines may not be compatible between different versions of IDL, but that files containing data are always backwards-compatible.
.savfor SAVE files. Using the
.savextension has two benefits: it makes it clear to another IDL user that the file contains IDL routines or data that can be restored, and it allows IDL to locate routines with the same base name as the file in SAVE files located in IDL's path.
SAVE [, Var1, ..., Varn] [, /ALL] [, /COMM, /VARIABLES] [, /COMPRESS] [, DESCRIPTION=string] [, FILENAME=string] [, /ROUTINES] [, /SYSTEM_VARIABLES] [, /VERBOSE]
The names of one or more variables that are to be saved. If the ROUTINES keyword is present, the Var arguments should be strings containing the names of the routines to be saved. If no Var arguments are provided, the items specified by the supplied keywords are saved.
Set this keyword to save all common blocks, system variables, and local variables from the current IDL session.
Set this keyword to save all main level common block definitions. Note that setting this keyword does not cause the contents of the common block to be saved unless the VARIABLES keyword is also set.
If COMPRESS is set, IDL writes all data to the SAVE file using the ZLIB compression library to reduce its size. IDL's SAVE file compression support is based on the freely available ZLIB library by Mark Adler and Jean-loup Gailly.
Compressed SAVE files can be restored by the RESTORE procedure in exactly the same manner as any other SAVE file. The only visible differences are that the files will be smaller, and writing and reading them will be somewhat slower under typical conditions.
Set this keyword equal to a string that will be saved in the SAVE file:
SAVE, data, $ DESCRIPTION="Solar Obs: 2452884.9, 40 deg 0' N 105 deg 16' W"
This string can be later recovered using the RESTORE procedure or the IDL_Savefile object class. The ability to associate a descriptive string to a SAVE file can be used by IDL programs to identify data, and can also be used as an aid in managing large collections of data.
A string containing the name of the file into which the IDL objects should be saved. While there are no arbitrary limitations on the name of a file created with the SAVE procedure, RSI recommends that you use the
.sav extension for your files. If this keyword is not specified, the file
idlsave.dat is used.
Set this keyword to save user defined procedures and functions in a machine independent, binary form. If parameters are present, they must be strings containing the names of the procedures and/or functions to be saved. If no parameters are present, all compiled routines are saved. Routines and variables cannot be saved in the same file.
.savfiles containing routines are not guaranteed to be compatible between successive versions of IDL. You will not be able to RESTORE
.savfiles containing routines if they are made with incompatible versions of IDL. In this case, you should recompile your original code with the newer version of IDL. A
.savfile containing data will always be restorable.
Set this keyword to save the current state of all system variables.
Set this keyword to save all variables in the current program unit. This option is the default.
Set this keyword to print an informative message for each saved object.
Save the status of all currently-defined variables in the file
variables1.sav by entering:
SAVE, /VARIABLES, FILENAME = 'variables1.sav'
The variables can be restored with the RESTORE procedure.
Save the user procedures MYPROC and MYFUN:
SAVE, /ROUTINES, 'MYPROC', 'MYFUN', FILENAME = 'myroutines.sav'
DESCRIPTION keyword: 6.1
JOURNAL, RESOLVE_ALL, RESTORE, IDL_Savefile