Getting Started With IDL - Cornell University

Transcription

GettingStartedwith IDLIDL Version 5.3September, 1999 EditionCopyright Research Systems, Inc.All Rights Reserved

Restricted Rights NoticeThe IDL software program and the accompanying procedures, functions, and documentation described herein are sold under license agreement. Their use, duplication, and disclosure are subject to the restrictions stated in the license agreement.Research Systems, Inc., reserves the right to make changes to this document at anytime and without notice.Limitation of WarrantyResearch Systems, Inc. makes no warranties, either express or implied, as to anymatter not expressly set forth in the license agreement, including without limitationthe condition of the software, merchantability, or fitness for any particular purpose.Research Systems, Inc. shall not be liable for any direct, consequential, or otherdamages suffered by the Licensee or any others resulting from use of the IDL software package or its documentation.Permission to Reproduce this ManualIf you are a licensed user of this product, Research Systems, Inc. grants you a limited, nontransferable license to reproduce this particular document provided suchcopies are for your use only and are not sold or distributed to third parties. All suchcopies must contain the title page and this notice page in their entirety.AcknowledgmentsIDL is a trademark of Research Systems Inc., registered in the United States Patent and Trademark Office, for thecomputer program described herein.Numerical Recipes is a trademark of Numerical Recipes Software. Numerical Recipes routines are used by permission.GRG2 is a trademark of Windward Technologies, Inc. The GRG2 software for nonlinear optimization is used bypermission.NCSA Hierarchical Data Format (HDF) Software Library and UtilitiesCopyright 1988-1998 The Board of Trustees of the University of IllinoisAll rights reserved.Portions of this software are copyrighted by INTERSOLV, Inc., 1991-1998.Other trademarks and registered trademarks are the property of the respective trademark holders.Research Systems, Inc. documentation is printed on recycled paper. Our paper has a minimum20% post-consumer waste content and meets all EPA guidelines.

ContentsChapter 1:The Power of IDL . 11Using this Manual . 14Chapter 2:The IDL Development Environment . 15IDL’s Development Environment . 16Starting IDL . 17The IDL Interfaces . 18The IDL Development Environment Layout . 19Quitting IDL . 22More Information on the IDLDE . 23Getting Started with IDL3

4Chapter 3:Reading and Writing Data . 25IDL and Reading and Writing Data . 26IDL Supported Formats . 27Image Formats . 27Scientific Data Formats . 27Other Formats . 27Importing Data from an ASCII File . 28Reading and Writing Binary Data . 33Saving a Template . 37Reading and Writing Images . 38More Information on IDL and Input/Output . 40Chapter 4:2-D Plotting . 41IDL and 2-D Plotting . 42Simple Plotting . 43Using OPLOT . 44Printing a Plot . 45Plotting with Data Sets . 46Other Plotting Capabilities . 47Using LIVE PLOT . 48More Information on 2-D Plotting . 49Chapter 5:Signal Processing . 51IDL and Signal Processing . 52Creating a Data Set . 53Signal Processing with SMOOTH . 56Frequency Domain Filtering . 57Displaying the Results . 60More Information on Signal Processing . 62ContentsGetting Started with IDL

5Chapter 6:Image Processing . 63IDL and Image Processing . 64Reading an Image . 65Displaying an Image . 66Resizing an Image . 68Resizing a Graphics Window . 69Contrast Enhancement . 70Thresholding . 70Scaling Pixel Values . 72Smoothing and Sharpening . 75Unsharp Masking . 76Sharpening Images with Differentiation . 77Other Image Manipulations . 79Rotating an Image . 80Extracting Profiles . 81Using LIVE IMAGE . 83More Information on Image Processing . 84Chapter 7:Surface and Contour Plotting . 85IDL and Surface and Contour Plotting . 86Reading a Dataset to Plot . 87Displaying a Surface . 88Displaying a Shaded Surface . 90Displaying a Contour . 93Plotting with SHOW3 . 97Using LIVE SURFACE for Plotting . 98More Information on 3-D Plotting . 99Chapter 8:Volume Visualization . 101IDL and Volume Visualization . 102Getting Started with IDLContents

6Reading in a Dataset for Visualization . 1033-D Transformations . 104Visualizing an Iso-Surface . 106Making Slices with the IDL Slicer . 108Displaying a Surface with the Slicer . 110Dismiss the Slicer and Volume Windows . 110More Information on Volume Visualization . 112Chapter 9:Mapping . 113IDL and Mapping . 114Drawing Map Projections . 115Drawing an Orthographic Projection . 117Plotting a Portion of the Globe . 118Plotting Data on Maps . 119Reading Latitudes and Longitudes . 121Plotting Contours Over Maps . 122Warping Images to Maps . 124More Information on Mapping . 128Chapter 10:Plotting Irregularly-Gridded Data . 129IDL and Plotting Irregularly-Gridded Data . 130Creating a Dataset . 131The TRIANGULATE Procedure . 133Plotting the Results with TRIGRID . 135More Information on Gridding . 137Chapter 11:Animation . 139IDL and Animation . 140Animating a Series of Images . 141Displaying an Animation as a Wire Mesh . 143ContentsGetting Started with IDL

7Animation with XINTERANIMATE . 146Cleaning Up the Animation Windows . 148More Information on Animation . 149Chapter 12:Programming in IDL . 151IDL and Programming . 152Programming Capabilities in the IDLDE . 153Built-In Editor . 153Types of IDL Programs . 153BEGIN/END Statements . 154IDL Supported Statements . 154Executing a Simple IDL Example Program . 155Saving, Compiling and Running your Program . 156Debugging Tools in IDL . 158Breakpoints . 158Variable Watch window . 158The IDL Code Profiler . 159Using IDL Projects . 160Access to all Files in Your Application . 160Working with Files in Your Project . 161Compiling and Running Your Application . 161Building Distributions . 161Exporting Your Applications . 161More Information on IDL Programming . 162Chapter 13:Manipulating Data . 163IDL and Manipulating Data . 164IDL Array Routines . 165Array Creation Routines . 165Array Manipulation Routines . 166Array and Image Processing Routines . 166Getting Started with IDLContents

8Array Processing Capabilities . 168More Information on Manipulating Data . 171Chapter 14:Using the IDL GUIBuilder . 173What is the IDL GUIBuilder? . 174Using the IDL GUIBuilder . 174IDL GUIBuilder Tools . 176Using the IDL GUIBuilder Toolbar . 176Creating an Example Application . 177Defining Menus for the Top-Level Base . 177Running the Application in Test Mode . 181Generating the IDL Code . 181Handling the Open File Event . 182Handling the Exit Event . 183Handling the Load Color Table Event . 184Handling the Smooth Event . 184Compiling and Running the Example Application . 185Widget Types . 187Widget Properties . 188More Information on the IDL GUIBuilder . 189Chapter 15:Where to Go From Here . 191Learning More about IDL . 192IDL Documentation Set . 192Online Manuals . 194Online Help . 196IDL Demo Applications and Examples . 198Contacting RSI . 199Address . 199Phone . 199Fax . 199ContentsGetting Started with IDL

9E-mail . 199World Wide Web . 199Index . 201Getting Started with IDLContents

10ContentsGetting Started with IDL

Chapter 1:The Power of IDLIDL, the Interactive Data Language, is the ideal software for data analysis,visualization, and cross-platform application development. IDL integrates apowerful, array-oriented language with numerous mathematical analysis andgraphical display techniques, thus giving you incredible flexibility. A few lines ofIDL can do the job of hundreds of lines of C or Fortran, without losing flexibility orperformance. A fourth-generation language, IDL is radically more compact than C orFortran. Using IDL, tasks that require days or weeks of programming with traditionallanguages can be accomplished in hours. Users can explore data interactively usingIDL commands and then create complete applications by writing IDL programs.Now you can.Getting Started with IDL11

Chapter 1: The Power of IDL12Create Data in IDL - Use IDL tocreate data, using a complete,structured language that can be usedinteractively and on sophisticatedfunctions, procedures, andapplications.Use the IDLDE to createApplications - Use the IDLDE (IDLD eve l o p m e n t E nv i r o n m e n t ) t ocompile and execute commandsimmediately. It also includes built-inediting and debugging tools thatprovide instant fe

IDL, the Interactive Data Language, is the ideal software for data analysis, visualization, and cross-platform application development. IDL integrates a powerful, array-oriented language with numerous mathematical analysis and graphical displ