Practical IDL Programming

所需积分/C币:10 2014-05-11 11:57:32 30.45MB PDF
收藏 收藏

Foreword Practical IDL Programming begins with a concise presentation of the basics of IDL, its syntax, and data and control structures. It then explains how to access data of various types in files, including the complicated and poorly understood netCDF and HDF formats. Four chapters are devoted to creating graphics, charts, and displaying images, on the screen,the printer, and for publication. The final chapter describes how to build an application with a graphical user interface for a wider range of users. Liam gumley is eminently qualified to write a book on IDl. He has een a long- time user of IDL and has created a number of impressive applications used by many scientists. Professionally, he writes software applications for the Cooperative Institute for Meteorological Satellite Studies(CIMSS), at the University of Wisconsin. He posts frequently to the always-active IDL newsgroup, comp.lang. id1-pvwave, and is a respected voice there Liam distills what he feels is important for an IDl programmer to know, rather than simply presenting a complete reference without editor ial comments. In IDL, as in any reasonably complete package, there are usually 10 ways to perform any task. For any particular problem,one method will be the best and one will be the worst with the remainder falling somewhere in between. Liams goal is to impart an understanding of IDL's operation to the reader, so that he or she can select the best method for the problem at hand The idl beginner will welcome this book because while it starts with the basics, it is nonetheless a comprehensive treatment of the language There are a multitude of examples, plus code for designing a gui-based application for interactively viewing images. The experienced user will find the book valuable for its reference sections and discussions on the proper way to program in IDL, which unfortunately is not always obvious On behalf of Research Systems Incorporated and the community of IDL users and programmers, i would like to thank liam gumley for writ ing this valuable and long overdue book. Practical IDL programming serves as a useful tutorial, source of examples, and reference for those wishing to learn or to master IDL. It gives me great pleasure to recom men id this book to you Acknowledgments This book arose from a desire to share the lessons i have learned from my work with IDl, Naturally, i did not learn about idl all on my own Instead, I am fortunate to work in a research environment with experi enced and knowledgeable colleagues whose advice helped me to develop the ideas presented in this book. The genesis of this book was the morn ing discussions over coffee with my good friend Paul van Delst, who chal- lenged and tested my ideas about IDL and programming in general. Paul Menzel provided me with enough data analysis and visualization chal lenges that i had little choice but to hone my skills as an IDL programmer. And for everyone who stopped by my office to ask a quick question about Idl, this book is for you Early in the project it was my good fortune to establish a working rela- tionship with Research Systems, Inc, the makers ofIDL, and I have bene fited greatly from their encouragement and support. In particular I must thank david Stern ofrsi for kindly agreeing to write the foreword for this book. The team at Morgan Kaufmann, led by Denise Penrose, made it easier than I had ever hoped to bring the book to fruition, and the deserve credit for turning my manuscript into what i hope will be a pleas ing and useful reference for IDl programmers I am indebted to the following reviewers who played a large part in the development of the manuscript: Paul van Delst of the University of wis consin-Madison, Nick Bower of Curtin University of Technology, Martin Schultz of the Max-Planck-Institut fuer Meteorologie, molly houck of Acknowledgments RSI, and Randall frank from Lawrence Livermore National laboratory Their suggestions dramatically improved the content, style, and organi zation of the book, and any errors that remain are mine alone I have also learned a great deal from the contributors to the Usenet newsgroup comp. lang. idl-pvwave, whose willingness to discuss the intricacies of IDL often provided the stimulus to investigate a topic fur ther. Some results of exchanges on the newsgroup are to be found in this book Finally, i owe the greatest debt to my wife, janine. If not for her patience and understanding, I would never have completed this book Introduction his book provides a solid foundation in the fundamentals of programming in Interac tive Data Language(IDL), an array-oriented data analysis and visualiza tion environment developed and marketed by Research Systems, Incor- porated(rSi) of Boulder, Colorado. IDL is available for WindowS, MacOs, UNIX (including Linux), and vMS platforms The first version of IDL for VAX/VMS was released in 1981 by rsi founder david Stern. Since then, iDL has emerged from its roots in the astronomical and space sciences to become a widely used tool in research, educational, and commercial settings in areas as diverse as the earth sciences, medical physics, and engineering test and analysis Examples of real-world tasks where IDL is used include analyzing and visualizing images from the Hubble Space Telescope; rendering three- dimensional volumes of the human body from magnetic resonance imaging; and monitoring and controlling the plasma field of a nuclear fusion tokamak The long-term success of IDl stems from its flexible modes of opera tion, which include rapid interactive analysis and visualization; a power ul programming environment; and fully developed cross-platform end user applications that range from an advanced remote sensing image processing suite(ENvi) to a comprehensive terrain and river network analysis package(River Tools). In addition, IDL offers a broad range of fundamental data types, making it possible to read almost any input data Chapter 1 Introduction format. The availability of IDL on all major UNIX platforms(including Linux),Windows, and MacOS facilitates data analysis in multiplatform environments and ensures that applications developed on one platform can be successfully ported to new platforms when hardware changes are necessary. Finally, the worldwide community of IDl users contributes to and maintains a collection of freely available Internet-based libraries which at the time of writing included over 5,000 separate routines 1. ABOUT THIS BOOK This book begins by explaining the fundamentals of IDL and then moves on to explain how the fundamentals may be used to develop data analysis and visualization applications. The first chapter begins with a discussion of the philosophy behind the book; explains where the supporting mate rials for the book may be found; and summarizes the conventions used for IDl code examples. The chapter continues with instructions on how to start an IDL session and how to use the built-in online help. The chap ter concludes with an outline of the remaining chapters in the book Who should read this book Readers of this book will include anyone who wishes to use Idl effec tively to analyze and visualize data. Newcomers to IDL will find a thor ough description of the basics of the ldl syntax, with special attention paid to the effective use of arrays, as well as the fundamentals of visual ization in idl readers with a moderate level of prior exposure to idl (perhaps only in interactive mode) will learn the mechanics of writing understandable and efficient idl programs and receive practical advice such as how to create publication-quality postScript output. Advanced users of idl will appreciate the many hard-won nuggets of advice about IDL peculiarities, such as a detailed description of the differences between 8-bit and 24-bit graphics modes and the implications for IDL programming. Readers at all levels will appreciate the realization of IDL programming concepts in example programs that can be used immedi ately for real-world tasks Prior exposure to a procedural language such as C or Fortran will be helpful, but not essential, for readers of this book. 1. 1 About This book 3 Why write This book? i wrote this book to help IDL users at all levels advance to the point where writing understandable and efficient IDl programs is second nature. Part of the attraction of idl is that you can accomplish with only a few commands in interactive mode. a side effect however is that a sizable fraction of IDl users never progress beyond the point of entering individ ual commands and are never able to fuly exploit the capabilities of idl as a programming language. In my experience, the transition from casual command-line user to effective idl programmer is often long and frus- trating, if the user makes the transition at all. All the necessary informa- tion can be found somewhere in the manuals that accompany Idl, but with several thousand pages spread over five or more volumes, it is often difficult to know exactly where to look when you have a question I felt strongly that there was a place for a book written by an experienced IDL programmer that gathered together essential information about IDl pro gramming, assembled it in a logical sequence, and presented it with prac tical and illustrative example programs that solve real-world problems What about objects? A new object data type and an object graphics system were introduced in IDL 5.0 in 1996. These new features help to broaden the scope of the language and allow complex graphical displays to be constructed, partic ularly in the area of three-dimensional visualization However effective object-oriented programming in IDL requires a rather different approach when compared to the more commonly used procedural programming paradigm that has existed in IDl since it was first released In this book, I have chosen to limit the discussion strictly to procedural programming since I believe a larger audience for this topic exists in the community of IDL users. Likewise, this book only describes the direct Graphics system in IDL and does not explore the realm of the Object Graphics system.At the time of writing, the Direct Graphics system offered much simpler(i.e easier to program)ways to create visualizations in IDL To do justice to objects and the Object Graphics system in IDL, I believe a separate book is required that describes how object-oriented principles are applied in IDL; hopefully such a volume will emerge in the not-too-distant future. In 4 Chapter 1 Introduction the meantime, the chapters of this book that describe the fundamental syntax of the language should prove useful to those writing object- oriented programs in IDL. Supporting Materials The source code for the example procedures and functions shown in this book are available online at the author s website. It is recommended that you download the programs to a directory on your system, and then add the directory to the iDl path by one of the fol- owing methods o If you are running the IDL Development Environment, select File, Pref- erences,Path, and add the directory to the default search path o On UNIX platforms you may add the directory to the Idl path envi ronment variable IDL_PATH. For example, if you stored the programs in a directory named /home/bi11g/idl, the syntax would be as follows setenv IDL_PATH $(IDL_PATH): /home/bi11g/id1 (C shell) f export IDL_PATH=$(IDL_PATH]: /home/bi11g/id(Korn shell) Typographic Conventions Throughout this book the following typographic conventions are used Commands that are intended to be entered at the idl command line will appear as follows IDL>tvscl, dist(256) Procedures and functions (i.e, programs will appear as follows: PRO HELLO print, ' Hello world END The program text may be entered in the IDL Development Environment editor or in any other text editor. The name of the text file should be the 1.2 About IdL 5 same as the procedure or function name(e. g, hello pro), and lowercase file names are recommended Special characters IDL recognizes a number of special characters within idl programs or when commands are entered at the command line. The most important special characters are described below. fo The semicolon character designates the beginning of a comment. Any ext following a semicolon on a given line is ignored For example: PRO HELLO a simple program print, ' Hello world This ine prints a message END If the last character on a line is a dollar sign, the current command is continued on the next line. For example: IDL> print, 'The quick brown fox,$ IDL> jumped over the lazy dog If the first character on the line is a dollar sign, any text that follows is executed as an operating system command. For example to list the con- tents of the current directory on a UNIX platform IDL> $IS 1.2 ABOUT IDL One of the strengths of iDl is its support for a variety of hardware and operating system combinations. Whether you are accustomed to a win dows, MacoS, or UNIX (including Linux)environment, a version of IDL is probably available for your system. The platforms supported by ID 5.4 are shown in Table 1. 1. For an up-to-date list of supported platforms and operatingsystemversionsseethersiwebsite(http://www.research systems. com).

试读 127P Practical IDL Programming
立即下载 低至0.43元/次 身份认证VIP会员低至7折
qq_20284043 资料不错,很有帮助。
olanking 还没看呢,现在现在基于IDL的编程很 普遍,学一学挺好
关注 私信
Practical IDL Programming 10积分/C币 立即下载
Practical IDL Programming第1页
Practical IDL Programming第2页
Practical IDL Programming第3页
Practical IDL Programming第4页
Practical IDL Programming第5页
Practical IDL Programming第6页
Practical IDL Programming第7页
Practical IDL Programming第8页
Practical IDL Programming第9页
Practical IDL Programming第10页
Practical IDL Programming第11页
Practical IDL Programming第12页
Practical IDL Programming第13页
Practical IDL Programming第14页
Practical IDL Programming第15页
Practical IDL Programming第16页
Practical IDL Programming第17页
Practical IDL Programming第18页
Practical IDL Programming第19页
Practical IDL Programming第20页

试读结束, 可继续阅读

10积分/C币 立即下载 >