|
Using IDL: Importing and Writing Data into Variables |
|
There are a number of options available for reading non-image data into IDL. Depending upon the file type, consider using one of the following:
| Note These sections describe how to load data into a variable and includes examples of passing variable data to an iTool programmatically. See Importing Data from the IDL Session if you want information on how you can access variable data from the iTools Data Manager. |
The following example uses READ_BINARY to access binary data (head.dat) consisting of a stack of 57 images slices of the human head. After reading the data, create a display using IVOLUME. Enter the following at the IDL command prompt:
file = FILEPATH('head.dat', $
SUBDIRECTORY = ['examples', 'data'])
dataSize = [80,100,57]
volume= READ_BINARY(file, DATA_DIMS = dataSize)
iVolume, volume, /AUTO_RENDER
| Note You can also create a template for binary file access. See Reading Binary Data for options. |
You can also access information from a SAVE file. This example restores a SAVE file containing variable data (marbells.dat), configures the data, and displays it using ICONTOUR.
PRO maroonBellsContour_doc
; Restore Maroon Bells data into the IDL variable "elev".
RESTORE, FILEPATH('marbells.dat', SUBDIR=['examples','data'])
; Create x and y vectors giving the position of each
; column and row.
X = 326.850 + .030 * FINDGEN(72)
Y = 4318.500 + .030 * FINDGEN(92)
; Set missing data points to a large value. Reduce to a
; 72 x 92 matrix.
elev (WHERE (elev EQ 0)) = 1E6
new = REBIN(elev, 360/5, 460/5)
iContour, new, X, Y, C_VALUE = 2750 + FINDGEN(6) * 250.,$
XSTYLE = 1, YSTYLE = 1, YMARGIN = 5, MAX_VALUE = 5000, $
C_LINESTYLE = [1, 0], $
C_THICK = [1, 1, 1, 1, 1, 3], $
XTITLE = 'UTM Coordinates (KM)'
End
| Note See Creating SAVE Files of Programs and Data for complete details on creating and restoring SAVE files. |
IDL Online Help (March 06, 2007)