Overview of Data Access in IDL
There are several ways to open files and access the data that they contain in IDL.You can open a file using interface elements, or using routines. In order of increasing complexity and flexibility, your options are:
- Accessing files using the IDL Workbench — select Open from the Workbench File menu and browse to select a file. For supported file types, IDL automatically reads the data and creates variables in IDL's main scope. If you select an image file, the Workbench will also automatically display the image in the iImage tool. See Importing Data into the IDL Workbench for details. For information on adding supported file types, see Adding Custom File Readers.
- Accessing files using the IOPEN routine — use the IOPEN routine to open a specified file and create data variables automatically from the IDL command line.
- Accessing data in iTools — select Open from an iTool File menu and browse to select a file. This option automatically displays data (that is a supported type) in the iTool. See Importing and Exporting Data (iTool User's Guide) for details.
- Accessing files using dialogs — launch an IDL dialog and browse to select or save a file. After accessing the file, use an IDL routine to access the data within the file. You can then preform additional data processing task or create a display. See Accessing Files Using IDL Dialogs for details.
- Accessing files programmatically — you can access data without requiring user interaction by using IDL statements in a program or at the command line. This give you the greatest control over the state of data at all times, but requires slightly more programming than the previous option. See Accessing Files Programmatically for details.
There are advantages and disadvantages for each option. When you open a file using File → Open in the iTools, there is no opportunity to do pre-processing on the data. However, the display is created for you, and there are numerous interactive operations available.
You can combine the flexibility of accessing data using routines with the power of an iTool display by using the Visualize Perspective as described in Using the Visualize Perspective or by launching the iTool from the command line as described in Parameter Data and the Command Line (iTool User's Guide). See Accessing Image Data Programmatically and Accessing Non-Image Data Programmatically for examples.