ENVI Tutorial
7 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
7 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

ENVI Tutorial: Introductionto ENVI Plot FunctionsIntroduction to Plot Functions 2Files Used in this Tutorial 2ENVI Plot Functions 2Create a Plot Function 4Add the Plot Function to the Menu 5Set up ENVI to Run the Plot Function 6Open a Spectral Library and Plot Spectra 71ENVI Tutorial: Introduction to ENVI Plot FunctionsIntroduction to Plot FunctionsThis tutorial describes how to implement an ENVI plot function, which is a user-defined function thatyou can add to and call from the Plot_Function menu of any ENVI plot window. This tutorial assumesthat you are familiar with the Interactive Data Language (IDL) and that you understand how to writefunctions and procedures in IDL. ENVI+IDL is required for this tutorial.Files Used in this TutorialENVI Resource DVD: D a t a \ p r o g r a m m i n gF i l e D e s c r i p t i o np f _ 1 s t _ d e r i v a t i v e . p r o Plot function to take the first derivative of a spectrump f _ 2 n d _ d e r i v a t i v e . p r o Plot function to take the second derivative of a spectrumu s e r a d d . t x t Modified (replacement) version of useradd.txt, which resides in the menudirectory of your ENVI installationENVI Resource DVD: D a t a \ s p e c _ l i bF i l e D e s c r i p t i o nu s g s _ m i n . s l i ( . h d r ) USGS mineral spectral libraryENVI Plot FunctionsPlot functions are a special class of ENVI user functions that modify data in an ENVI plot window, suchas a Z Profile window. For example, ENVI’s built-in ...

Informations

Publié par
Nombre de lectures 386
Langue English

Extrait

ENVI Tutorial: Introduction
to ENVI Plot Functions
Introduction to Plot Functions 2
Files Used in this Tutorial 2
ENVI Plot Functions 2
Create a Plot Function 4
Add the Plot Function to the Menu 5
Set up ENVI to Run the Plot Function 6
Open a Spectral Library and Plot Spectra 7
1ENVI Tutorial: Introduction to ENVI Plot Functions
Introduction to Plot Functions
This tutorial describes how to implement an ENVI plot function, which is a user-defined function that
you can add to and call from the Plot_Function menu of any ENVI plot window. This tutorial assumes
that you are familiar with the Interactive Data Language (IDL) and that you understand how to write
functions and procedures in IDL. ENVI+IDL is required for this tutorial.
Files Used in this Tutorial
ENVI Resource DVD: D a t a \ p r o g r a m m i n g
F i l e D e s c r i p t i o n
p f _ 1 s t _ d e r i v a t i v e . p r o Plot function to take the first derivative of a spectrum
p f _ 2 n d _ d e r i v a t i v e . p r o Plot function to take the second derivative of a spectrum
u s e r a d d . t x t Modified (replacement) version of useradd.txt, which resides in the menu
directory of your ENVI installation
ENVI Resource DVD: D a t a \ s p e c _ l i b
F i l e D e s c r i p t i o n
u s g s _ m i n . s l i ( . h d r ) USGS mineral spectral library
ENVI Plot Functions
Plot functions are a special class of ENVI user functions that modify data in an ENVI plot window, such
as a Z Profile window. For example, ENVI’s built-in plot functions (which are listed in the Plot_
Function menu in any plot window) include items such as Binary Encoding and Continuum Removal.
Define user plot functions by adding a new line to the useradd.txt file that resides in your ENVI menu
directory. However, while ordinary user functions are automatically called by XMANAGER and
receive the event structure variable as a positional parameter, plot functions are automatically called by
ENVI and receive several variables (as both parameters and keywords) that are related to the data in the
plot window.
When you call a user plot function, normal plot data (all the spectra in the plot window) are passed to the
user plot function. The plot function is applied to the data, and the resulting data are returned to the plot
window where they are displayed. The user plot function is applied to every spectrum placed in that
window until a different plot function is selected.
All user plot functions must have the following function definition statement:
Where:
X _ D A T A: Data values for the x-axis
Y _ D A T A: Data values for the y-axis
2ENVI Tutorial: Introduction to ENVI Plot Functions
B B L: Vector whose values identify the band positions of the bad bands in the Z Profile data. For
example, if the Z Profile contained 224 bands, but bands 3, 4, and 5 were in marked as bad bands
in the ENVI header file, then BBL would be set to [2,3,4]. This applies only to Z Profile windows
and will be undefined for all other plot windows.
B B L _ A R R A Y: Vector of ones and zeros with as many elements as x-axis data points. A value of
1 indicates that the corresponding y-axis value is good, and a value of 0 means it is bad (i.e., for Z
Profiles, a value of 0 means the band is in the bad bands list).
L _ P O S: Indicates the index into the X_DATA array where the x-axis plot begins. If the plot
window is not zoomed-in, then L_POS is 0.
R _ P O S: Indicates the index into the X_DATA array where the x-axis plot ends. If the plot
window is not zoomed-in, then the value of R_POS is n_elements(X_DATA)-1.
_ E X T R A: Keyword variable that must be present to receive extra variables that ENVI may need
to pass into the plot function. If the plot function is defined without this keyword, then you will
likely receive errors when trying to use it in ENVI. 
3ENVI Tutorial: Introduction to ENVI Plot Functions
Create a Plot Function
1. Start ENVI+IDL.
2. From the IDL menu bar, select F i l e > O p e n F i l e. The Open File dialog appears.
3. Navigate to D a t a \ p r o g r a m m i n g and select p f _ 1 s t _ d e r i v a t i v e . p r o. The following
code appears in the IDL Editor:
This function accepts x and y data and a list of bad bands. Excluding the bad bands, the function
takes the first derivative of the y value and returns it to the plot window.
4. Follow Steps 2-3 to open the file p f _ 2 n d _ d e r i v a t i v e . p r o. When you understand how
these functions work, close the files.
4ENVI Tutorial: Introduction to ENVI Plot Functions
Add the Plot Function to the Menu
To add a new button to a plot window’s Plot_Function menu, add a new line to u s e r a d d . t x t in the
m e n u directory of your ENVI installation. For this tutorial, you will copy a previously edited version of
u s e r a d d . t x t to your menu directory. The following steps outline this process.
1. From the IDL menu bar, select F i l e > O p e n. A file selection dialog appears.
2. Navigate to D a t a \ p r o g r a m m i n g and select u s e r a d d . t x t. Click O p e n. This file contains
the following code. Note the fourth and fifth lines:
Using the fourth field above as an example, the format is as follows:
{ p l o t }: Tag that indicates the following definition is a plot function (since u s e r a d d . t x t can
contain several different types of routines)
{ 1 s t D e r i v a t i v e }: Menu button name for the Plot_Function menu. Note that 1st Derivative
will be placed immediately after the Binary Encoding menu option.
{ p f _ 1 s t _ d e r i v a t i v e }: Name of the user plot function
{ t y p e = 0 }: Type of plot function updates. Set { t y p e = 0 } to call the plot function only when
new data are available. Set { t y p e = 1 } to call the plot function when new data are available or
the plot is zoomed.
you are satisfied that you understand the user function format, exit ENVI+IDL.             
3. Copy and paste D a t a \ p r o g r a m m i n g \ u s e r a d d . t x t to the menu directory of your ENVI
installation, overwriting the existing file. On a Windows platform, this directory is in the
following location (where x x indicates the software version): 
C : \ P r o g r a m F i l e s \ I T T \ I D L x x \ p r o d u c t s \ e n v i x x \ m e n u
5ENVI Tutorial: Introduction to ENVI Plot Functions
Set up ENVI to Run the Plot Function
1. ENVI requires that IDL functions reside in the s a v e _ a d d directory of your ENVI installation.
Copy D a t a \ p r o g r a m m i n g \ p f * . p r o to the following directory (assuming a Windows
platform):
C : \ P r o g r a m F i l e s \ I T T \ I D L x x \ p r o d u c t s \ e n v i x x \ s a v e _ a d d
2. Restart ENVI+IDL. ENVI looks in the s a v e _ a d d directory for new functions and automatically
loads them when it starts.
6ENVI Tutorial: Introduction to ENVI Plot Functions
Open a Spectral Library and Plot Spectra
1. From the ENVI main menu bar, select S p e c t r a l > S p e c t r a l L i b r a r i e s > S p e c t r a l L i b r a r y
V i e w e r. A Spectral Library Input File dialog appears. 
2. Click O p e n and select S p e c t r a l L i b r a r y. A file selection dialog appears.
3. Navigate to D a t a \ s p e c _ l i b \ u s g s _ m i n and select u s g s _ m i n . s l i. Click O p e n.
4. Click O K in the Spectral Library Input File dialog. The Spectral Library Viewer dialog appears.
5. Select one or more spectra; the corresponding spectral profiles appear in a Spectral Library Plots
window. 
6. From the Spectral Library Plots window menu bar, select P l o t _ F u n c t i o n > 1 s t D e r i v a t i v e. ENVI
calculates the first derivative spectra of all plots and displays the results in the Spectral Library
Plots window.
7. From the Spectral Library Plots window menu bar, select P l o t _ F u n c t i o n > 2 n d D e r i v a t i v e.
ENVI calculates the second derivative spectra of all plots and displays the results in the Spectral
Library Plots window.
8. From the Spectral Library Plots window menu bar, select P l o t _ F u n c t i o n > N o r m a l to return to
the standard reflectance spectrum.
9. When you are finished, select F i l e > E x i t from the ENVI main menu bar.
7

  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents