Table of Contents for Practical IDL Programming (Extended format)

Part of the Practical IDL Programming Web

Foreword by David Stern


Chapter 1: Introduction

Who Should Read This Book?
Why Write This Book?
What About Objects?
Supporting Materials
Typographic Conventions
Special Characters
1.1 About IDL
IDL in Perspective
Obtaining IDL
1.2 Running IDL
On-line Help
1.3 Chapter Outline

Chapter 2: Fundamentals of IDL Syntax

2.1 Interactive and Compiled Modes

Interactive Mode
Compiled Mode
2.2 Variables
Data Types
Keeping Track of Variable Types
Type Conversions
Converting Floats to Integers
Converting between String and Numeric Types
Variable Names
2.3 Introduction to Arrays
Creating Arrays
Array Storage Format
Functions for Creating Arrays
Floating Point Grid Arrays
2.4 Array Indexing
Array Indexing Examples
Multi-dimensional Array Indexing Examples
One-dimensional Indexing
Index Sampling
Multi-dimensional Index Sampling
2.5 Expressions and Arithmetic Operators
Type Conversion in Expressions
Guarding Against Division by an Integer
Operator Precedence
Arithmetic Operations on Arrays
Operator Precedence and Efficiency of Array Operations
Minimum, Maximum, and Modulo Operators
Array and Matrix Multiplication Operators
2.6 Relational and Boolean Operators
Relational Operators
Boolean Operators
not Operator
and Operator
or Operator
xor Operator
Combining Relational and Boolean Operators
Bit Manipulation
2.7 Structures
Anonymous Structures
Arrays of Structures
Named Structures
Working with Structures
2.8 Pointers
Types of Pointers
Creating Pointers
Freeing Pointers
Checking Pointer Validity
Pointer De-Referencing
Avoiding Pointer Problems
2.9 Array Properties
Number of Array Elements
Array Size and Type
Minimum and Maximum Values
Mean, Variance, and Standard Deviation
2.10 Locating Values Within an Array
Finding Values Which Meet Selection Criteria
Working with 1D indices from where
Finding Values Which Don?t Meet Selection Criteria
2.11 Array Reordering
Changing Array Dimensions
Reversing Array Elements
Rotating Arrays
Transposing Arrays
Shifting Arrays
Sorting Arrays
Finding Unique Array Values
2.12 Array Resizing
Resizing by an Integer Factor
Resizing to Arbitrary Size
Resizing to Arbitrary Size with Custom Interpolation
Removing Rows or Columns
Chapter 3: Writing IDL Programs

3.1 Defining and Compiling Programs

Naming and Editing Source Files
Manual Compilation
Automatic Compilation
Returning to the Main Level after an Error
3.2 Control Statements
if Statement
case Statement
for Statement
while Statement
repeat Statement
return Statement
goto Statement
switch Statement
break Statement
continue Statement
3.3 Parameters and Keywords
Using Parameters and Keywords
Argument Passing Mechanism
Extra Keywords
Extra Keyword Precedence
Extra Keyword Passing Mechanism
3.4 Checking Parameters and Keywords
Checking Input Parameters
Don?t Modify Input Parameters
Checking Boolean Keywords
Checking Output Parameters and Keywords
3.5 Scripts, Include Files, and Journaling
Include Files
3.6 Global Variables
Read-only System Variables
Writable System Variables
User-Defined System Variables
Common Blocks
3.7 Error Handling
Intercepting Errors
Math Errors
Resetting the IDL Session
3.8 Efficient Programming
Conserving Memory
Using Efficient Methods
Chapter 4: Input and Output

4.1 Standard Input and Output

Writing to Standard Output
Reading from Standard Input
Free Format Input
Reading from a String
Writing to a String
Legal and Illegal read Arguments
4.2 Working with Files
Opening Files
Selecting a File
Obtaining Information about Files
Closing Files
4.4 Reading and Writing Formatted (ASCII) Files
Reading a Formatted File
Writing a Formatted File
4.5 Reading and Writing Unformatted (Binary) Files
Reading an Unformatted File (Single Data Type)
Reading an Unformatted File (Mixed Data Types)
Reading a FORTRAN-77 Unformatted File
Repositioning the File Pointer
Byte Swapping (or Big-endian versus Little-endian)
Writing Binary Data to an Unformatted File
Programs to Write and Read Portable Binary Data
Reading Binary Data via an Associated Variable
Saving and Restoring IDL Variables
4.6 Scientific Data Formats
Specialized Formats
4.7 Reading and Writing netCDF Files
Reading a Variable from a netCDF file
Reading an Attribute from a netCDF file
Discovering the Contents of a netCDF file
Writing to a netCDF file
Standard Attributes
Coordinate Variables
4.8 Reading and Writing HDF Files
Reading a Variable from a HDF file
Using a Wrapper Procedure to Read a Variable
Reading an Attribute from a HDF file
Discovering the Contents of a HDF file
Writing to a HDF file
Coordinate Variables
Chapter 5: Direct Graphics

5.1 Graphics Devices

Selecting a Graphics Device
Configuring the Graphics Device
5.2 Display Modes
8-bit Display Mode
24-bit Display Mode
Display Mode Comparison
Obtaining Display Mode Information
Selecting a Display Mode: Windows and MacOS platforms
Selecting a Display Mode: UNIX platforms
Selecting a Display Mode via a Startup File
5.3 Graphics Windows
Creating a Window
Working with Existing Windows
Invisible Graphics Windows (Pixmaps) and Animation
Scrolling Graphics Windows
5.4 Working with Colors
Color Modes
Indexed Color
Working with the Color Table
Color Table Updates in 24-bit mode
Decomposed Color
5.5 Display Mode Troubleshooting

Chapter 6: Plotting Data

6.1 Plotting Overview

Line Plots
Scatter Plots
Polar Plots
Plot Coordinates
Coordinate Conversions
Plotting in Normal and Device Coordinates
System Variables
6.2 Plot Positioning
Specifying a Plot Position
Computing a Plot Position
Positioning Multiple Plots
6.3 Plot Customization
General Plot Properties
General Axis Properties
Configuring Axis Range and Style
Creating Axes
Logarithmic Axes
Tick Marks and Labels
6.4 Plot Colors
Indexed Colors
Decomposed Colors
6.5 Titles, Labels, and Symbols
Mathematical Symbols
6.6 Error Bar, Histogram, and Bar Plots
Error Bar Plots
Histogram Plots
Bar Plots
6.7 Contour Plots
Contour Plotting Overview
Contouring Irregularly Spaced Data
Filled Contours
6.8 Mesh and Shaded Surface Plots
Irregularly Spaced Data
Shaded Surface Plots
Combined Mesh and Shaded Surface Plots
6.9 Mapping
Creating a Map Projection
Configuring a Map Projection
Selecting Map Limits
Continental Outlines
Map Grid Lines
Contour Plots on Map Projections
Displaying Regularly Gridded Images on Map Projections
Chapter 7: Displaying Images

7.1 Image Fundamentals

PseudoColor Images
TrueColor Images
7.2 Image Display Routines
Displaying Unscaled Images: tv
Displaying Scaled Images: tvscl
Bottom-up vs. Top-down display
Keywords for tv and tvscl
7.3 Customizing Image Scaling
Image Scaling via bytscl
Color Table Splitting
Displaying Multiple Images with Separate Color Tables
Histogram Clipping
Histogram Equalization
7.4 Sizing the Image to Fit the Display
Computing Image Size and Offset Automatically
7.5 Displaying TrueColor Images
Displaying TrueColor Images in 24-bit Display Mode
Displaying TrueColor Images in 8-bit Display Mode
7.6 Displaying Images on the PostScript and Printer Devices
Displaying PseudoColor Images on the PostScript Device
Displaying PseudoColor Images on the Printer Device
Displaying TrueColor Images on the PostScript Device
Displaying TrueColor Images on the Printer Device
7.7 An Image Display Procedure

Chapter 8 Creating Graphical Output

8.1 Bitmap and Vector Output

Bitmap and Vector Formats
8.2 Creating Bitmap Output Files
Reading from the Display: tvrd
Reading from an 8-bit Display
Reading from a 24-bit Display
A Wrapper Function for tvrd
Selecting a Bitmap Output Format
Saving an 8-bit Image to a Bitmap Output File
Saving a 24-bit Image to a Bitmap Output File
A Program for Saving the Screen to a Bitmap Output File
8.3 Creating PostScript Output
Introduction to the PostScript Device
Configuring the PostScript Device
Setting Size and Offset Manually
Setting Size and Offset Automatically
Color PostScript Output
Using the Color Table in PostScript Mode
Reversed Background and Drawing Colors
PostScript Device Fonts
TrueType Fonts
Positioning Graphics in the Drawable Area
Adding an EPS Preview
8.4 Creating Printer Output
Selecting a Printer
Configuring the Printer Device
Setting Size and Offset Manually
Setting Size and Offset Automatically
Color Printer Output
Fonts and Positioning
Chapter 9: Graphical User Interfaces (GUIs)

9.1 Introduction to GUI Programming

GUI Components (Widgets)
GUI Programming vs. Procedural Programming
GUI Design
9.2 Creating Widgets
Widget Basics
Widget Attributes
widget_base function
widget_button function
widget_draw function
widget_droplist function
widget_label function
widget_list function
widget_slider function
widget_table function
widget_text function
Widget Layout
Naming Buttons
Compound Widgets
9.3 Working with Existing Widgets
Setting Widget Properties: widget_control
Getting Widget Information: widget_info
9.4 Events and Event Handling
Event Structures
Event Management
Event Handlers and Application State Information
Multiple Instances of an Application
9.5 A GUI Application
Design Implications
Startup Procedure
Event Handler Procedures
Service Procedures
Compiling and Running imgui
Appendix A: IDL on the Internet
Resources by the Author
RSI Information
IDL Newsgroup
IDL Libraries
IDL Library Searchable Database
IDL People
IDL Applications
Appendix B: Mathematical Routines
Complex Numbers
Correlation Analysis
Curve and Surface Fitting
Differentiation and Integration
Eigenvalues and Eigenvectors
Gridding and Interpolation
Hypothesis Testing
Linear Systems
Mathematical Error Assessment
Miscellaneous Math Routines
Multivariate Analysis
Nonlinear Equations
Signal Processing
Sparse Arrays
Special Math Functions
Statistical Fitting
Statistical Tools
Time Series Analysis
Transcendental Functions
Appendix C: Widget Event Structures
Base Widgets
Button Widgets
Draw Widgets
Droplist Widgets
Label Widgets
List Widgets
Slider Widgets
Table Widgets
Text Widgets
Appendix D: Widget Properties
Base Widgets
Button Widgets
Draw Widgets
Droplist Widgets
Label Widgets
List Widgets
Slider Widgets
Table Widgets
Text Widgets
Appendix E: Graphics Device Properties

Liam E. Gumley