Local IDL Routines

(This page was created by a MODIFICATION of the IDL library routine mk_html_help).

Last modified: Mon Jul 29 14:39:49 2002.


List of Routines

[List of Routines by Category]


Routine Descriptions

ADDLABELNODES

[Next Routine] [List of Routines]
 NAME:
       addLabelNodes
 PURPOSE:
       Add LABEL sub-nodes to MDSplus signal nodes reading info from a file
 CATEGORY:
       MDSplus, TCL 
 CALLING SEQUENCE:
       addLabelNodes, shot1, shot2, filename=filename
 INPUTS:
	shot1 = starting shot number to process (defaults to last shot)
	shot2 = last shot number to process (optional)
 KEYWORDS:
	filename - name of file with info - REQUIRED, 
		   see, e.g., BDAVIS$:[CVS.MISC.WF]tauslabel.dat
	   the file must contain 4 columns, separated by white space.  
	   the first column is the tagname (without \), the last column is 
	   the Label text enclosed in double quotes. The middle columns
	   can be any single word or character (file format from another
	   application).
	tree - name of tree -- defaults to 'WF'
 COMMON BLOCKS:
       NONE
 NOTES:
       YOU NEED PRIVILEGES to write to the MDSplus tree.
 LIMITATIONS:
 MODIFICATION HISTORY:
	25-Jan-01 Written by Bill Davis.

(See /p/nstxusr1/util/idl_cvs/addlabelnodes.pro)


ADDSIGNODES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       addsignodes
 PURPOSE:
       Add signal nodes and tags to a MDSplus tree for many shots
 PROCEDURE:
 CATEGORY:
       MDSplus
 CALLING SEQUENCE:
       addsignodes, shot1, shot2, tags=[tag1,tag2,tag3,...]
 INPUTS:
	shot1 = starting shot number to process
	shot2 = last shot number to process
 KEYWORDS:
	tags = tags to add (if defined in the model tree, you
		will not need to specify the corresponding nodes).
	nodes = if tags are not defined in the model tree, these are necessary
	VERBOSE  - if set, more info is printed
	test  - doesn't write to MDSplus
 NOTES:
       YOU NEED PRIVILEGES to write to the MDSplus tree.
 LOGIC:
	finds node names for tags. Then, if node names are not different
	than the "tag" names, does not add tags.
 LIMITATIONS:
	all signals must be in the same tree
 MODIFICATION HISTORY:
	13-Jun-02 Written by Bill Davis.

(See /p/nstxusr1/util/idl_cvs/addsignodes.pro)


ADDTREETOTAG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       addTreeToTag
 PURPOSE:
       return tags with trees merged in
 CATEGORY:
       MDSplus, SCOPE
 CALLING SEQUENCE:
	names = addTreeToTag( tags, trees )
 INPUTS:
   tags - array of tags, e.g., '\ip1' (if tree already there, will not change)
   trees - array of trees (same dimension as tags)
 RETURNED:
	names - tag names with tree in them, e.g., '\engineering::ip1'
 KEYWORDS:
 COMMON BLOCKS:
       none
 EXAMPLE:
 	IDL> print, addTreeToTag( ['\ip1+\ip2'], ['engineering'] )
	\engineering::ip1+\engineering::ip2
 	IDL> print, addTreeToTag( ['\engineering::ip1.blah+\ip2'], ['engineering'] )      
	\engineering::ip1.blah+\engineering::ip2

 LIMITATIONS:
 MODIFICATION HISTORY:
	30-Apr-01 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/addtreetotag.pro)


AMEDIAN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       AMEDIAN
 PURPOSE:
       Works the same as MEDIAN, but the effect tapers off at the edges.
 CATEGORY:
       Smoothing, Math
 CALLING SEQUENCE:
       Result = AMEDIAN( ARRAY, WIDTH )
 INPUT PARAMETERS:
       ARRAY   = One or two-dimensional array to be median filtered.
       WIDTH   = Width of the median filter box.
 OPTIONAL KEYWORD PARAMETERS:
       None.
 COMMON BLOCKS:
       None.
 SIDE EFFECTS:
       None.
 RESTRICTIONS:
       ARRAY must be one or two-dimensional.
 PROCEDURE:
       A larger array is constructed with the border filled with the reflected
       edges of the original array.  Then MEDIAN is applied to this larger
       array, and the area corresponding to the original array is returned as
       the result of the function.
 MODIFICATION HISTORY:
	12-Jun-01 Made work for 1 dimension of 2 being small.
	21-Feb-01 Just return array if width < or = 1. [BD]
       William Thompson, February 1993.

(See /p/nstxusr1/util/idl_cvs/amedian.pro)


ARRAY_EQ

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ARRAY_EQ
 PURPOSE:
  	Return TRUE if two arrays are equal, else false.
 CATEGORY:
       Arrays
 CALLING SEQUENCE: 
	logical=ARRAY_EQ(array1,array2)

 INPUTS:   
	bigArray - an array of numbers to look in
  	littleArray - an array to look for matches in bigArray
 OUTPUTS:
	logical - 0/1

 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
 	17-May-99 WMD Written

(See /p/nstxusr1/util/idl_cvs/array_eq.pro)


BADPAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     badpar
 PURPOSE: (one line)
     Validate an input parameter against valid entries.
 DESCRIPTION:

     This is a general parameter checking function for validating input
     quantities in other procedures and functions.  This routine will
     generate an error message indicating what is wrong with the item.

     Example of use:

     pro foo,array
     if badpar(array,[4,5],2,CALLER='foo') then return
        .
        . code for foo .
        .
     end


     This would cause an immediate return to the routine that called foo
     with an error message if the input was not either floating or double
     and 2 dimensional.

     As of IDL v3.0, these are the recognized type codes (see 1-218 in
        reference guide).

        Type
        Code     Data Type
        ----    -----------------------------
          0      Undefined
          1      Byte
          2      Integer
          3      Longword integer
          4      Floating point
          5      Double-precision floating
          6      Complex floating
          7      String
          8      Structure

 CATEGORY:
  Utility
 CALLING SEQUENCE:
     val = badpar(param,goodtype,goodrank)
 INPUTS:
     param    - IDL variable to validate.
     goodtype - Scalar or vector of type codes that are valid.
     goodrank - Scalar or vector of valid ranks.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
     CALLER   - String identifying the calling routine.
     DEFAULT  - Value to return in param if undefined and undefined allowed.
     DIMEN    - Dimensions of variable.
     NPTS     - Total number of elements in variable.
     RANK     - Rank of variable.
     TYPE     - Type of variable.
 OUTPUTS:
     Return value is true if the parameter is bad.  False if good.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
     3/24/93 - Written by Marc W. Buie, Lowell Observatory.
     4/27/93 - MWB, added TYPE and DEFAULT keywords.

(See /p/nstxusr1/util/idl_cvs/viewtext.pro)


BAD_PTDATA_ERROR

[Previous Routine] [Next Routine] [List of Routines]
 
 NAME:
       BAD_PTDATA_ERROR
 PURPOSE:
       Return a logical true IF  the PTDATA error is serious
 CATEGORY:
       GA, error processing
 CALLING SEQUENCE:
       logical = Bad_PTDATA_Error(ptdata_ierr)
 INPUTS:
       ptdata_ierr - error return from PTDATA calls
 KEYWORD PARAMETERS:
 OUTPUTS:
 RETURNED:	logical indication of a serious error 
		(per IDL definition, e.g., 0 IF  false)
 COMMON BLOCKS:
 MODIFICATION HISTORY:
               1-Apr-97 WMD Written

(See /p/nstxusr1/util/idl_cvs/bad_ptdata_error.pro)


BANGPW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       bangPW
 PURPOSE:
       Widget to set interactively some !P values. Lists colors by name, 
	if mk_color used; otherwise finds "closest" index to named colors. 
	Allows selection of several custom plotting symbols (see PLOTSYM).
 CATEGORY:
       Graphics, Widgets
 CALLING SEQUENCE:
       IDL> bangPW
 INPUTS:
 KEYWORD PARAMETERS:
     Optional Keywords:
	  UPDATECALLBACK - a routine to call after struct system variable is set
	  GROUP_LEADER - This widget is destroyed if it's GL is destroyed
 OUTPUTS:
       The system variable !P is changed               	
 COMMON BLOCKS:
       NONE
 EXAMPLE:
	IDL> bangPW, UPDATECALLBACK='myReplotter'
 NOTES:
	If an application overrides !P.* parameters, or specifies them on
	the plot command, changing settings with this widget will not override.
	!P.SYMSIZE not controlled, because it seems to have no effect.
 MODIFICATION HISTORY:
	17-Aug-01 Allow lines with symbols [BD]
	30-Oct-00 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/bangpw.pro)


BELL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       BELL
 PURPOSE:
       Ring terminal bell.
 CATEGORY:
	Programming, Sound, Errors
 CALLING SEQUENCE:
       bell, [n]
 INPUTS:
       n = number of rings (def=1).  in
 KEYWORD PARAMETERS:
 OUTPUTS:
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
       R. Sterner, 20 Oct, 1989.

 Copyright (C) 1989, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /p/nstxusr1/util/idl_cvs/bell.pro)


BETTERRAINBOW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       betterrainbow
 PURPOSE:
       Loads a rainbow color palette with 6 evenly-spaced (roughly) colors
 CATEGORY:
       Graphics, Color Specification
 CALLING SEQUENCE:
       IDL> betterrainbow
 INPUTS:
       NONE  
 KEYWORD PARAMETERS:
    Optional Keywords:
	  BAR - if set, will draw a color bar on plot
 OUTPUTS:
       NONE (color tables changed
 MODIFICATION HISTORY:
       15-Jul-02 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/betterrainbow.pro)


BETTERTICKLABELS

[Previous Routine] [Next Routine] [List of Routines]
  NAME:
 	betterticklabels

  PURPOSE:
 	Tick labels are made a little cleaner. E.g., shorter exponentials,
	no unnecessary trailing zeroes, accurate numbers when tick values
	are small differences between large numbers, etc.

 CATEGORY:
	Plotting, Graphics

  EXAMPLE:
	IDL> plot, y, ytickformat='betterticklabels'

  EXAMPLE A - Make a dummy plot call so can determine Tick Max:
	IDL> COMMON betterticklabels_common, yticklabels
	IDL> plot, y, ytick_get=yticklabels, ytickname=replicate('      ',30)
	IDL> AXIS, YAXIS=1, YRANGE=!y.crange, ytickformat='betterticklabels'
	IDL> dum = TEMPORARY(yticklabels)	; so doesn't affect later calls

  HISTORY:
	15-Oct-01 shift y axis labels if !p.font=0 (helps with some 3-D plots)
	11-Jan-01 shift y-axis labels if on TEK and !p.font=0 
	09-Oct-00 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/betterticklabels.pro)


BIN2D

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       Bin2D
 PURPOSE:
       Create a density image (2D histogram) from arrays of (x,y) points,
       or create an image of a function from arrays of ( x, y, f(x,y) ) data.
       In first case each pixel counts # of (x,y) points falling into
       a 2D bin (box), thus forming an image of counters. In optional case,
       each pixel is the average of all f(x,y) data falling into the box.
       Boxes are determined by dividing the (x,y) range into a uniform grid.
 CATEGORY:
	Image Processing
 CALLING EXAMPLES:
       imh = Bin2D( x, y, NPIX=64, XRAN=[0,20], YRAN=[-5,5] )
       imz = Bin2D( x, y, FXY=z, NPIX=[200,100] )
 INPUTS:
       X = array (any dimension) of x values.
       Y = array of y values, should correspond to x array.
               optionally, x can be of the form [[x],[y]]
               containing both x and y coordinates as rows of matrix,
               and then argument y should not be specified.
 KEYWORDS:
       XRAN and YRAN : specify the x,y range to be mapped into the image.
                       Common Bin2D, xminc,xmaxc, yminc,ymaxc
                       can also specify the x,y range if keywords are not used,
                       otherwise the defaults = min-max ranges of x and y.
       NPIXELS = 1 or 2 element integer array specifying size of result,
                       (single value means square image), default = [64,64].
      /NOCLIP means do not bother checking if (x,y) are within range (faster).
       TYPE_VAR = type code specifying the IDL variable type of result,
               (1=byte, 2=short, 3=Long, 4=float,... default=2, short integer).
 KEYWORDS (optional):
       IMAGE_DENSITY = an existing image of counters (2D histogram)
                       to which the result is added (overrides NPIX=).
       FXY = array giving z = f(x,y) for the purpose of binning into an image
               however, bins with no (x,y) data points are left = zero.
               (NOTE: must specify XRAN and YRAN, or set /NOCLIP).
   if /BOTH is set and FXY=z is given, then the binned image of z=f(x,y) is
               returned by function, and an image of (x,y) density is
               returned via the keyword IMAGE_DENSITY.
 OUTPUTS:
       Result of function is an image of the density of (x,y) points, or an
       image of scalar field function if z values are given at (x,y) points.
 PROCEDURE:
       Binning is performed by finding number of (x,y) duplicates
       at each pixel,  using the IDL sort and where functions.
 HISTORY:
       written Frank Varosi, U.of MD., 1988.
               F.V. 1990, modif. for IDL-V2.

(See /p/nstxusr1/util/idl_cvs/bin2d.pro)


BITMAPBUTTONS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       bitmapbuttons
 PURPOSE:
       Illustrate use of bitmapbuttons in IDL
 CATEGORY:
       GUI, buttons
 CALLING SEQUENCE:
       IDL> bitmapbuttons
    Then click on buttons and watch them change.
 COMMON BLOCKS:
       none
 NOTES:
	Requires IDL 5.2 or later.
 LIMITATIONS:
	This may not be the easiest way to manage button states
 MODIFICATION HISTORY:
	27-Jan-00 [BD]

(See /p/nstxusr1/util/idl_cvs/bitmapbuttons.pro)


BITS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       bits
 PURPOSE:
       Given a byte or integer, return a vector of 8 or 16 values
       which are the binary representation of the value.
 CATEGORY:
       bits, hardware
 INPUT:
       invalue - The byte or integer value to check
 OUTPUT:
       bitarr  - The 8-element array with values set
                 if the bit is set
 EXAMPLE:
	IDL> BITS, invalue, BITARR
 HISTORY:
       Written 1988 by M.Morrison
       13-Nov-92 (MDM) - Modified to allow integer*2 values
                         and to allow an array of values.
        7-Apr-94 (MDM) - Allow integer*4 values
       15-Aug-94 (MDM) - Corrected error from 7-Apr-94 mod which
                         did not allow an array of inputs

(See /p/nstxusr1/util/idl_cvs/bits.pro)


BPWFEDIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	BPWFEDIT

 PURPOSE:
	Read, Edit, & Plot Breakpoint Waveform files used in ppcc system on TFTR
 CATEGORY:
       TFTR, Waveforms, GUI Editing

 REVISION HISTORY:
	21-Aug-98 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/bpwfedit.pro)


BREAKMDSNAME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       BreakMDSname

 PURPOSE:
       break an MDS pathname near the middle, if too long

 CATEGORY:
	MDSplus, Strings

 CALLING SEQUENCE:
        newLines = BreakMDSname( line )

 INPUTS:
       line - string containing an MDSplus tag or node name      in

 KEYWORD PARAMETERS:
	MAXLENGTH  - max line length (default 72)  OPTIONAL

 OUTPUTS:
	newlines - string array of MDSplus name broken near middle

 EXAMPLE:
    IDL> line = '\ENGINEERING::OPERATIONS.PC_OH_BR_1_CUR_1'
    IDL> newLines = BreakMDSname( line, MAXLENGTH=25 )

 COMMON BLOCKS:
 NOTES:

 MODIFICATION HISTORY:
	01-Apr-99 Written earlier by Bill Davis

(See /p/nstxusr1/util/idl_cvs/breakmdsname.pro)


BREAKSTRING

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       BreakString
 PURPOSE:
      Break a string up and return a string array
 CATEGORY:
       Strings
 CALLING SEQUENCE:
       IDL> str_array = BreakString(longString)
 INPUTS:
       longString = a string of words 
 KEYWORD PARAMETERS:
       Optional Keywords:
	  MAXLENGTH - Maximum length of array elements of output (else=72)
	  DELIMITER - delimiter, else ' ' 
		(see WORDARRAY for multispace delmiters')
	  COMPRESS    - if set, squeeze out extra imbedded blanks
 OUTPUTS:
       str_array = returned array of strings             	out
 COMMON BLOCKS:
       NONE
 EXAMPLE:
    IDL> line = '\ENGINEERING::OPERATIONS.PC_OH_BR_1_CUR_1'
    IDL> newLines = BreakString( BreakString, MAXLENGTH=25, DELIM=':' )
 NOTES:
 MODIFICATION HISTORY:
	31-Jan-02 bug fix and speed improvement 
       1-Apr-99 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/breakstring.pro)


BREAK_PATH

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
    BREAK_PATH

 PURPOSE: 
     Breaks up a path string into its component directories.

 CATEGORY:
       MDSplus, Strings
 CALLING SEQUENCE: 
     Result = BREAK_PATH( PATHS [ /NoCurrent])

 INPUTS: 
     PATHS   = A string containing one or more directory paths.  The
               individual paths are separated by commas, although in UNIX, 
               colons can also be used.  In other words, PATHS has the same 
               format as !PATH, except that commas can be used as a separator 
               regardless of operating system.

               A leading $ can be used in any path to signal that what follows 
               is an environmental variable, but the $ is not necessary.  (In 
               VMS the $ can either be part of the path, or can signal logical
               names for compatibility with Unix.)  Environmental variables
               can themselves contain multiple paths.

 OUTPUT: 
      The result of the function is a string array of directories.
      Unless the NOCURRENT keyword is set, the first element of the array is 
      always the null string, representing the current directory.  All the 
      other directories will end in the correct separator character for the 
      current operating system.

 OPTIONAL INPUT KEYWORD:
      /NOCURRENT = If set, then the current directory (represented by
               the null string) will not automatically be prepended to the
               output.

 PROCEDURE CALLS:
      Functions:  DATATYPE(), STR_SEP()

 REVISION HISTORY:
       Version 1, William Thompson, GSFC, 6 May 1993.
               Added IDL for Windows compatibility.
       Version 2, William Thompson, GSFC, 16 May 1995
               Added keyword NOCURRENT
       Version 3, William Thompson, GSFC, 29 August 1995
               Modified to use OS_FAMILY
       Version 4, Zarro, GSFC, 4 August 1997
               Added trim to input
       Converted to IDL V5.0   W. Landsman 25-Nov-1997

(See /p/nstxusr1/util/idl_cvs/break_path.pro)


BTEST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    BTEST       

 PURPOSE:
    To test bit N in FIX(X)

 CATEGORY:
    Bits, Hardware

 CALLING SEQUENCE:
    YesNo = btest( X, N )

 PARAMETERS:  
    Inputs:
    	X      (REQ) (I) (0 1) (I  F)
           	X is the variable to be tested
   
    	N      (REQ) (I) (0) (I)
           	The bit of X to be tested
     Returned:
    	YESNO  (REQ) (O) (0 1) (I)
           	The result of the test. 1(true) if bit N is set, 0(false)
           	otherwise.

 EXAMPLES:

        YESNO = btest( !X.STYLE, 4 )
        IF YESNO THEN PRINT,'X-axis suppressed' $
                 ELSE PRINT,'Draw X-axis'

        To find points in NEWSIPS which are outside calibrated region:
        YESNO = btest( ABS(NU),1 )             ; look for nu flag = -2
        IND = WHERE (YESNO EQ 0)            ; keep points where yesno = 0
        PLOT,W(IND),F(IND)                  ; plot calibrated points
        
 NOTES:

     Note that negative integers are stored in twos complement form.
     Therefore, the left-most bits are ON rather than OFF as they are for 
     positive numbers. Input the absolute value of X is negative numbers 
     to avoid this problem. 

     This procedure can be used to check the values of complex
     IDL system variables such as ![XYZ].STYLE.

 PROCEDURE:

     Checks whether (FIX(X) OR (NOT 2^N)) = -1 to set the output
     flag YESNO.

 MODIFICATION HISTORY:
	26-Oct-99 Convert from btest to make a function (like FORTRAN)
     Mar  6 1983 RJP GSFC initial program
     Aug 24 1987 RWT GSFC add PARCHECK
     Mar  7 1988 CAG GSFC all VAX RDAF-style prolog
     Jul 13 1990 RWT GSFC Sun mods: use examples pertinent to SUN IDL
                 and add listing of procedure call statement
     Jun 19 1991 PJL GSFC cleaned up; tested on SUN and VAX; updated prolog
     Mar  8 1993 RWT GSFC modify to allow X & YESNO to be vectors and 
                 add documentation about negative numbers.

(See /p/nstxusr1/util/idl_cvs/btest.pro)


CAST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       CAST
 VERSION:
       3.0
 PURPOSE:
       Generalized type casting.  Converts variables whose type code is out 
       of the range [LOW,HIGH] into this range.
 CATEGORY:
       Programming, type conversion
 CALLING SEQUENCE:
       Result = CAST( X, [LOW [,HIGH]])
 INPUTS:
    X
       Numerical, arbitrary, or a character representation of a number(s).
    LOW
       Number representing a type code, range (1:9).  If greater than 9, it is
       set to 9.  If less then 1, or not given, it is set to 1.
 OPTIONAL INPUT PARAMETERS:
    HIGH
       Type code, same as LOW.  Default value is 9.  If provided and less then
       LOW, it is set to LOW.
 KEYWORD PARAMETERS:
    /FIX
       Switch.  If set, the output is filtered through FPU_FIX, eliminating
       floating underflow errors.
 OUTPUTS:
       If the type of X is < LOW, CAST returns X converted to type LOW.
       If the type of X is > HIGH, CAST returns X converted to type HIGH.
       Otherwise CAST returns X.
 OPTIONAL OUTPUT PARAMETERS:
       None.
 COMMON BLOCKS:
       None.
 SIDE EFFECTS:
       None.
 RESTRICTIONS:
       1)  An attempt to convert a string which is NOT a character 
           representation of a number into a numeric type will yield error.
       2)  X cannot be a structure or pointer, but can be a structure element.
       3)  The value 8 for either LOW or HIGH is not allowed (since it 
           corresponds to structure type).  Value of 10 and above is ignored.
 PROCEDURE:
       Identifies the type of X, and if out of the range given by [LOW,HIGH]
       calls the proper conversion routine using the system routine 
       CALL_FUNCTION.  Also uses FPU_FIX and ISNUM from MIDL.
 MODIFICATION HISTORY:
       Created 25-DEC-1991 by Mati Meron.
       Modified 15-JUN-1995 by Mati Meron to accept the new DOUBLECOMPLEX type.
       Modified 25-SEP-1998 by Mati Meron.  Underflow filtering added.

(See /p/nstxusr1/util/idl_cvs/cast.pro)


CH_EXAMPLE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       CH_Example
 PURPOSE:
       a simple example using the GA Crosshair routines
 CATEGORY:
       GUI Graphics, Example
 CALLING SEQUENCE:
       CH_Example
 COMMON BLOCKS:
       ch_example
 NOTES:
       Your display may have to be set to 256 colors to see the crosshairs.
 MODIFICATION HISTORY:
       Written by Bill Davis, 8/29/97

       GA Crosshair routines originally written by John Ferron. 
       Now maintained by T. Terpstra

(See /p/nstxusr1/util/idl_cvs/ch_example.pro)


CH_REGISTER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  	ch_register
 PURPOSE:
	register window for crosshair routines

 CATEGORY:
	GUI Graphics, Cursor Cross-hairs

 EXAMPLE:
	See ch_example.pro

 MODIFIED:
	30-Oct-00 Override !P.PSYM & !P.LINESTYLE for cros-hairs
	04-Dec-99 Make mask bit 6, so it's red when used with MK_COLOR
	29-Mar-99 Added newX, newY & newP keywords to CH_SET for changing
		  plotting parameters
	26-Jan-99 Taken from GA   [BD]
		  Combining all ch_ files here, since this must be called 1st.

(See /p/nstxusr1/util/idl_cvs/ch_register.pro)


CLEANPLOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       CLEANPLOT
 PURPOSE:
       Reset all system variables (!P,!X,!Y,!Z) to their default values
 CATEGORY:             
	Plotting
 EXPLANATION:
       Reset all system variables (!P,!X,!Y,!Z) which are set by the user 
       and which affect plotting to their default values.

 CALLING SEQUENCE:
       Cleanplot

 INPUTS:       
       None

 OUTPUTS:      
       None

 SIDE EFFECTS: 
       The system variables that concern plotting are reset
       to their default values.  A message is output for each
       variable changed.   The CRANGE, S, WINDOW, and REGION fields of the
       !X, !Y, and !Z system variables are not checked since these are 
       set by the graphics device and not by the user.    

 PROCEDURE:
       This does NOT reset the plotting device.
       This does not change any system variables that don't control plotting.

 RESTRICTIONS:
       If user default values for !P, !X, !Y and !Z are different from
       the defaults adopted below, user should change P_old etc accordingly

 MODIFICATION HISTORY:
       Written IDL Version 2.3.0  W. Landsman & K. Venkatakrishna May '92
       Handle new system variables in V3.0.0     W. Landsman   Dec 92
       Assume user has at least V3.0.0           W. Landsman   August 95
       V5.0 has 60 instead of 30 TICKV values    W. Landsman   Sep. 97
       Change !D.N_COLORS to !D.TABLE_SIZE for 24 bit displays
               W. Landsman  April 1998
       

(See /p/nstxusr1/util/idl_cvs/cleanplot.pro)


CLEARPLT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:                 
	CLEARPLT

 PURPOSE:              
	This procedure will clear or zero all or a selection
       of the system plot variables

 CATEGORY:             
	Plotting

 CALLING SEQUENCE:     
			clearplt,/all           ;clear the !p, !x, !y, !z
                       clearplt,/x,/z          ;clear the !x and !z variables
                       clearplt,/x             ;only clear the !x variable
                       clearplt,/x,/invert     ;clear all except the !x

 INPUTS:
       KEYWORDS:
               x,y,z,p = clear the appropriate variable
               all     = clear all, this is equivalent to /x,/y,/z,/p
               invert  = invert the logic. Clear all unselected variables.
                         Therefore "clearplt,/all,/invert" does nothing.

 OUTPUTS:      none

 COMMON BLOCKS:
       none.
 SIDE EFFECTS:
               The sytem plot variables are changed.

 MODIFICATION HISTORY:
	20-Apr-99 [BD] more things cleared for !P
       Written by: Trevor Harris, Physics Dept., University of Adelaide,
               July, 1990.

(See /p/nstxusr1/util/idl_cvs/clearplt.pro)


COLOR_STATUS_EXAMPLE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       color_status_example
 PURPOSE:
       Example of color status fields on a widget.
 EXPLANATION:
	Makes two rows, each with two buttons to send a color to an
	adjacent status field. The status field is just a window in which
	the appropriate colors are drawn.  MK_COLOR, or a similar routine,
	should be used for consistant color display.
 CATEGORY:
       GUI, Example, Color, Monitoring Application
 CALLING SEQUENCE:
       IDL> color_status_example
 INPUTS:
       none.  
 KEYWORD PARAMETERS:
       none.  
 OUTPUTS:
       none.  
 COMMON BLOCKS:
       info
 ROUTINES USED:
	MK_COLOR
 EXAMPLE:
	IDL> color_status_example
 NOTES:
       The status fields are initially the background color.
	A real program might want to save !D.WINDOW before the TV commands
	and restore it immediately afterwards.
 MODIFICATION HISTORY:
       11-May-00 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/color_status_example.pro)


CONVOLVE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       CONVOLVE
 PURPOSE:
       Convolution of an image with a Point Spread Function (PSF)
 CATEGORY:
	Image Processing, Math
 EXPLANATION:
       The default is to compute the convolution using a product of 
       Fourier transforms (for speed).

 CALLING SEQUENCE:

       imconv = convolve( image1, psf, FT_PSF = psf_FT )
  or:
       correl = convolve( image1, image2, /CORREL )
  or:
       correl = convolve( image, /AUTO )

 INPUTS:
       image = 2-D array (matrix) to be convolved with psf
       psf = the Point Spread Function, (size < or = to size of image).

 OPTIONAL INPUT KEYWORDS:

       FT_PSF = passes out/in the Fourier transform of the PSF,
               (so that it can be re-used the next time function is called).
       FT_IMAGE = passes out/in the Fourier transform of image.

       /CORRELATE uses the conjugate of the Fourier transform of PSF,
               to compute the cross-correlation of image and PSF,
               (equivalent to IDL function convol() with NO rotation of PSF)

       /AUTO_CORR computes the auto-correlation function of image using FFT.

       /NO_FT overrides the use of FFT, using IDL function convol() instead.
               (then PSF is rotated by 180 degrees to give same result)
 METHOD:
       When using FFT, PSF is centered & expanded to size of image.
 HISTORY:
       written, Frank Varosi, NASA/GSFC 1992.
       Converted to IDL V5.0   W. Landsman   September 1997

(See /p/nstxusr1/util/idl_cvs/convolve.pro)


CW_BGROUP3_6

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CW_BGROUP3_6

 PURPOSE:
	CW_BGROUP3_6 is a compound widget that simplifies creating
	a base of buttons. It handles the details of creating the
	proper base (standard, exclusive, or non-exclusive) and filling
	in the desired buttons. Events for the individual buttons are
	handled transparently, and a CW_BGROUP3_6 event returned. This
	event can return any one of the following:
		- The Index of the button within the base.
		- The widget ID of the button.
		- The name of the button.
		- An arbitrary value taken from an array of User values.

 CATEGORY:
	Compound widgets.

 CALLING SEQUENCE:
		Widget = CW_BGROUP3_6(Parent, Names)

	To get or set the value of a CW_BGROUP3_6, use the GET_VALUE and
	SET_VALUE keywords to WIDGET_CONTROL. The value of a CW_BGROUP3_6
	is:

		-----------------------------------------------
		Type		Value
		-----------------------------------------------
		normal		None
		exclusive   	Index of currently set button
		non-exclusive	Vector indicating the position
				of each button (1-set, 0-unset)
		-----------------------------------------------


 INPUTS:
       Parent:		The ID of the parent widget.
	Names:		A string array, containing one string per button,
			giving the name of each button.

 KEYWORD PARAMETERS:

	BUTTON_UVALUE:	An array of user values to be associated with
			each button and returned in the event structure.
	COLUMN:		Buttons will be arranged in the number of columns
			specified by this keyword.
	EVENT_FUNCT:	The name of an optional user-supplied event function 
			for buttons. This function is called with the return
			value structure whenever a button is pressed, and 
			follows the conventions for user-written event
			functions.
	EXCLUSIVE:	Buttons will be placed in an exclusive base, with
			only one button allowed to be selected at a time.
	FONT:		The name of the font to be used for the button
			titles. If this keyword is not specified, the default
			font is used.
	FRAME:		Specifies the width of the frame to be drawn around
			the base.
	IDS:		A named variable into which the button IDs will be
			stored, as a longword vector.
	LABEL_LEFT:	Creates a text label to the left of the buttons.
	LABEL_TOP:	Creates a text label above the buttons.
	MAP:		If set, the base will be mapped when the widget
			is realized (the default).
	NONEXCLUSIVE:	Buttons will be placed in an non-exclusive base.
			The buttons will be independent.
	NO_RELEASE:	If set, button release events will not be returned.
	RETURN_ID:	If set, the VALUE field of returned events will be
			the widget ID of the button.
	RETURN_INDEX:	If set, the VALUE field of returned events will be
			the zero-based index of the button within the base.
			THIS IS THE DEFAULT.
	RETURN_NAME:	If set, the VALUE field of returned events will be
			the name of the button within the base.
	ROW:		Buttons will be arranged in the number of rows
			specified by this keyword.
	SCROLL:		If set, the base will include scroll bars to allow
			viewing a large base through a smaller viewport.
	SET_VALUE:	The initial value of the buttons. This is equivalent
			to the later statement:

			WIDGET_CONTROL, widget, set_value=value

	SPACE:		The space, in pixels, to be left around the edges
			of a row or column major base. This keyword is
			ignored if EXCLUSIVE or NONEXCLUSIVE are specified.
	UVALUE:		The user value to be associated with the widget.
	XOFFSET:	The X offset of the widget relative to its parent.
	XPAD:		The horizontal space, in pixels, between children
			of a row or column major base. Ignored if EXCLUSIVE
			or NONEXCLUSIVE are specified.
	XSIZE:		The width of the base. 
	X_SCROLL_SIZE:	The width of the viewport if SCROLL is specified.
	YOFFSET:	The Y offset of the widget relative to its parent.
	YPAD:		The vertical space, in pixels, between children of
			a row or column major base. Ignored if EXCLUSIVE
			or NONEXCLUSIVE are specified.
	YSIZE:		The height of the base. 
	Y_SCROLL_SIZE:	The height of the viewport if SCROLL is specified.

 OUTPUTS:
       The ID of the created widget is returned.

 SIDE EFFECTS:
	This widget generates event structures with the following definition:

		event = { ID:0L, TOP:0L, HANDLER:0L, SELECT:0, VALUE:0 }

	The SELECT field is passed through from the button event. VALUE is
	either the INDEX, ID, NAME, or BUTTON_UVALUE of the button,
	depending on how the widget was created.

 RESTRICTIONS:
	Only buttons with textual names are handled by this widget.
	Bitmaps are not understood.

 MODIFICATION HISTORY:
	15 June 1992, AB
	7 April 1993, AB, Removed state caching.

(See /p/nstxusr1/util/idl_cvs/cw_bgroup3_6.pro)


CW_FIELD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CW_FIELD

 PURPOSE:
	This widget cluster function manages a data entry field widget.
	The field consists of a label and a text widget.  CW_FIELD's can
	be string fields, integer fields or floating-point fields.  The
	default is an editable string field.

 CATEGORY:
	GUI, Compound Widgets, Entry

 CALLING SEQUENCE:
	Result = CW_FIELD(Parent)

 INPUTS:
	Parent:	The widget ID of the widget to be the field's parent.

 KEYWORD PARAMETERS:
	TITLE:	A string containing the text to be used as the label for the
		field.  The default is "Input Field:".

	VALUE:	The initial value in the text widget.  This value is
		automatically converted to the type set by the STRING,
		INTEGER, and FLOATING keywords described below.

	UVALUE:	A user value to assign to the field cluster.  This value
		can be of any type.

	FRAME:	The width, in pixels, of a frame to be drawn around the
		entire field cluster.  The default is no frame.

RETURN_EVENTS:	Set this keyword to make cluster return an event when a
		 is pressed in a text field.  The default is
		not to return events.  Note that the value of the text field
		is always returned when the WIDGET_CONTROL, field, GET_VALUE=X
		command is used.

   ALL_EVENTS: Like RETURN_EVENTS but return an event whenever the
		contents of a text field have changed.

	COLUMN:	Set this keyword to center the label above the text field.
		The default is to position the label to the left of the text
		field.

	ROW:	Set this keyword to position the label to the left of the text
		field.  This is the default.

	XSIZE:	An explicit horizontal size (in characters) for the text input
		area.  The default is to let the window manager size the
		widget.  Using the XSIZE keyword is not recommended.

	YSIZE:	An explicit vertical size (in lines) for the text input
		area.  The default is 1.

	STRING:	Set this keyword to have the field accept only string values.
		Numbers entered in the field are converted to their string
		equivalents.  This is the default.

     FLOATING:	Set this keyword to have the field accept only floating-point
		values.  Any number or string entered is converted to its
		floating-point equivalent.

      INTEGER:	Set this keyword to have the field accept only integer values.
		Any number or string entered is converted to its integer
		equivalent (using FIX).  For example, if 12.5 is entered in
		this type of field, it is converted to 12.

	LONG:	Set this keyword to have the field accept only long integer
		values.  Any number or string entered is converted to its
		long integer equivalent (using LONG).

	FONT:	A string containing the name of the X Windows font to use
		for the TITLE of the field.

    FIELDFONT:	A string containing the name of the X Windows font to use
		for the TEXT part of the field.

	NOEDIT:	Normally, the value in the text field can be edited.  Set this
		keyword to make the field non-editable.

 OUTPUTS:
	This function returns the widget ID of the newly-created cluster.

 COMMON BLOCKS:
	None.

 PROCEDURE:
	Create the widgets, set up the appropriate event handlers, and return
	the widget ID of the newly-created cluster.

 EXAMPLE:
	The code below creates a main base with a field cluster attached
	to it.  The cluster accepts string input, has the title "Name:", and
	has a frame around it:

		base = WIDGET_BASE()
		field = CW_FIELD(base, TITLE="Name:", /FRAME)
		WIDGET_CONTROL, base, /REALIZE

 MODIFICATION HISTORY:
 	Written by:	Keith R. Crosley   June 1992
			KRC, January 1993 -- Added support for LONG
					     integers.
		        AB, 7 April 1993, Removed state caching.
			JWG, August 1993, Completely rewritten to make
				use of improved TEXT widget functionality
			ACY, 25 March, 1994, fix usage of FRAME keyword
                       KDB, May 1994, Initial value =0 would result
                                      in a null text field. Fixed
                                      keyword check.

(See /p/nstxusr1/util/idl_cvs/cw_field.pro)


DATATYPE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       DATATYPE
 PURPOSE:
       Datatype of variable as a string (3 char or spelled out).
 CATEGORY:
	Programming
 CALLING SEQUENCE:
       typ = datatype(var, [flag])
 INPUTS:
       var = variable to examine.         in
       flag = output format flag (def=0). in
 KEYWORD PARAMETERS:
       Keywords:
         /DESCRIPTOR returns a descriptor for the given variable.
           If the variable is a scalar the value is returned as
           a string.  If it is an array a description is return
           just like the HELP command gives.  Ex:
           datatype(fltarr(2,3,5),/desc) gives
             FLTARR(2,3,5)  (flag always defaults to 3 for /DESC).
 OUTPUTS:
       typ = datatype string or number.   out
          flag=0    flag=1      flag=2    flag=3
          UND       Undefined   0         UND
          BYT       Byte        1         BYT
          INT       Integer     2         INT
          LON       Long        3         LON
          FLO       Float       4         FLT
          DOU       Double      5         DBL
          COM       Complex     6         COMPLEX
          STR       String      7         STR
          STC       Structure   8         STC
          DCO       DComplex    9         DCOMPLEX
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
       Written by R. Sterner, 24 Oct, 1985.
       RES 29 June, 1988 --- added spelled out TYPE.
       R. Sterner, 13 Dec 1990 --- Added strings and structures.
       R. Sterner, 19 Jun, 1991 --- Added format 3.
       R. Sterner, 18 Mar, 1993 --- Added /DESCRIPTOR.
       R. Sterner, 1995 Jul 24 --- Added DCOMPLEX for data type 9.
       Johns Hopkins University Applied Physics Laboratory.

 Copyright (C) 1985, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /p/nstxusr1/util/idl_cvs/datatype.pro)


DATE2JD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       DATE2JD
 PURPOSE:
       Convert a date string to Julian Day number.
 CATEGORY:
	Dates
 CALLING SEQUENCE:
       jd = date2jd(date)
 INPUTS:
       date = date string.                in
 KEYWORD PARAMETERS:
 OUTPUTS:
       jd = Returned Julian Day number.   out
 COMMON BLOCKS:
 NOTES:
       Note: date must contain month as a name of 3 or more leeters.
 MODIFICATION HISTORY:
       R. Sterner, 1996 Sep 15

 Copyright (C) 1996, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /p/nstxusr1/util/idl_cvs/date2jd.pro)


DATE2YMD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       DATE2YMD
 PURPOSE:
       Date text string to the numbers year, month, day.
 CATEGORY:
	Dates
 CALLING SEQUENCE:
       date2ymd,date,y,m,d
 INPUTS:
       date = date string.             in
 KEYWORD PARAMETERS:
 OUTPUTS:
       y = year number.                out
       m = month number.               out
       d = day number.         out
 COMMON BLOCKS:
 NOTES:
       Notes: The format of the date is flexible except that the
         month must be month name.
         Dashes, commas, periods, or slashes are allowed.
         Some examples: 23 sep, 1985     sep 23 1985   1985 Sep 23
         23/SEP/85   23-SEP-1985   85-SEP-23   23 September, 1985.
         Doesn't check if month day is valid. Doesn't
         change year number (like 86 does not change to 1986).
         Dates may have only 2 numeric values, year and day. If
         both year & day values are < 31 then day is assumed first.
         systime() can be handled: date2ymd,systime(),y,m,d
         For invalid dates y, m and d are all set to -1.
 MODIFICATION HISTORY:
       Written by R. Sterner, 29 Oct, 1985.
       Johns Hopkins University Applied Physics Laboratory.
       25-Nov-1986 --- changed to REPCHR.
       RES 18 Sep, 1989 --- converted to SUN.
       R. Sterner, 1994 Mar 29 --- Modified to handle arrays.

 Copyright (C) 1985, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /p/nstxusr1/util/idl_cvs/date2ymd.pro)


DECODE_GRAY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       DECODE_GRAY
 PURPOSE:
  	Convert a gray-code value to an integer
 CATEGORY:
       Bits, CAMAC, Hardware, Stepper Motor Control
 CALLING SEQUENCE:
       IDL> int = DECODE_GRAY(grayCode)
 INPUTS:
       grayCode = number in gray code.  
 KEYWORD PARAMETERS:
     Optional Input:
	  NBits - # of bits to decode; defaults to 8
 OUTPUTS:
       int = returned integer                 			out
 COMMON BLOCKS:
       NONE
 EXAMPLES:
	IDL> print,DECODE_GRAY(1)
	       1
	IDL> print,DECODE_GRAY(2)
	       3
	IDL> print,DECODE_GRAY(255)
	     170
	IDL> print,DECODE_GRAY(255+512)
	     170
	IDL> print,DECODE_GRAY(255+512,nbits=16)
	     853
 NOTES:
	This can probably be sped up considerably.
 MODIFICATION HISTORY:
       26-Oct-99 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/decode_gray.pro)


DELFROMLIST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       delfromlist
 PURPOSE:
       delete ith element from a list
 CATEGORY:
	Strings, Lists
 CALLING SEQUENCE:
        newList = delfromlist( list, i )
 INPUTS:
       list - string array      				in
	i    - integer (starting at 0) of line not wanted   	in
 KEYWORD PARAMETERS:
 OUTPUTS:
	newList: string array without ith line
 EXAMPLE:
	IDL> list=['a','b','c','d']
	IDL> print,delfromlist(list,1)
	a c d
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
 Written 03-Mar-99 by Bill Davis

(See /p/nstxusr1/util/idl_cvs/delfromlist.pro)


DIALOG_INPUT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     DIALOG_INPUT

 PURPOSE:
     A modal (blocking) dialog widget to input a line of text.
     The dialog must be dismissed, by entering text and pressing the
     Return key, or by clicking on the 'Ok' or 'Cancel' button before
     execution of the calling program can continue.

 TYPE:
     FUNCTION

 CATEGORY:
     GUI, Input, WIDGETS

 CALLING SEQUENCE:
     result = DIALOG_INPUT ()

 INPUTS:
     NONE

 KEYWORD PARAMETERS:

     PROMPT: Optional STRING or STRARR displayed on the widget.
         If the keyword NFIELDS is set, then PROMPT must be a
         STRARR of length NFIELDS.  If NFIELDS is not set, and PROMPT is
         a STRARR, each element of the array will appear on a separate line.

         If not supplied, default = 'Enter Text'

     TITLE: Window title [default = 'dialog_input']

     INITIAL: Initial value to show in the input area.  If PROMPT is 
         supplied, this must be a array of length FIELDS.

     XSIZE, YSIZE: The width and height of the dialog

     WIDTH: Set the width of the input field IN CHARACTERS.  

     NFIELDS: Show multiple input fields.  If PROMPT and/or INITIAL are
         supplied, they must be STRARR of length FIELDS.  
 
     DIALOG_PARENT: Set this keyword to the widget ID of a widget over
         which the message dialog should be positioned. When displayed,
         the DIALOG_INPUT dialog will be positioned over the specified
         widget. Dialogs are often related to a non-dialog widget tree.
         The ID of the widget in that tree to which the dialog is most
         closely related should be specified.

     RETURN_EVENTS:	
	Set this keyword to make cluster return an event when a
	 is pressed in a text field.  The default is
	not to return events.  

     OK: STRING label for the 'Ok' button (default = 'Ok')
     CANCEL: STRING label for the 'Cancel' button (default = 'Cancel')

 OUTPUTS:
     result: STRING or STRARR of input text, or '' if dialog is cancelled

 COMMON BLOCKS:
     NONE

 SIDE EFFECTS:
     Creates a modal widget

 RESTRICTIONS:
     NONE

 DEPENDENCIES:
     NONE

 MODIFICATION HISTORY:
     02-Jul-01 Fixed bug for floating point values [BD]
     13-Sep-00 Added RETURN_EVENTS keyword [BD]
     03-Feb-00 Added FLOATING, INTEGER and LONG keywords [BD]

     v1.03: RSM, Aug 1998, Added WIDTH keyword to set the width of the 
            input field IN CHARACTERS.  Fixed layout bug when using NFIELDS.

     v1.02: RSM, May 1998, Non-backward compatible changes to allow multiple
            input fields.

     v1.01: RSM, Mar 1998, fixed error when used with a modal toplevel base.

     v1.0:  Written, Robert.Mallozzi@msfc.nasa.gov, July 1997.

(See /p/nstxusr1/util/idl_cvs/dialog_input.pro)


DOMAINNAME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       domainName
 PURPOSE:
       Return TCP/IP domain name from Unix systems
 CATEGORY:
       Utility, OS-specific, Networking
 CALLING SEQUENCE:
       IDL> thisDomain = domainName()
 INPUTS:
       None 
 KEYWORD PARAMETERS:
 OUTPUTS:
       thisDomain = e.g., pppl or gat.com (depends on system setup)
 COMMON BLOCKS:
       NONE
 NOTES:
	This can take from 0.3-0.5 seconds.

	If called from VMS, will print a warning (once) and return
	some.vms.system as the domain name.
 MODIFICATION HISTORY:
       16-Apr-99 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/domainname.pro)


DT_NICENUMBER

[Previous Routine] [Next Routine] [List of Routines]
  NAME:
 	dt_nicenumber

  PURPOSE:
 	Makes nice delta time numbers, by rounding to 3 significant digits
	Can be used if you want to know if you have a constant timebase.

 CATEGORY:
       Math, Graphics

 CALLING SEQUENCE:
        niceDts = dt_nicenumber( dts )

 INPUTS:
	dts - an array of numbers

 KEYWORD PARAMETERS:
    Optional Inputs:
	nSignificantDigits - number of significant digits to round to
				(defaults to 3)

  EXAMPLE:
	IDL> dt=[2.0003,2.15,.2003,.20009,22.0004,.250002,.5001,100000.1]
	IDL> print,dt_nicenumber(dt) 
	   2.00000    2.15000   0.200000   0.200000    22.0000   0.250000
	   0.500000    100000.

  HISTORY:
  	03-Nov-00 Rewrote [BD]

(See /p/nstxusr1/util/idl_cvs/dt_nicenumber.pro)


EFITMOVIES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 	efitmovies

 PURPOSE:
       Plot EFIT field lines, Thomson Scattering Density and Temperature 
	and, optionally, Fast Camera images. Instead of Fast Camera, can
	plot H-alpha (or another) signal vs. time.

 CATEGORY:
       2-D Plotting, Animation, NSTX, EFIT, Thomson Scattering

 CALLING SEQUENCE:
   to get a single frame:
	IDL> efitmovies, shot, time=0.2, /thom, signame='\wf::ip',  $
                        sigt1=0, sigt2=.4

   to get an animation:
	IDL> efitmovies,shot,time=[0.05,0.317],/thom,/animate,max=40

   to get an animation with H-alpha time trace instead of Fast Camera images:
	IDL> efitmovies,107314,/thom,/anim,time=[.05,.2], $
			/signame,sigtitle='H-alpha'

 INPUTS:
       shot = nstx shot number  

 KEYWORD PARAMETERS:
    Keywords:
	time - 2-element array for animation; single value for one frame
	thomson - if set, will plot Thomson Te and Ne below EFIT contours
	animate - if set, will make a movie in an IDL XINTERANIMATE window.
	maxFrames - max # of frames over time range -- necessary if X-memory
		    is limited.
	pixMap - if set, will not send each frame to the screen (faster)
	sigName - if set, will not show Fast Camera images, but this
		  signal vs. time (defaults to \passivespec::BAYC_DALF_HAIFA)
	sigT1 - starting time of signal vs. time plot
	sigT2 - ending time of signal vs. time plot
	sigTitle - if set, will be displayed above sigName plot,
		   else tries to get label from MDSplus
	overlayTe - overlay Thomson Te and Ne, instead of on left and right

 OUTPUTS:
       none

 LIMITATIONS:
       Some reds are green on printer.
 NOTES:
   to create an FLC animation out of ppm files:

       IDL> efitmovies,106892,/pix,time=[0.05,0.317],/thom,max=400,/ppmOut

	alias ppm2fli '/u/bdavis/FTP/ppm2fli-2.1/ppm2fli'
	cd /tmp/idl2ppm.frames/
	/bin/ls -1 *.ppm > pics.list
	ppm2fli  -g 600x600 -s 180 pics.list ~/public_html/movies/xsec106892.fli

     the -g parameter specifies the size
     -s is the rate (bigger is slower)

   to get tiff files from the fastcamera system into the right taurus directory:
	IDL> .run /u/bdavis/Anim/get_tifs
	IDL> get_tifs,  shot
 MODIFICATION HISTORY:
       28-May-02 Added /signame keyword and overlayTe
	Original written by Dave Gates

(See /p/nstxusr1/util/idl_cvs/efitmovies.pro)


FACTOR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       FACTOR
 PURPOSE:
       Find prime factors of a given number.
 CATEGORY:
	Math
 CALLING SEQUENCE:
     FACTOR, x, p, n
 INPUTS:
      x = Number to factor, scalar positive integer
 OUTPUT PARAMETERS:
      p = Array of prime numbers.    
      n = Count of each element of p. 
 INPUT KEYWORD PARAMETER: 
      /HELP - Display help documentation
 PROCEDURES USED:
      PRIME()
      Also see numfactors, print_fact in the JHUAPL Library
 MODIFICATION HISTORY:
       R. Sterner.  4 Oct, 1988.
       RES 25 Oct, 1990 --- converted to IDL V2.
       Johns Hopkins University Applied Physics Laboratory.

 Copyright (C) 1988, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.
       Converted to IDL V5.0   W. Landsman   September 1997

(See /p/nstxusr1/util/idl_cvs/factor.pro)


FDECOMP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FDECOMP
 PURPOSE:
	Routine to decompose a file name for any operating system

 CATEGORY:
	Files, OS Specific, Strings
 CALLING SEQENCE:
	FDECOMP, filename, disk, dir, name, qual, version, [OSFamily = ]

 INPUT:
	filename - string file name, scalar

 OUTPUTS:
	All the output parameters are scalar strings
	disk - disk name, always '' on a Unix machine, scalar string
	dir - directory name, scalar string
	name - file name, scalar string
	qual - qualifier, set equal to the characters beyond the last "."
	version - version number, always '' on a non-VMS machine, scalar string

 OPTIONAL INPUT KEYWORD:
	OSFamily - one of the four scalar strings specifying the operating 
		system:  'vms','windows','MacOS' or 'unix'.    If not supplied,
		then OS_FAMILY() is used to determine the operating system.
 EXAMPLES:
	Consider the following file names 

	Unix:    file = '/rsi/idl40/avg.pro' 
	VMS:     file = '$1$dua5:[rsi.idl40]avg.pro;3
	Mac:     file = 'Macintosh HD:Programs:avg.pro'
	Windows: file =  'd:\rsi\idl40\avg.pro'
	
	then IDL> FDECOMP,  file, disk, dir, name, qual, version
	will return the following

		  Disk             Dir          Name        Qual     Version
	Unix:      ''            '/rsi/idl40/'  'avg'       'pro'       ''
	VMS:     '$1$dua5'       '[RSI.IDL40]'  'avg'       'pro'       '3'
	Mac:     'Macintosh HD'  ':Programs:'   'avg'       'pro'       ''
	Windows:    'd:'         \rsi\idl40\    'avg'       'pro'       ''

 NOTES:
	(1) All tokens are removed between
		1) name and qual  (i.e period is removed)
		2) qual and ver   (i.e. VMS semicolon is removed)
	(2) On VMS the filenames "MOTD" and "MOTD." are distinguished by the 
	    fact that qual = '' for the former and qual = ' ' for the latter.

 ROUTINES CALLED:
	Function GETTOK(), OS_FAMILY()
	Users with V4.0 or later can replace OS_FAMILY() with !VERSION.OS_FAMILY
 HISTORY
	version 1  D. Lindler  Oct 1986
	Include VMS DECNET machine name in disk    W. Landsman  HSTX  Feb. 94
	Converted to Mac IDL, I. Freedman HSTX March 1994
          

(See /p/nstxusr1/util/idl_cvs/fdecomp.pro)


FILTER_IMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       FILTER_IMAGE

 PURPOSE:
       Identical to MEDIAN or SMOOTH but handle edges and allow iterations.
 CATEGORY:
       Image Processing
 EXPLANATION:
       Computes the average and/or median of pixels in moving box,
       replacing center pixel with the computed average and/or median,
               (using the IDL smooth or median functions).
       The main reason for using this function is the options to
       also process the pixels at edges and corners of image, and,
       to apply iterative smoothing simulating convolution with Gaussian,
       and/or to convolve image with a Gaussian kernel.

 CALLING SEQUENCE:
       Result = filter_image( image, SMOOTH=box_width, /MEDIAN, /ALL )

 INPUT:
       image = 2-D array (matrix)

 OPTIONAL INPUT KEYWORDS:
       SMOOTH = scalar (odd) integer specifying the width of a square box 
               for moving average, in # pixels.
       /SMOOTH  means use box width = 3 pixels for smoothing.

       MEDIAN = scalar (odd) integer specifying the width of square moving 
               box for median filter, in # pixels.
       /MEDIAN  means use box width = 3 pixels for median filter.
   
       /ALL_PIXELS causes the edges of image to be filtered as well,
               accomplished by reflecting pixels adjacent to edges outward.

       /ITERATE means apply smooth(image,3) iteratively for a count of
               (box_width-1)/2 times (=radius), when box_width >= 5.
               This is equivalent to convolution with a Gaussian PSF
               of FWHM = 2 * sqrt( radius ) as radius gets large.
               Note that /ALL_PIXELS is automatically applied,
               giving better results in the iteration limit.
               (also, MEDIAN keyword is ignored when /ITER is specified).

       FWHM_GAUSSIAN = Full-width half-max of Gaussian to convolve with image. 
                       FWHM can be a single number (circular beam),
                       or 2 numbers giving axes of elliptical beam.

       /NO_FT_CONVOL causes the convolution to be computed directly,
               with IDL function convol.
               The default is to use FFT when factors of size are all LE 13.
               (note that external function convolve handles both cases)

 RESULT:
       Function returns the smoothed, median filtered, or convolved image.
       If both SMOOTH and MEDIAN are specified, median filter is applied first.

 EXAMPLES:
       To apply 3x3 moving median filter and
       then 3x3 moving average, both applied to all pixels:

               Result = filter_image( image, /SMOOTH, /MEDIAN, /ALL )

       To iteratively apply 3x3 moving average filter for 4 = (9-1)/2 times,
       thus approximating convolution with Gaussian of FWHM = 2*sqrt(4) = 4 :

               Result = filter_image( image, SMOOTH=9, /ITER )

       To convolve all pixels with Gaussian of FWHM = 3.7 x 5.2 pixels:

               Result = filter_image( image, FWHM=[3.7,5.2], /ALL )

 EXTERNAL CALLS:
       function psf_gaussian
       function convolve
       pro factor
       function prime          ;all these called only if FWHM is specified.

 PROCEDURE:
       If /ALL_PIXELS or /ITERATE keywords are set then
       create a larger image by reflecting the edges outward,
       then call the IDL median and/or smooth function on the larger image,
       and just return the central part (the orginal size image).
 HISTORY:
       Written, 1991, Frank Varosi, NASA/GSFC.
       FV, 1992, added /ITERATE option.
       FV, 1993, added FWHM_GAUSSIAN= option.
       Converted to IDL V5.0   W. Landsman   September 1997

(See /p/nstxusr1/util/idl_cvs/filter_image.pro)


FINDMDSNODES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        FindMDSNodes
 PURPOSE:
      Search for MDSplus nodes with name containing a string
 CATEGORY:
       MDSplus, Search, Utiltiy
 CALLING SEQUENCE:
       IDL> paths = FindMDSNodes( nodeStr, status=status )
 INPUTS:
       nodeStr - string to search nodenames for
 KEYWORD PARAMETERS:
       JustText - if set, just look for Text nodes (no effect if /TAGS set)
	nonNodeStr - exclude nodes in returned array if this string found in name
	tags - if set, just look for nodes with tags, and search tagnames
	status - status from mdsvalue call
 OUTPUTS:
	paths - paths satifying search criteria
 COMMON BLOCKS:
       none
 EXAMPLE:
	IDL> stat = openMDSshot('wf', 104500 )
	IDL> paths = FindMDSNodes( 'ip', status=status )
	IDL> paths = FindMDSNodes( 'ip',non='formula' )  ; exclude formula nodes
 NOTES:
	tree must already be open before FindMDSNodes can be called
	if no records are found in current tree, returns ['']
 MODIFICATION HISTORY:
	31-Jan-01 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/findmdsnodes.pro)


FINDMDSTIME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       findMDStime
 PURPOSE:
        find a time within an MDSplus shot, correspoding to
	 the time of Max Ip, time of Max W-tot, etc. 
	signals come from the EFIT tree when possible.
 CATEGORY:
       MDSplus
 CALLING SEQUENCE:
       IDL> time = findMDStime( /maxIp )
 INPUTS:
       shotListString - a string indicating shots, 
		e.g., 107694 108305 108330-108350
		 or   108100+20		
			(this returns shots 108100, 108101,...,108120)
       nshots - # of shots to search over (def=10)
 KEYWORD PARAMETERS:
	maxIp - if set, return time of Max Ip (less 3 msec)
	MaxNeutrons - if set, return time of Maximum Neutron production
	MaxBetaN - if set, return time of Beta Normal 
	MaxPTot - if set, return time of maximum heating power
	MaxWMHD - if set, return time of maximum Plasma Stored Energy
	MaxTAUMHD - if set, return time of maximum Energy confinement time
	MaxDENS - if set, return time of maximum Line Density
	shot - if set, will return value for this shot, else for opened shot
 OUTPUTS:
       time in seconds         			
 EXAMPLE:
	IDL> time = findMDStime( /maxIp )
 NOTES:
	if more than one time is found for the max, a median time will be
	returned.
 MODIFICATION HISTORY:
       14-Jun-02 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/findmdstime.pro)


FINDVALIDSHOTS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       findvalidshots
 PURPOSE:
      Search MDS Plus Trees for valid shot numbers with data in a particular node
 
 CATEGORY:
       MDSplus, Utility
 CALLING SEQUENCE:
       IDL> findvalidshots ; This is interactive widget version
 or    IDL>findvalidshots, signal,beginshotnumber,endshotnumber
 
 INPUTS:
       none 
 KEYWORD PARAMETERS:
       none
 OUTPUTS:
       on screen: valid shot numbers in entered range               			
 COMMON BLOCKS:
       none
 EXAMPLE:  IDL>findvalidshots, '\passivespec::vs2.rawdata:spectra',104500,104515

 NOTES:
       
 MODIFICATION HISTORY:
       4-JAN-2001 Written by Dana Mastrovito, PPPL

(See /p/nstxusr1/util/idl_cvs/findvalidshots.pro)


FIRSTSIGNAME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       firstSigName
 PURPOSE:
       Return the first signal name in a TDI expression.
	Needed when you want the xaxis from a combination of signals.
 CATEGORY:
       MDSplus
 CALLING SEQUENCE:
	sig1 = firstSigName( TDIexpr )
 INPUTS:
   	TDIexpr - TDI expression. Can be just a signal name, or '(\ip1+\ip2)/2'
 RETURNED:
	sig1 - first signal name in TDI expr, e.g., '\ip1'
 KEYWORDS:
    Optional Outputs:
	FOUNDTDI - 1 returned if TDI in node 
 COMMON BLOCKS:
       none
 EXAMPLE:
 	IDL> print, firstSigName( '\engineering::ip1+\engineering::ip2' )
	   \engineering::ip1
 LIMITATIONS:
 MODIFICATION HISTORY:
	01-May-01 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/firstsigname.pro)


FULLMDSPATH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       fullMDSpath
 PURPOSE:
       Return an MDSplus path for a tag
 CATEGORY:
       MDSplus
 CALLING SEQUENCE:
       fullpath = fullMDSpath( tag )
 INPUTS:
       tag
 KEYWORD PARAMETERS:
	shot - if present, will open NSTX tree for this shot
 OUTPUTS:
	fullpaths - returns full pathnames of tags found
 EXAMPLE:
	IDL> stat=openMDSshot('microwave',101523)
	IDL> scalarNames = fullMDSpath(0)
	IDL> someSigs = fullMDSpath( 1, filter='n*', /print )

   To find the full pathname of a tag


 COMMON BLOCKS:
       none
 NOTES:
       Only returns signals with data in them.
 LIMITATIONS:
	An MDSplus shot file must be open first.
 MODIFICATION HISTORY:
	14-Mar-00 more efficient & added keywords [BD]
	20-Jan-00 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/fullmdspath.pro)


GAUSSIAN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       GAUSSIAN
 PURPOSE:
       Compute the 1-d Gaussian function and optionally the derivative
 CATEGORY:
       Math
 EXPLANATION:
       Compute the 1-D Gaussian function and optionally the derivative 
       at an array of points.

 CALLING SEQUENCE:
       y = gaussian( xi, parms,[ pderiv ])

 INPUTS:
       xi = array, independent variable of Gaussian function.

       parms = parameters of Gaussian, 2 or 3 element array:
               parms(0) = maximum value (factor) of Gaussian,
               parms(1) = mean value (center) of Gaussian,
               parms(2) = standard deviation (sigma) of Gaussian.
               (if parms has only 2 elements then sigma taken from common).

 OPTIONAL OUTPUT:
       pderiv = optional output of partial derivatives,
               computed only if parameter is present in call.

               pderiv(*,i) = partial derivative at all xi absisca values
               with respect to parms(i), i=0,1,2.

       Function returns array of Gaussian evaluated at xi.

 EXAMPLE:
       Evaulate a Gaussian centered at x=0, with sigma=1, and a peak value
       of 10 at the points 0.5 and 1.5.   Also compute the derivative

       IDL> f = gaussian( [0.5,1.5], [10,0,1], DERIV )
       ==> f= [8.825,3.25].   DERIV will be a 2 x 3 array containing the
       numerical derivative at the two points with respect to the 3 parameters.
 
 COMMON BLOCKS:
       common gaussian, sigma
 HISTORY:
       Written, Frank Varosi NASA/GSFC 1992.
       Converted to IDL V5.0   W. Landsman   September 1997

(See /p/nstxusr1/util/idl_cvs/gaussian.pro)


GETIMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       GETIMAGE

 PURPOSE:
       The purpose of this function is to allow the user to open either
       regular or XDR binary image files of two or three dimensions.

 CATEGORY:
       Image Processing, Widgets, File I/O

 CALLING SEQUENCE:
       image = GETIMAGE(filename)

 INPUTS:
       filename: The name of the file to open for reading.

 KEYWORD PARAMETERS:

       CANCEL: An output variable that can be set to a named variable.
       The value of the return variable will be 1 if the user clicked
       the "Cancel" button or if there was a problem reading the file.

       DIRECTORY: The name of the directory the file is located in. By
       default the program looks in the "training" directory under the
       main IDL directory, if one exists. Otherwise, it defaults to the
       current directory.

       FRAMES: The 3rd dimension of a 3D data set. Defaults to 0.

       HEADER: The size of any header information in the file in BYTES.
       Default is 0.

       PARENT: The group leader for this widget program. The PARENT is
       required if GETIMAGE is called from another widget program.

       XDR: Set this keyword if the binary file is of XDR type.

       XOFFSET: This is the X offset of the program on the display. The
       program will be placed approximately in the middle of the display
       by default.

       XSIZE: The size of the 1st dimension of the data.

       YOFFSET: This is the Y offset of the program on the display. The
       program will be placed approximately in the middle of the display
       by default.

       YSIZE: The size of the 2nd dimension of the data.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       A "CANCEL" operation is indicated by a 0 return value.
       Any error in reading the file results in a 0 return value.

 RESTRICTIONS:
       None.

 EXAMPLE:
       To load the image "galaxy.dat" in the $IDL/examples/data
       directory, type:

       image = GETIMAGE('galaxy.dat', DIRECTORY=!DIR + '/examples/data', $
          XSIZE=256, YSIZE=256, Cancel=cancelled, Parent=event.top)
       IF NOT cancelled THEN TV, image

 MODIFICATION HISTORY:
       Written by: David Fanning, 3 February 96.
       Fixed bug that prevented reading INTEGER data. 19 Dec 96.
       Modifed program for IDL 5 MODAL operation. 19 Oct 97.
       Added CANCEL keyword. 27 Oct 97. DWF.
       Fixed CANCLE keyword spelling. Sigh... 29 JUN 98. DWF.

(See /p/nstxusr1/util/idl_cvs/getimage.pro)


GETMDSLABEL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:  
	getMDSlabel
 PURPOSE: 
	return a label for an MDSplus signal. If there is a :LABEL sub-node,
	use that string, else if there is a :COMMENT sub-node, use that, else
	return the MDSplus signal name.
 CATEGORY:
       MDSplus
 CALLING SEQUENCE:
       IDL> label=getMDSlabel( signal, textNode=textNode, FOUNDTDI=foundTDI, $
                      status=status, /quiet, /fullPath )
 INPUTS:
       signal - mdsplus signal or tag name (shot must be opened)
 OUTPUT:
       label - contents of :LABEL substring, if found. Otherwise the
		signal name is returned (just the last two elements, unless
		/fullPath set)
 KEYWORD PARAMETERS:
    Optional Inputs:
	quiet - just passed to mdsvalue
	fullPath - if set, return fullpath if no :LABEL subnode found
    Optional Outputs:
	textNode - 1 returned if a text node
	FOUNDTDI - 1 returned if TDI in node 
	status - if odd, successfull
 COMMON BLOCKS:
       NONE
 MODIFICATION HISTORY:
	01-Jun-01 Also look for :COMMENTS sub-node. 
	11-Mar-01 if no :LABEL node, look for :COMMENT node
       15-Feb-01 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/getmdslabel.pro)


GETSCOPENAMES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       getScopeNames
 PURPOSE:
       return signal names from an MDSplus Scope input file
 CATEGORY:
       MDSplus, SCOPE
 CALLING SEQUENCE:
	names = getScopeNames( fileName, titles=titles )
	names = getScopeNames()	; will get a dialog box
 INPUTS:
   Optional:
	filename - name of scope input filename (else will get a dialog box)
 RETURNED:
	names - Array of signal names, including TDI, (Y values)
	        if nothing found, will return a '-1'
 KEYWORDS:
   (All Optional) Returned:
	Titles - string array of the plot titles from the scope file, else y-name
	xMins - array of each plot's x-minimum from the scope file (else global, or 0)
	xMaxes - array of each plot's x-maximum from the scope file (else global, or 0)
	yMins - array of each plot's y-minimum from the scope file (else global, or 0)
	yMaxes - array of each plot's y-maximum from the scope file (else global, or 0)
	stripTitles - if set, remove double quotes and everything after //
	noEqualSigns - if set, remove equal signs (=)
	addTrees - if set, add trees into signals
 COMMON BLOCKS:
       none
 NOTES:
 LIMITATIONS:
 MODIFICATION HISTORY:
	19-Oct-01 if file not found, try other versions of name
	13-Sep-01 Added addTrees keyword
	17-Mar-01 default directory on Unix to /p/nstxusr1/util/scopes/
	02-Mar-01 added x & y mins and maxes
	11-Jan-01 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/getscopenames.pro)


GETTOK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	GETTOK
                            
 PURPOSE:
	Function to retrieve the first part of the string
	until the character char is encountered.

 CATEGORY:
       Strings

 CALLING SEQUENCE:
	token = gettok( st, char )

 INPUT:
	char - character separating tokens, scalar string

 INPUT-OUTPUT:
	st - (scalar) string to get token from (on output token is removed)

 OUTPUT:
	token - scalar string value is returned 

 EXAMPLE:
	If ST is 'abc=999' then gettok(ST,'=') would return
	'abc' and ST would be left as '999' 

 HISTORY
	version 1  by D. Lindler APR,86
	Remove leading blanks    W. Landsman (from JKF)    Aug. 1991
   Add TABCHAR keyword, so token = gettok( st, '@', TABCHAR='@') will
		just treat tabs as delimiters.

(See /p/nstxusr1/util/idl_cvs/gettok.pro)


GETWRD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       GETWRD
 PURPOSE:
       Return the n'th word from a text string.
 CATEGORY:
	Strings
 CALLING SEQUENCE:
       wrd = getwrd(txt, n, [m])
 INPUTS:
       txt = text string to extract from.         in
       n = word number to get (first = 0 = def).  in
       m = optional last word number to get.      in
 KEYWORD PARAMETERS:
       Keywords:
         LOCATION = l.  Return word n string location.
         DELIMITER = d. Set word delimiter (def = space & tab).
         /LAST means n is offset from last word.  So n=0 gives
           last word, n=-1 gives next to last, ...
           If n=-2 and m=0 then last 3 words are returned.
         /NOTRIM suppresses whitespace trimming on ends.
         NWORDS=n.  Returns number of words in string.
 OUTPUTS:
       wrd = returned word or words.              out
 COMMON BLOCKS:
       getwrd_com
 NOTES:
       Note: If a NULL string is given (txt="") then the last string
             given is used.  This saves finding the words again.
             If m > n wrd will be a string of words from word n to
             word m.  If no m is given wrd will be a single word.
             n<0 returns text starting at word abs(n) to string end
             If n is out of range then a null string is returned.
             See also nwrds.
 MODIFICATION HISTORY:
       Ray Sterner,  6 Jan, 1985.
       R. Sterner, Fall 1989 --- converted to SUN.
       R. Sterner, Jan 1990 --- added delimiter.
       R. Sterner, 18 Mar, 1990 --- added /LAST.
       R. Sterner, 31 Jan, 1991 --- added /NOTRIM.
       R. Sterner, 20 May, 1991 --- Added common and NULL string.
       R. Sterner, 13 Dec, 1992 --- Made tabs equivalent to spaces.
       R. Sterner,  4 Jan, 1993 --- Added NWORDS keyword.
       Johns Hopkins University Applied Physics Laboratory.

 Copyright (C) 1985, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /p/nstxusr1/util/idl_cvs/getwrd.pro)


GET_TEXT_INPUT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       get_text_input

 PURPOSE:
       Prompt the user for input with a question and
       return the text string typed by user.
       For X-windows the input is through a text widget, in the middle of 
       the screen, and the text widget waits until carriage return is entered.
       Otherwise input is in the terminal window, with a beep to alert user.

 CATEGORY:
       GUI, Input
 CALLING:
       text = get_text_input( question )

 INPUTS:
       question = string(s), prompt for input, default is null string.
               If an array is passed, each element is shown on its own line.

 KEYWORDS:
       DEFAULT_INPUT = optional string, setting the default response.

 OUTPUTS:
       Function returns the text string entered by user,
       with leading and trailing blanks removed.

 HISTORY:
       Written, Frank Varosi NASA/GSFC 1993.
       F.V.1997, question can be a string array, shown as multiple lines.

(See /p/nstxusr1/util/idl_cvs/get_text_input.pro)


GRIDPLOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
	gridplot

 PURPOSE: 
	Widget for plotting a grid of data from MDSplus or gadat 
	This is an interactive version of ShotLoop. 
 	If at GA, assume that access will be through gadat only.
	When a plot on the grid is clicked on, it is expanded into a
	separate window.

 CATEGORY:
       Interactive Plotting, MDSplus, Example, GA

 CALLING SEQUENCE: 
	IDL> gridplot
   or  IDL> gridplot,tmin=2000,tmax=2002, SigFileName='mysigs.txt'

 INPUTS:
       none required  
    FILES:
	lastshot.txt - if this file (or that specified by ShotFileName
			keyword) is found, will initilize shot number 
			to that read from the first line of this file.
			If this file can not be found in the directory from
			which you are running, or in the IDL_PATH,
			the initial shot number will be set to the current
			machine shot minus 3.
	mdsplussig.txt - if this file (or that specified by SigFileName
			keyword) is found, will read signalnames from it
 KEYWORD PARAMETERS:
      Optional Keywords:
	  nSmooth - smoothing parameter to use when plotting data
	  nRows   - # of rows of plots (default to 6)
	  nCols   - # of colomns of plots (default to # signals/nrows)
	  printer - printer to send plots to (else goes to the default printer)
	  tmin - default plotting minimum for x-axis. (MDS in sec; GA in msec)
	  tmax - default plotting maximum for x-axis.
	  ShotFileName - File for storint last shot processed
			 (default:  lastshot.txt)
	  SigFileName - Signal names in the file will be plotted 
		     when you click on "Plot All." The names
		     should be one per row (default='mdsplusssig.txt')
	  sizeofplot - (2-element Real Array) x & y size of graphics area on widget 
			(but you are forced to stay on the screen).
 OUTPUTS:
       none from routine               			out
 COMMON BLOCKS:
       gp_SetupParams, gp_Info, gp_GridData, gp_widgetIDs
 EXAMPLE:
 MAJOR FUNCTIONS and PROCEDURES:
       PLOT: X-Y plotting.

 NOTES:
	PlotOne and PlotSomething
	are routines shared in common with ShotLoop.
 MODIFICATION HISTORY: Written by:  WMD, PPPL, April, 1999
                       for Hiro Takahashi work at General Atomics

(See /p/nstxusr1/util/idl_cvs/gridplot.pro)


INTERPWF

[Previous Routine] [Next Routine] [List of Routines]
  NAME: 
	interpwf

  PURPOSE: 
	Interpolate MDS signal, or array, to 1 KHz Quickly.

 CATEGORY:
       Interpolation
  CALLING SEQUENCE:
	IDL> data1KHz = interpwf( inData, time=intime, OUTTIME=outTime)
	  or
	IDL> data1KHz = interpwf( sigName )
  EXAMPLES:
    (works with just arrays, if time present:)
	IDL> data1KHz = interpwf(findgen(30), time=findgen(16L*1024)/(5000), $
		OUTTIME=outTime)
	IDL> stat = OpenMDSshot( 'operations', 101523 )
	IDL> IF stat THEN b=interpwf( '\ip_ipf1b_1', OUTTIME=outTime, $
				tStart=-0.5, tStop=1.5 )
  LIMITATION:
	Since it makes a CALL_EXTERNAL for speed, only on VMS currently
  MODIFICATION HISTORY:
       05-Jul-00 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/interpwf.pro)


INT_DEFINED

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       int_defined
 PURPOSE:
       see if a value is defined and is an integer
 CATEGORY:
	programming
 CALLING SEQUENCE:
        logical = INT_DEFINED( whatever )
 INPUTS:
       whatever - any IDL variable      in
 KEYWORD PARAMETERS 
	none
 OUTPUTS:
	logical - 1 if an integer, 0 if not (or if not defined)
 EXAMPLE:
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
     1999 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/int_defined.pro)


ISNUM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       ISNUM
 VERSION:
       3.0
 PURPOSE:
       Checks whether the input is a number.
 CATEGORY:
       Programming.
 CALLING SEQUENCE:
       Result = ISNUM(X)
 INPUTS:
    X
       Arbitrary, doesn't even have to exist.
 OPTIONAL INPUT PARAMETERS:
       None.
 KEYWORD PARAMETERS:
    /DOUBLE
       Switch.  If set the result is 1 only if X is DOUBLE or DCOMPLEX.
    /COMPLEX
       Switch.  If set the result is 1 only if X is COMPLEX or DCOMPLEX.
    TYPE
       Optional output.  See below.
 OUTPUTS:
       Returns 1 if X is number, 0 otherwise.  Output type is byte.
 OPTIONAL OUTPUT PARAMETERS:
    TYPE
       The name of the variable to receive the numeric code of the type of X.
       Included for convenience to save an additional call to TYPE.
 COMMON BLOCKS:
       None.
 SIDE EFFECTS:
       None.
 RESTRICTIONS:
       None.
 PROCEDURE:
       Straightforward.  Using TYPE from MIDL.
 MODIFICATION HISTORY:
       Created 15-JUN-1995 by Mati Meron.
       Modified 5-MAY-1996 by Mati Meron.  Added keywords DOUBLE, COMPLEX and
       TYPE.

(See /p/nstxusr1/util/idl_cvs/isnum.pro)


JD2DATE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       JD2DATE
 PURPOSE:
       Convert a Julian Day number to a date string.
 CATEGORY:
	dates
 CALLING SEQUENCE:
       date = jd2date(jd)
 INPUTS:
       jd = Julian Day number.       in
 KEYWORD PARAMETERS:
       Keywords:
         FORMAT = format string.  Allows output date to be customized.
            The following substitutions take place in the format string:
         Y$ = 4 digit year.
         y$ = 2 digit year.
         N$ = full month name.
         n$ = 3 letter month name.
         d$ = day of month number.
         W$ = full weekday name.
         w$ = 3 letter week day name.
 OUTPUTS:
       date = returned date string.  out
 COMMON BLOCKS:
 NOTES:
       Notes:
         The default format string is 'd$-n$-Y$' giving 24-Sep-1989
         Example: FORMAT='w$ N$ d$, Y$' would give 'Mon 
 MODIFICATION HISTORY:
       R. Sterner, 27 Feb, 1991

 Copyright (C) 1991, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /p/nstxusr1/util/idl_cvs/jd2date.pro)


JD2YMD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       JD2YMD
 PURPOSE:
       Find year, month, day from julian day number.
 CATEGORY:
	Dates
 CALLING SEQUENCE:
       jd2ymd, jd, y, m, d
 INPUTS:
       jd = Julian day number (like 2447000).     in
 KEYWORD PARAMETERS:
 OUTPUTS:
       y = year (like 1987).                      out
       m = month number (like 7).                 out
       d = day of month (like 23).                out
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
       R. Sterner.  21 Aug, 1986.
       Johns Hopkins Applied Physics Lab.
       RES 18 Sep, 1989 --- converted to SUN
       R. Sterner, 30 Apr, 1993 --- cleaned up and allowed arrays.
       Theo Brauers, 21 Sep, 1997 long loop index i

 Copyright (C) 1986, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /p/nstxusr1/util/idl_cvs/jd2ymd.pro)


LABELEVERYOTHERTICK

[Previous Routine] [Next Routine] [List of Routines]
  NAME:
 	labeleveryothertick

  PURPOSE:
 	Only label every other major tic mark.
 	The format of the numbers is customized.

 CATEGORY:
       Plotting, Graphics
  EXAMPLE 1 - Make a dummy plot call so can determine Tick Max:
	IDL> COMMON betterticklabels_common, yticklabels
	IDL> plot, y, ytick_get=yticklabels, ytickname=replicate(' ',30)
	IDL> AXIS, YAXIS=1, YRANGE=!y.crange, ytickformat='labeleveryothertick'
	IDL> dum = TEMPORARY(yticklabels)	; so doesn't affect later calls

  EXAMPLE 2 - Just take what you get (still pretty good):
	IDL> plot, y, ytickformat='labeleveryothertick'

  HISTORY:
	09-Oct-00 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/labeleveryothertick.pro)


LASTMDSSHOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       LastMDSshot
 PURPOSE:
       get the last (current) MDS shot
 CATEGORY:
	MDSplus
 CALLING SEQUENCE:
       currentShot = LastMDSshot()
 INPUTS:
       none
 KEYWORD PARAMETERS:
	SERVER - MDS server (default is NSTX)
	MACHINE - machine (default is NSTX)
 OUTPUTS:
	currentShot - current shot number
 EXAMPLE:
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
 	25-Feb-99 BD added way to get current shot from either VMS or UNIX
		default to NSTX
 	11-Dec-98 BD added MDSplus access for shotnumber, if on VMS at PPPL
 	01-Dec-98 BD use fas_dir and Mk_Filename for filename lookup
 	5/14/98 changing USER directory to BE1 etc [PR]

(See /p/nstxusr1/util/idl_cvs/lastmdsshot.pro)


LEAFNAME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       LeafName
 PURPOSE:
       Return leaf name from MDS pathname(s)
 CATEGORY:
       MDSplus
 CALLING SEQUENCE:
       IDL> leaf = leafname(mdspath)
 INPUTS:
       mdspath - MDSplus path string.  
 OUTPUTS:
       leaf - MDSplus leaf node string               		out
 KEYWORDS:
	Delim - delimiter (default is ':')
	Tree  - returns tree of input 
	Prefix - returns everything before the leafname
	nParts - # of parts to return, counting from the end (default=1, 
			max of 2)
 COMMON BLOCKS:
       NONE
 EXAMPLE:
       IDL> print,leafname('\JMENARD_DAY1::TOP.FLUX_LOOP.FLUX:FFLPF1BL')
		FFLPF1BL
	IDL> print,leafname('TOP.FLUXLOOP.FLUX.CALIBRATION',delim='.')
		CALIBRATION
 MODIFICATION HISTORY:
	11-Jan-01 Remove comma and anything after, and ')' if TDI
	28-Nov-00 Don't return tree name with '\'
       23-Jul-99 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/leafname.pro)


LISTSHOTS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       ListShots
 PURPOSE:
        List shot numbers with signal over/under a certain amount
 CATEGORY:
       MDSplus
 CALLING SEQUENCE:
       IDL> listshots, shot, nshots,  signal=signal, warningLevel=warningLevel
 INPUTS:
       shot - if an interger: beginning shot # to search for 
		if an array of integers, use as a shot list (ignore nshots)
       nshots - # of shots to search over (def=10)
 KEYWORD PARAMETERS:
    Optional Inputs:
	comparator - 'GT' (default) or 'LT' for cutoff and warning
	cutoff - value under which value will be ignored
	outFile - outFile for output
	nSmooth - # for median smoothing before using signal (default=0)
	noScreen - if set, do not echo output to screen
	server - MDSplus server, default='EUROPA.PPPL.GOV:8501'
       signal - mdsplus signal name
	skip - shots to skip while looping through list
	warningLevel - warn if greater than than this value
    Optional Returned:
	count - number of shots satisfying criteria
 OUTPUTS:
       just to screen and/or file           			
 COMMON BLOCKS:
       NONE
 EXAMPLE:
	IDL> listshots, 102915, 10,  signal='\WF::IP', warn=1.0
 NOTES:
       tree should be in signal name
 MODIFICATION HISTORY:
       23-May-01 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/listshots.pro)


MAXSTRUCT

[Previous Routine] [Next Routine] [List of Routines]
  NAME:
 	maxstruct
  PURPOSE:
	find the maximum of a structure
  CATEGORY:
	Programming, Math
  EXAMPLE:
	IDL> maxval = maxstruct(structure)

(See /p/nstxusr1/util/idl_cvs/maxstruct.pro)


MDSDECLAREEVENT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MDSDeclareEvent

 PURPOSE:
       set an MDS event with shot number associated with the event

 CATEGORY:
       MDSplus, Events

 CALLING SEQUENCE:
       IDL> MDSDeclareEvent, eventName [, shot_num]

 INPUTS:
	eventName - string of MDS event name, e.g., 'NE_DENSITY_CALC'
       shot_num - NSTX shot number (OPTIONAL -- will default to current shot)

 KEYWORD PARAMETERS:
    Optional:
	VERBOSE - If set, print debugging information

 OUTPUTS:
       none -- just sets the event
 COMMON BLOCKS:
       NONE
 EXAMPLE:
 NOTES:
	Works from Unix or VMS
 MODIFICATION HISTORY:
   	20-Dec-99 Written [bd]

(See /p/nstxusr1/util/idl_cvs/mdsdeclareevent.pro)


MDSEVENTWAIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       mdseventwait
 PURPOSE:
       Widget to Wait for an MDSplus event, 
	or the user clicks the CANCEL button.
 CATEGORY:
       MDSplus; Event Widgets
 CALLING SEQUENCE:
       IDL> shot = mdseventwait( someEvent, cancel=cancel )
 INPUTS:
       someEvent - (string) an MDSplus event (defualts to 'nstx_acq_done')
 KEYWORD PARAMETERS:
    Optional:
	cancel - if user hits cancel button, cancel = 1 (& shot=-1), else 0
	group_leader - higher level widget to place this on top of 
 OUTPUTS:
       shot - shot # (data) set like: IDL> setmdsshotevent,'dum',999999
 COMMON BLOCKS:
       NONE
 EXAMPLE:
 RELATED ROUTINE:
 NOTES:
	Only works on X.
 MODIFICATION HISTORY:
	29-Aug-00 Written by Bill Davis for David Swain

(See /p/nstxusr1/util/idl_cvs/mdseventwait.pro)


MDSGETSIG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MDSGETSIG
 PURPOSE:
       Get a signal, units and axes values easily from MDSplus
 CATEGORY:
       MDSplus
 CALLING SEQUENCE:
       f = MDSGETSIG( signal, SIGUNITS=fUnits, XAXIS=time, XUNITS=timeUnits)
 INPUTS:
      signal - MDSplus Signal name
 KEYWORD PARAMETERS:
       Keywords:
	    SIGUNITS=val - if non-zero, return units of signal		out
	    XAXIS=val    - if non-zero, return array of x-axis		out
	    XUNITS=val   - if non-zero, return units of x-axis		out
	    YAXIS=val    - if non-zero, return array of y-axis		out
	    YUNITS=val   - if non-zero, return units of y-axis		out
	    status=val   - if non-zero, return status (1=OK)		out
 OUTPUTS:
       f - 1- or 2-D data                 				out
 COMMON BLOCKS:
       NONE
 EXAMPLE 
	MDSCONNECT, 'europa.pppl.gov:8501'
	MDSOPEN, 'testtree', 10
	sig = 'onedim'
	data = MDSGETSIG( signal,SIGUNITS=fUnits, XAXIS=time,XUNITS=timeUnits )'
	PLOT, time, data, XTITLE = timeUnits, YTITLE = fUnits,  $
		TITLE = signal + ' - shot ' + STRTRIM( STRING(shot), 2 )
 NOTES:
	If something like x units were NOT stored for the signal, and they are
	asked for, IDL will complain about an access violation, but continue.
	When signals are TDI combinations of others, use the
	units and xaxis from the first signal (could be erroneous)
 MODIFICATION HISTORY:
	01-May-01 When signals are TDI combinations of others, use the
		  units and xaxis from the first signal (could be erroneous)
	11-Nov-99 test for input signal name not defined
	10-Aug-99 Use Arg_Present so don't have to set keywords before call
	26-Jan-99 Trim trailing blanks from unit strings [BD]
       13-Jan-99 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/mdsgetsig.pro)


MDSLIST

[Previous Routine] [Next Routine] [List of Routines]
   NAME:
	mdslist

  PURPOSE:
	Print ASCII file containing data for MDSplus signal(s). 
	The "dimension" of one of the signals (typically time) is in the 
	first column, followed by data values at that time. 
	Output may be in the format suitable for importing into
	Kaleidograph, Excel, etc.

  CATEGORY:
       MDSplus, Output

  CALLING SEQUENCE:
	mdslist, MDStree, shot, signames
	mdslist, MDStree, shot, signames,  $
               t1=t1, t2=t2, npts=npts, format=format, tabs=tabs, $
               headings=headings, SigForX=SigForX, scope=scope
  INPUTS:
	MDStree - e.g. 'operations'. Default is 'NSTX'
	shot - MDSplus shot number, i.e, ID.
	signames - a single MDSplus signal name, or array of names.
		(ignored if Keyword "Scope" is present.)
  OUTPUTS:
	none returned
  KEYWORDS:
    (all Optional)
	t1 - Starting x-value desired (typically time, in seconds). 
	     Defaults to beginning of data for 1st signal.
	t2 - Ending x-value desired. Defaults to end of data
	npts - number of points desired. Defaults to all points.
	format - output format. Defaults to '(100(g15.6, a1))' 
		 (a tab or space is written between the columns)
	tabs - if set, columns will be separated by tabs instead of spaces
	headings - if set, the signal labels are at the top of each column
		   in row 1.
	SigForX - The signal from which to extract the output x-values.
		  Especially relevant when signals of different timebase are 
		  requested (defaults to that of the first signal).
 	scope - if present, gets the signal names and column titles from 
		this scope file.
		(if present, the signames input is ignored). THIS SHOULD BE
	        THE FULL PATHNAME OF THE FILE, or it will default to general
		areas.
	status - 1=OK, 0 means shot, signames, or scope file weren't found.
	units - if set, will append units to headings
  EXAMPLES:

	   To write the first 100 points of time and 
	    ip pairs to file mdsoutput_106138.dat:
	IDL> mdslist,'wf',106138,'\ip',npts=100

	   To write 3 columns,  of time, Ip, and Itf, from 0.1-0.2 sec to 
	    file mdsoutput_106138.dat:
	IDL> mdslist,'wf',106138,['\ip','\itf'],t1=.1,t2=.2
      
	   To make a tab-delimited file of signals from an MDSplus Scope, 
	    with column headings, on efit times:
	IDL> mdslist,'',106138,scope='/u/Old/bdavis/bv.scope', $
			SigForX='EFIT', /headings, /tabs   

	   To write time and stored energy data at 1 KHz 
	    (like all signals in WF tree):
	IDL> mdslist,'',106138,'\EFIT01::WMHD/1000', SigForX='\WF::IP'  
  LIMITATION:
	Would be faster, if it just opened trees that were needed.
  HISTORY:
	20-Sep-01 converted from mdsmkfile
	05-Sep-01 Added multi-column and interpolation options.
	Written 13-jul-00 by Bill Davis at the request of Charlie Neumeyer

(See /p/nstxusr1/util/idl_cvs/mdslist.pro)


MDSLOADSCALAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MDSloadScalar
 PURPOSE:
       Load MDSplus scalar with one simple call (after opening shot)
 CATEGORY:
       MDSplus
 CALLING SEQUENCE:
       MDSloadScalar, sig, data, SIGUNITS = sigUnits, XAXIS = xAxis,   $ 
    		XUNITS = xUnits, YAXIS = yAxis, YUNITS = yUnits
 INPUTS:
      sig  - MDSplus Signal name
      data - 1- or 2-D data array to load
 KEYWORD PARAMETERS:
       Keywords:
	    stat=val     - if non-zero, return status (1=OK)		out
 OUTPUTS:
       NONE
 COMMON BLOCKS:
       NONE
 EXAMPLE 
	stat=openMDSshot('engineering', 100700)
	sig = '\Some_sig'
	MDSloadScalar, sig, 3.14159

 MODIFICATION HISTORY:
       02-Nov-99 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/mdsloadscalar.pro)


MDSLOADSIG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MDSLOADSIG
 PURPOSE:
       Load MDSplus signals with one simple call (after opening shot)
	Optionally add node and/or tag to a shot tree.
 CATEGORY:
       MDSplus
 CALLING SEQUENCE:
       MDSLOADSIG, sig, data, SIGUNITS = sigUnits, XAXIS = xAxis,   $ 
    		XUNITS = xUnits, YAXIS = yAxis, YUNITS = yUnits
 INPUTS:
      sigName  - MDSplus Signal name
      data - 1- or 2-D data array to load
 KEYWORD PARAMETERS:
       Keywords:
	    SIGUNITS=val - if non-zero, return units of signal		in
	    XAXIS=val    - if non-zero, return array of x-axis		in
	    XUNITS=val   - if non-zero, return units of x-axis		in
	    YAXIS=val    - if non-zero, return array of y-axis		in
	    YUNITS=val   - if non-zero, return units of y-axis		in
	    FullX	 - if set, store full x-axis, even if dx constant (1-D only)
	    SkipCheck    - if set, do not check time base for constancy (assume)
	    AddNode      - if set, will try and add the node to the tree
	    TagToAdd     - Tag to add
	    shot	 - needed if adding node or tag
	    tree	 - needed if adding node or tag
	    JustAdd      - if set, just add node and/or tag, but don't load data
	    stat=val     - bad if even, OK if odd		      out
	    quiet	 - passed to MDSplus routines (default=1)
 OUTPUTS:
       NONE
 COMMON BLOCKS:
       NONE
 EXAMPLE 
	stat=openMDSshot('engineering', 100700)
	sigName = '\Some_Signal'
	x = findgen(10)
	y = sin( x/n_elements( x ) * 3 * 2 * !PI )    
	MDSLOADSIG, sigName, y, SIGUNITS='Y Units',  XAXIS=x, XUNITS='X Units'
   or, to just add a signal and tag:
	MDSLOADSIG, sigName, TagToAdd=tag, SHOT=shot, TREE=tree, /JUSTADD

 MODIFICATION HISTORY:
	23-May-01 Make, as a default, signals with constant timebase 
		  store with t0 & delta t, rather than storing whole time array.
	16-Nov-00 Added the AddNode & TagToAdd keywords
	28-Aug-00 Don't Use Arg_Present
       7-Jan-99 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/mdsloadsig.pro)


MDSMKFILE

[Previous Routine] [Next Routine] [List of Routines]
   NAME:
	mdsmkfile

  PURPOSE:
	Write an ascii file containing time and data for MDSplus signal(s). 
	Time is in the first column, followed by data values at that time. 
	Output may be in the format suitable for importing into
	Kaleidograph, Excel, etc.

  CATEGORY:
       MDSplus, Output, File I/O

  CALLING SEQUENCE:
	mdsmkfile, MDStree, shot, signals
	mdsmkfile, MDStree, shot, signals, filename=filename, $
               t1=t1, t2=t2, npts=npts, format=format, tabs=tabs, $
               headings=headings, timeSig=timeSig, scope=scope
  INPUTS:
	MDStree - e.g. 'operations'. Default is 'NSTX'
	shot - MDSplus shot number, i.e, ID.
	signals - a single MDSplus signal name, or array of names.
		(ignored if Keyword "Scope" is present.)
  OUTPUTS:
	none returned
	file named mdsoutput_nnnnnn.dat is written, where
	   nnnnnn is the shot number, or, if a scope is used, the
	   scope name is in the place of mdsoutput. If Keyword "Filename"
	   is present, that name is used.
  KEYWORDS:
    (all Optional)
	filename - output filename (default is mdsoutput_nnnnnn.dat, where
		   nnnnnn is the shot number, or, if a scope is used, the
		   scope name -- without extension -- is in the place of 
		   mdsoutput).
	DeltaTime - time step for output - Default is that of the first 
		    signal specified. If = 0, then do not list time.
	t1 - Starting time desired, in seconds. 
	     Defaults to beginning of data for 1st signal.
	t2 - Ending time desired. Defaults to end of data
	npts - number of points desired. Defaults to all points.
	format - output format. Defaults to '(100(g15.6, a1))' 
		 (a tab or space is written between the columns)
	tabs - if set, columns will be separated by tabs instead of spaces
	headings - if set, the signal labels are at the top of each column
		   in row 1.
	timeSig - The signal from which to extract the output timebase.
		  Especially relevant when signals of different timebase are 
		  requested (defaults to that of the first signal).
		  If DeltaTime is specified, this keyword is overridden.
 	scope - if present, gets the signal names and column titles from 
		this scope file.
		(if present, the Signals input is ignored). THIS SHOULD BE
	        THE FULL PATHNAME OF THE FILE, or it will default to general
		areas.
	status - 1=OK, 0 means shot, signals, or scope file weren't found.
  EXAMPLES:

	   To write the first 100 points of time and 
	    ip pairs to file mdsoutput_106138.dat:
	IDL> mdsmkfile,'wf',106138,'\ip',npts=100

	   To write 3 columns,  of time, Ip, and Itf, from 0.1-0.2 sec to 
	    file mdsoutput_106138.dat:
	IDL> mdsmkfile,'wf',106138,['\ip','\itf'],t1=.1,t2=.2
      
	   To make a tab-delimited file of signals from an MDSplus Scope, 
	    with column headings, on efit times:
	IDL> mdsmkfile,'',106138,scope='/u/bdavis/bv.scope', $
			timeSig='EFIT', /headings, /tabs   

	   To write time and stored energy data at 1 KHz 
	    (like all signals in WF tree):
	IDL> mdsmkfile,'',106138,'\EFIT01::WMHD/1000', timeSig='\WF::IP'  
  LIMITATION:
  HISTORY:
	12-Oct-01 Added deltaTime keyword [BD]
	05-Sep-01 Added multi-column and interpolation options.
	Written 13-jul-00 by Bill Davis at the request of Charlie Neumeyer

(See /p/nstxusr1/util/idl_cvs/mdsmkfile.pro)


MDSNODECHANGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MDSnodeChanges
 PURPOSE:
       Print times when the last change was made to an MDSplus node.
 CATEGORY:
       MDSplus, Tree Status, dates
 CALLING SEQUENCE:
       MDSnodeChanges, node, shot1=shot1, shot2=shot2, skip=skip, tree=tree
 INPUTS:
       node = MDSplus node name, e.g. \top.electron_den:line_density
 KEYWORDS:
       shot1 = starting shot number to process
       shot2 = last shot number to process
       skip = skip factor
       tree = MDSplus tree (defaults to nstx -- 
		will be faster if specific tree specified)
 EXAMPLE:
	IDL> tree='microwave'
	IDL> node='\top.electron_den:line_density'
	IDL> MDSnodeChanges, node, shot1=101300, shot2=101330, tree=tree
 COMMON BLOCKS:
       none
 NOTES:
	All see MDStreeChanges for who last changed a tree
	This runs quickly.
 LIMITATIONS:
 MODIFICATION HISTORY:
       20-Dec-99 Written for Rajesh Maingi.

(See /p/nstxusr1/util/idl_cvs/mdsnodechanges.pro)


MDSSETEVENT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MDSSETEVENT
 PURPOSE:
	Generates an MDSplus event
 CATEGORY:
	MDSplus, Events
 CALLING SEQUENCE:
	MDSSETEVENT,event[,/QUIET][,STATUS=STATUS][,DATA=data][,/INFO]
 INPUT PARAMETERS:
	event = Name of MDSplus event to generate.
 Keywords:
       QUIET = prevents IDL error if TCL command fails
       STATUS = return status, low bit set = success
       DATA = bytarr(12) to send with event
	INFO - if this keyword is set the VMS error will be displayed but
              control will be returned to the caller instead of doing a
              longjump back to the IDL prompt.
 OUTPUTS:
       istat = return status, low bit set = success
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
	None.
 PROCEDURE:
	Straightforward.  Makes a call to MDSplus shared image library
       procedure MDS$OPEN and checks for errors.
 MODIFICATION HISTORY:
	renamed from mds$setevent & made to work on UNIX, too	[BD]
	 VERSION 1.0, CREATED BY T.W. Fredian, April 22,1991

(See /p/nstxusr1/util/idl_cvs/mdssetevent.pro)


MDSSHOTDATE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MDSshotDate
 PURPOSE:
       Print time and date of an NSTX shot.
 CATEGORY:
       MDSplus, Tree Status 
 CALLING SEQUENCE:
       IDL> date = MDSshotDate( shot )
 INPUTS:
       shot = MDSplus shot number
 KEYWORDS:
    optional output:
	time = time of shot, e.g., 12:25:02
 EXAMPLE:
       IDL> date = MDSshotDate( shot, time=time )
 COMMON BLOCKS:
       none
 NOTES:
	This runs fairly quickly, but SQL access is quicker.

	Also see SURVEYDB to quickly see first & last shot of day.
 LIMITATIONS:
 MODIFICATION HISTORY:
	
       3-Jun-02 use \WF::ACQ_START
       3-Oct-00 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/mdsshotdate.pro)


MDSTREECHANGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MDStreeChanges
 PURPOSE:
       Print times when the last change was made to an MDSplus tree,
	and who did it.
 CATEGORY:
       MDSplus, Tree Status, dates
 CALLING SEQUENCE:
       MDStreeChanges, tree, shot1=shot1, shot2=shot2, skip=skip
 INPUTS:
       tree = MDSplus tree name, e.g. 'Microwave' or 'NSTX'
 KEYWORDS:
       shot1 = starting shot number to process
       shot2 = last shot number to process
       skip = skip factor (default to no skip
	since = only list changes for a shot if since this date
		e.g. - '20-sep-2001'
 COMMON BLOCKS:
       none
 EXAMPLE:
	IDL> mdstreechanges, 'microwave', shot1=101300, shot2=101301
	 
	Latest changes from shot 101300 to 101301 for the microwave tree
	 
	  Shot       Who       Date        Node
	  ----       ---       ----        ----
	 101300    [BDAVIS]  4-APR-2000  .ELECTRON_DEN:LINE_DENS_DF
	 101301    [BDAVIS]  4-APR-2000  .ELECTRON_DEN:LINE_DENS_DF

 MODIFICATION HISTORY:
	01-Feb-02 added text for repeated lines
	28-Jan-02 added SINCE keyword [BD]
       20-Dec-99 Written by Bill Davis for Rajesh Maingi.

(See /p/nstxusr1/util/idl_cvs/mdstreechanges.pro)


MDSUNITS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MDSunits
 PURPOSE:
       return units of an MDS tag, or the time, or time units
 CATEGORY:
	MDSplus
 CALLING SEQUENCE:
        units = MDSunits( tag )
 INPUTS:
       tag - MDSplus tag or node name      in
 KEYWORD PARAMETERS 
	Input:
	  TIME  - If set, Time returned (unless UNITS also set)
	  UNITS - If set, Units of tag returned (unless TIME also set)
	Returned:
	  STATUS- Status of call (can be used in IDL logical expressions)
 OUTPUTS:
	units - units
 EXAMPLES:
    MDSconnect, 'europa'
    MDSOPEN, 'tftr', 89725
    tag = '.waveforms:mb_ip_sl'
    f = MDSVALUE( tag )

    time = MDSUNITS( tag, /TIME )
    flabel = MDSUNITS( tag, /UNITS )
    timelabel = MDSUNITS( tag, /TIME, /UNITS )
    plot, time, f/1000., xtitle = timelabel, ytitle = 'milli'+flabel
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
    29-Mar-99 Return status from MDSVALUE [BD]
    21-Dec-98 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/mdsunits.pro)


MDSW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       mdsw
 PURPOSE:
       Interactively plot MDS signals with Crosshairs and many options
 CATEGORY:
       MDSplus, Plotting, Widget Example, Printing Plots, Crosshairs
 CALLING SEQUENCE:
	mdsw
	mdsw, xsize=800, ysize=600
 COMMON BLOCKS:
       none
 NOTES:
       Your display may have to be set to 256 colors to see the crosshairs.
 LIMITATIONS:
	Some of the MDSplus signals in the list may not have any data.
	You need IDL version 5, or greater to run this application.
 MODIFICATION HISTORY:
	08-Mar-02 Fixed screen dump cabability for 24-bit color, and some minor things.
	05-Oct-01 Improved restoring settings. Allowed for "Next Shot" to be missing.
	18-May-01 Use Vcomp for "visual compression" if more points than resolution
	07-May-01 Added Reload color table. Better behavior when copying plots that
		  don't fill the screen.
	08-Mar-01 Bug fixed on Reference Shots with signals of different length.
	02-Feb-01 Use Label sub-node as title, if available. Access to
		  nodes, even if not tags. Display text nodes.
		  Display Signal List initially.  Plot 2-D data.
	30-Nov-00 Allow "Save Settings" to include Signal List & !X, !Y, !P.
		  (old settings files won't work).
		  Axis selection with middle mouse button just redraws last plot.
	20-Nov-00 Rearranged menus (added Appearance Menu); better plot spacing.
	13-Nov-00 Added "Assume same x-label" & "Assume same x-axis" options
	30-Oct-00 Added widget for !P settings, so can specify symbols, etc.
	26-Oct-00 Fixed "Copy Plot to Tek" to return to X color table afterwards.
	18-Oct-00 Added "Edit Selected Signal" option in Signal Menu. 
		  TDI expressions included in name will be displayed. Added button
		  to show treenames in list.
	10-Oct-00 Added "Label Every Other tick options" & better tick labels
		  Made postscript output a little better for grid of plots
	03-Oct-00 Add "Always Include 0 on Y-axis" (not default) and 
		  "Draw dashes at y=0" (now default) options.
	28-Sep-00 Allow yaxisw to control Y-axis range,
		  in some situations, at least.
	20-Sep-00 Just label "No Data" if data not found. Put < & > on Signal Menu
	07-Oct-99 Redraw whole screen when mouse used. Alphabetize signal list.
		  Default to "Only zoom X" 
	19-Aug-99 Allow overlays of data with different dimensions
	23-Jun-99 Added Reference shot. Added "Plot all on one page" option.
	12-Apr-99 Added Tek output option [BD]
	29-Mar-99 Added X & Y Style editing. [BD]
	15-Mar-99 Add "Get Next Good Shot" buttons [BD]
	08-Mar-99 Add overlays and legends. [BD]
	26-Feb-99 Multiplot option and x-only zooming [BD]
	11-Feb-99 Added a pick list for MDS signals
	26-Jan-99 Modified for using MDS at PPPL by Bill Davis

       GA Crosshair routines originally written by John Ferron. 

(See /p/nstxusr1/util/idl_cvs/mdsw.pro)


MDSWFEVENT[1]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MDSWFEVENT
 PURPOSE:
	Wait for an MDSplus event
 CATEGORY:
	MDSplus
 CALLING SEQUENCE:
	MDSWFEVENT,event[,/QUIET][,STATUS=istat][,DATA=data][,/info]
 INPUT PARAMETERS:
	event = name of an MDSplus event to wait for.
 Keywords (Optional):
       QUIET = prevents IDL error if MDSplus command fails
       STATUS = return status, low bit set = success
       DATA = return event data
	INFO - if this keyword is set the VMS error will be displayed but
              control will be returned to the caller instead of doing a
              longjump back to the IDL prompt.
 OUTPUTS:
       istat = return status, low bit set = success
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
	None.
 PROCEDURE:
	Straightforward.  Makes a call to MDSplus shared image library
       procedure MDS$WTEVENT and checks for errors.
 MODIFICATION HISTORY:
	24-May-01 If on Unix, connect to VMS if not already [BD]
	06-Nov-00 Made same version work on VMS & Unix [BD]
	copied from mds$wfevent.pro, so could have the same name on vms & unix
	 VERSION 1.0, CREATED BY T.W. Fredian, April 22,1991

(See /p/nstxusr1/util/idl_cvs/mdsevent_wait.pro)


MDSWFEVENT[2]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MDSWFEVENT
 PURPOSE:
	Wait for an MDSplus event
 CATEGORY:
	MDSplus
 CALLING SEQUENCE:
	MDSWFEVENT,event[,/QUIET][,STATUS=istat][,DATA=data][,/info]
 INPUT PARAMETERS:
	event = name of an MDSplus event to wait for.
 Keywords (Optional):
       QUIET = prevents IDL error if MDSplus command fails
       STATUS = return status, low bit set = success
       DATA = return event data
	INFO - if this keyword is set the VMS error will be displayed but
              control will be returned to the caller instead of doing a
              longjump back to the IDL prompt.
       NOCONNECT - if set don't try and do an MDSconnect
 OUTPUTS:
       istat = return status, low bit set = success
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
	None.
 PROCEDURE:
	Straightforward.  Makes a call to MDSplus shared image library
       procedure MDS$WTEVENT and checks for errors.
 MODIFICATION HISTORY:
	11-Jul-01 removed RESOLVE_ROUTINE, 'mdsconnect'
	24-May-01 If on Unix, connect to VMS if not already [BD]
	06-Nov-00 Made same version work on VMS & Unix [BD]
	copied from mds$wfevent.pro, so could have the same name on vms & unix
	 VERSION 1.0, CREATED BY T.W. Fredian, April 22,1991

(See /p/nstxusr1/util/idl_cvs/mdswfevent.pro)


MDSW_NOCH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       mdsw_noch
 PURPOSE:
       Plot one MDS signal simply (without Crosshairs)
 CATEGORY:
       Example
 CALLING SEQUENCE:
       mdsw_noch
 COMMON BLOCKS:
       mdsw_noch
 NOTES:
       Your display may have to be set to 256 colors to see the crosshairs.
 LIMITATIONS:
	The printers and help file used here only work from UNIX.
	Only one version of this program may be run from a given IDL session.
 MODIFICATION HISTORY:
	11-Feb-99 Using UNSETUP_X rather than SETUP_X
	28-Jan-99 Took out cross-hair routines
	26-Jan-99 Modified for using MDS at PPPL by Bill Davis
       8/29/97 CH_example written by Bill Davis, 

(See /p/nstxusr1/util/idl_cvs/mdsw_noch.pro)


MEDSMOOTH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MEDSMOOTH

 PURPOSE:
       Median smoothing of a vector, including point near it's ends.

 CATEGORY:
	Smoothing, Math
 CALLING SEQUENCE:
       SMOOTHED = MEDSMOOTH( VECTOR, WINDOW_WIDTH )

 INPUTS:
       VECTOR  = The vector to be smoothed
       WINDOW = The full width of the window over which the median is 
               determined for each point.

 OUTPUT:
       Function returns the smoothed vector

 SUBROUTINES CALLED: 
       MEDIAN, to find the median

 PROCEDURE:
       Each point is replaced by the median of the nearest WINDOW of points.
       The width of the window shrinks towards the ends of the vector, so that
       only the first and last points are not filtered. These points are 
       replaced by forecasting from smoothed interior points.

 REVISION HISTORY:
       Written, H. Freudenreich, STX, 12/89
       H.Freudenreich, 8/90: took care of end-points by shrinking window.

(See /p/nstxusr1/util/idl_cvs/medsmooth.pro)


MINMAX

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       minmax
 PURPOSE:
       print the min and the max of an array
 CATEGORY:
	programming
 CALLING SEQUENCE:
        minmax, a
 INPUTS:
       a- an array     in
 KEYWORD PARAMETERS 
 OUTPUTS:
	none (just printing to IDL session)
 EXAMPLE:
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
     1998 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/minmax.pro)


MK_BITARRAY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       mk_bitarray
 PURPOSE:
       Create an array of 1's & 0's corresponding to input bits set
	(works for negative numbers, too, unlike similar routines)
 CATEGORY:
       Bits
 CALLING SEQUENCE:
       IDL> array= mk_bitarray( input )
       IDL> array= mk_bitarray( input, nbits=5 )
 INPUTS:
       input = whatever; might be something like !X.STYLE  
 KEYWORD PARAMETERS:
	NBITS=nbits - length of returned array (default to input type)
	PRINT - if set, will print bits in groups of fours.
 OUTPUTS:
       Byte array containing 1's and 0's               	out
 COMMON BLOCKS:
       NONE
 EXAMPLE:
	IDL> print,mk_bitarray(3, nbits=8)
	   1   1   0   0   0   0   0   0
	IDL> dum = mk_bitarray( 1025, /print )'
	 1 0 0 0   0 0 0 0   0 0 1 0   0 0 0 0
 LIMITATION:
	Only works on a scalar.
 MODIFICATION HISTORY:
	05-Jun-00 default nbits to input type. add print keyword.
       30-Mar-99 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/mk_bitarray.pro)


MK_COLOR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       mk_color

 PURPOSE:
       Create color tables with 9 fixed colors at the top. These colors
	can be referenced by name.

 CATEGORY:
       Graphics, Color Specification.

 CALLING SEQUENCE:
	index = mk_color( color )
	index = mk_color( color, TABLE=5, MAX_COLORS_TO_USE = 128 )
 OPTIONAL INPUTS:
       COLOR: A string with the name of the color. 'WHITE','BLACK','YELLOW', 
                 'RED','GREEN','BLUE','MAGENTA','LTBLUE', and (if device
		   supports more than 8 colors) 'GREY'.are allowed.  
	       Alternately, COLOR may be an integer from 0 - 8.
              If the COLOR input is anything else, or not present, an index
	          for yellow is returned.
	Tek Colors: 0=black, 1=white, 2=red, 3=green, 4=blue,
		5=cyan, 6=magenta, 8=orange.
 KEYWORD PARAMETERS:
	LOAD:	If set, return a structure containing all 8 colors.
		e.g. IDL> c=MK_COLOR(/load)
		     IDL> plot,x,y,color=c.red
       MAX_COLORS_TO_USE: The maximum number of colors to use for all of
		IDL . The default
		is 64 so IDL doesn't grab all the colors on a 256-color 
		monitor. If an IDL window, or a call to LOADCT, was made
		before the first call to mk_color, the number of colors
	        will already have been allocated.
	TABLE: The number of the pre-defined color table to load, from 0 to 40.
	       The same as for LOADCT. The default is 0.
	N_NONFIXED (returned) number of colors other than the nine fixed ones.
		e.g., MAX_COLORS_TO_USE-9.
	SILENT: If this keyword is set, the Color Table message is suppressed.
 COMMON BLOCKS:
       mk_color_local

 SIDE EFFECTS:
       Limits the maximum number of colors for this IDL session.
	(The default is 64 colors).
 RESTRICTIONS:
	Reserving the right number of colors only works if this is called
	before any IDL window is drawn, and before LOADCT is called.

	Good Luck if you try and run with 24-bit color.

	If a device allows less than 9 colors (like Tek), the colors beyond
	the number allowed will not be available.
 EXAMPLES:
    Simply:
	plot,indgen(100),color=mk_color('red'),background=mk_color('white')
    or: 
	plot,[0,1],[0,10]-1
	for i=0,8 do oplot,[i,i],color=mk_color(i)	; to see all colors
    x-y overlays:
	PLOT,INDGEN(100),/NODATA, COLOR=MK_COLOR('blue')	; axes in blue
	PLOT,INDGEN(100), COLOR=MK_COLOR('red')			; data in red
	OPLOT,INDGEN(100)/2, COLOR=MK_COLOR('yellow')		; overlay yellow

    Using color contours AND x-y plots:
	array_2D = DIST(150)	; generate a test array
	yellow_index = mk_color( TABLE=5, MAX_COLORS_TO_USE = 128, $
		N_NONFIXED = n_nonfixed)
	WINDOW,  XSIZE=400, YSIZE=250				; make wide window
	TV, BYTSCL( array_2D, TOP = n_nonfixed-1 ), 25, 50  	; plot scaled 2-D image
	PLOT, HISTOGRAM(array_2D), COLOR=mk_color('LtBlue'),  $	; lt. blue axes
	   POSITION=[0.55, 0.15, 0.95, 0.95], /NOERASE, /NODATA
	OPLOT, HISTOGRAM(array_2D) > 10, COLOR=mk_color('Magenta')	; data in magenta
	whatever = mk_color(TABLE=39)	; change colors of contours, but not lines

 MODIFICATION HISTORY:
	07-Mar-02 - Change !d.n_colors to !d.table_size
	08-May-01 - When in Tek, make !p.color=black (was going to index 15)
	23-Apr-01 - added three more colors (orange, purple, darkgreen)
	26-Jan-01 - limit structure returned to !d.n_colors (e.g., when=2).
	28-Sep-00 - Added bottom keyword (passes straight through to loadct)
	24-Jan-00 - If color found at multiple indices, return highest valid one
	02-Jan-00 - Both /LOAD and individual colors return valid indices in
		    24-bit mode.
	05-Oct-99 - BD Synonyms & Structure return as in new D. Fanning routine.
	09-Jun-99 - BD If desired color not found, return index of nearest color.
 	11-May-99 - BD make return valid values for 24-bit (decomposed) color
	28-Jan-99 - BD handle device with less than 9 colors.
	14-Dec-98 - BD allow COLOR input to be an integer from 0-8.
		        Return index of 0 when color not found in table.
	04-Dec-98 - Bill Davis changed GETCOLORS to load color table, return color 
			index, etc.  Colors were added.
       GETCOLORS Written by: David Fanning, 10 February 96.

(See /p/nstxusr1/util/idl_cvs/mk_color.pro)


MK_FILENAME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       mk_filename
 PURPOSE:
       File names with system independent symbolic directories.
 CATEGORY:
	Files, OS Specific, File I/O
 CALLING SEQUENCE:
       f = mk_filename(symdir, name)
 INPUTS:
       symdir = symbolic directory name.   in
       name = file name.                   in
 KEYWORD PARAMETERS:
       Keywords:
         /NOSYM means directory given is not a symbolic name.
         OPSYS=os specifiy operating system to over-ride
           actual.  Use VMS, WINDOWS, or MACOS.  UNIX is default.
	  SUBDIR=s  Subdirectory below the symdir, e.g., SUBDIR='dir1/dir2'
         DELIM=c delimiter character between directory and
           file name.  This is returned.
 OUTPUTS:
       f = file name including directory.  out
 COMMON BLOCKS:
 NOTES:
       Notes: symdir is a logical name for VMS and
         an environmental variable for UNIX and WINDOWS.  Ex:
         DEFINE IDL_IDLUSR d0:[publib.idl]  for VMS
         set IDL_IDLUSR=c:\IDL\LIB\IDLUSR   for WINDOWS.
         setenv IDL_IDLUSR /usr/pub/idl     for UNIX.
         Then in IDL: f=mk_filename('IDL_IDLUSR','tmp.tmp')
         will be the name of the file tmp.tmp in IDL_IDLUSR.
 MODIFICATION HISTORY:
       R. Sterner,  4 Feb, 1991
       R. Sterner, 27 Mar, 1991 --- added /NOSYM
       R. Sterner, 21 May, 1991 --- If not a listed opsys assume unix.
       R. Sterner,  4 Jun, 1991 --- added DOS.
       R. Sterner,  2 Jul, 1991 --- added DELIM.
       R. Sterner, 17 Jan, 1992 --- added OPSYS= and avoided double //
       R. Sterner, 1994 Feb 7 --- Added MacOS.
       R. Sterner, 1994 Feb 14 --- Changed DOS to windows.
       B. Davis - nenamed from filename.pro. Added SUBDIR keyword

 Copyright (C) 1991, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /p/nstxusr1/util/idl_cvs/mk_filename.pro)


MK_HTML_HELP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MK_HTML_HELP

 PURPOSE:
	Given a list of IDL procedure files (.PRO), VMS text library 
       files (.TLB), or directories that contain such files, this procedure 
       generates a file in the HTML format that contains the documentation 
       for those routines that contain a DOC_LIBRARY style documentation 
       template.  The output file is compatible with World Wide Web browsers.

 CATEGORY:
	Help, documentation.

 CALLING SEQUENCE:
	MK_HTML_HELP, Sources, Outfile

 INPUTS:
     Sources:  A string or string array containing the name(s) of the
		.pro or .tlb files (or the names of directories containing 
               such files) for which help is desired.  If a source file is 
               a VMS text library, it must include the .TLB file extension.  
               If a source file is an IDL procedure, it must include the .PRO
               file extension.  All other source files are assumed to be
               directories.
     Outfile:	The name of the output file which will be generated.

 KEYWORDS:
     BY_CATEGORY: if set, will group output by their first Category
     INCLUDE:	set to 'CATEGORY' or 'PURPOSE' to include at top of the file
     TITLE:	If present, a string which supplies the name that
		should appear as the Document Title for the help.
     VERBOSE:	Normally, MK_HTML_HELP does its work silently.
		Setting this keyword to a non-zero value causes the procedure
		to issue informational messages that indicate what it
		is currently doing. !QUIET must be 0 for these messages
               to appear.
     STRICT:   If this keyword is set to a non-zero value, MK_HTML_HELP will 
               adhere strictly to the HTML format by scanning the 
               the document headers for characters that are reserved in 
               HTML (<,>,&,").  These are then converted to the appropriate 
               HTML syntax in the output file. By default, this keyword
               is set to zero (to allow for faster processing).
     EXTENSION: if want to do for files other than .pro files
     STARTHEAD: characters at the beginning of a line which indicate the 
		header start (default = ';+')
     STOPHEAD:  characters at the beginning of a line which indicate the 
		header end (default = ';-')

 EXAMPLE:
     if on Unix:
	% cd directory-where-web-pages-will-be
	% rm pro_sources.txt
	% /bin/ls -1 the-directory-with-IDL-code/*.pro > pro_sources.txt	
	% idl
	IDL> sources = READ_LIST('pro_sources.txt')
	IDL> MK_HTML_HELP, sources, 'idl_routines.html', include='purpose',/by_category
	IDL> exit
     This just gives a relative path, but the web link will find it.
     When /BY_CATEGORY is specified, an additional page, e.g., 
     idl_routines_alphabet.html, will be produced as well.

    on VMS, to get the pro_sources.txt file in your login directory:
	dir/vers=1/col=1/output=sys$login:pro_sources.txt/nohead/notrail

    to generate a web page for MDSplus TDI routines on VMS:
	$ SET DEFAULT MDS$PLUS:[TDI]
	$ IDL
	IDL>  sources=READ_LIST('sys$login:fun_sources.txt')
	IDL>   MK_HTML_HELP, sources, 'sys$login:[www]tdi_routines.html', $
	      INCLUDE='purpose', EXT='fun', STARTHEAD='/*', STOPHEAD='*/'
 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	A help file with the name given by the Outfile argument is
	created.

 RESTRICTIONS:
	The following rules must be followed in formatting the .pro
	files that are to be searched.
		(a) The first line of the documentation block contains
		    only the characters ";+", starting in column 1.
               (b) There must be a line which contains the string "NAME:",
                   which is immediately followed (same or next line) by the
                   name of the procedure or function being described in
                   that documentation block.  If this NAME field is not
                   present, the name of the source file will be used.
		(c) Likewise, for organizing by category, after the purpose,
		    The "CATEGORY:" line should follow. If fitting, use one of
		    existing categories as the first category (the only one 
		    sorted on). If less than two routines are in a category,
		    they are listed in the Misc category.
		(d) The last line of the documentation block contains
		    the characters ";-", starting in column 1.
		(e) Every other line in the documentation block contains
		    a ";" in column 1.

       Note that a single .pro file can contain multiple procedures and/or
       functions, each with their own documentation blocks. If it is desired
       to have "invisible" routines in a file, i.e. routines which are only
       for internal use and should not appear in the help file, simply leave
       out the ";+" and ";-" lines in the documentation block for those
       routines.

 MODIFICATION HISTORY:
	04-May-01 Add /BY_CATEGORY switch [BD]
	31-Oct-00 Add link to actual code [BD]
	07-Jun-99 Added Extension keyword [BD]
	01-Apr-99 Allow CATEGORY or PURPOSE to be included in the top of 
		  of the HTML file [Bill Davis]
       July 17, 1995, DD, RSI. Added code to alphabetize the subjects;
               At the end of each description block in the HTML file,
               added a reference to the source .pro file.
       July 13, 1995, Mark Rivers, University of Chicago. Added support for
               multiple source directories and multiple documentation
               headers per .pro file.
       July 5, 1995, DD, RSI. Original version.

(See /p/nstxusr1/util/idl_cvs/mk_html_help.pro)


MK_JPEG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MK_JPEG
 PURPOSE:
        make a bit-map color jpeg file of an IDL window for (viewable)
	 insertion into MS Word, or Powerpoint documents.
 CATEGORY:
       Graphics, Publication
 CALLING SEQUENCE:
       IDL> mk_jpeg, FILENAME=filename, WINDOW=window, /VERBOSE
 INPUTS:
       None required 
 KEYWORD PARAMETERS:
       Optional Inputs:
	  filename - Name of output file; Default='idljpeg.jpg'
	  Window   - window number to dump to file
   	  VERBOSE - If set, print debugging information
 OUTPUTS:
       Just the file               			out
 COMMON BLOCKS:
       NONE
 EXAMPLE:
	IDL> LoadCT, 5
	IDL> TH_IMAGE_CONT, dist(400)	; make a color contour with color bar
	IDL> mk_jpeg, filename='myjpeg.jpg'
 NOTES:
 	do not call mk_color, or other things that limit the number of colors,
 	before running this, so you get 256 colors.

	You must have priviledges to write the file.
 MODIFICATION HISTORY:
       22-Feb-00 Written by Bill Davis, PPPL; with thanks to Dave Fanning 

(See /p/nstxusr1/util/idl_cvs/mk_jpeg.pro)


MK_PDMENU

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       mk_pdmenu

 PURPOSE:
       make a structure for a pull down menu for CW_PDMENU routine

 CATEGORY:
	GUI, Programming

 CALLING SEQUENCE:
        menu = mk_pdmenu( list )

 INPUTS:
       list - string array      in

 KEYWORD PARAMETERS:

 OUTPUTS:
	menu - structure which can be input to CW_PDMenu

 EXAMPLE:
       pro test
       base = widget_base()
       Printer_List = PPPL_Printers( )
       printer_pdmenu = MK_PDMENU( Printer_List )
       menu = cw_pdmenu(base, printer_pdmenu, /RETURN_FULL_NAME)
       WIDGET_CONTROL, /REALIZE, base
       repeat begin
         ev = WIDGET_EVENT(base)
         print, ev.value
       end until ev.value eq 'Quit'
       WIDGET_CONTROL, /DESTROY, base
       end

 COMMON BLOCKS:

 NOTES:

 MODIFICATION HISTORY:
	26-Mar-99 by Bill Davis

(See /p/nstxusr1/util/idl_cvs/mk_pdmenu.pro)


MK_SHOTLIST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       mk_shotlist
 PURPOSE:
        Make a list of shots from something like:
	    '107694 108305 108330-108350 108100+20'
 CATEGORY:
       MDSplus
 CALLING SEQUENCE:
       IDL> shotlist = mk_shotlist( shotListString )
 INPUTS:
       shotListString - a string indicating shots, 
		e.g., 107694 108305 108330-108350
		 or   108100+20		
			(this returns shots 108100, 108101,...,108120)
       nshots - # of shots to search over (def=10)
 KEYWORD PARAMETERS:
 OUTPUTS:
       Ordered list of unique shot numbers          			
 EXAMPLE:
	IDL> shotlist = mk_shotlist( '107694 108305 108330-108350 108100+20' )
 NOTES:
 MODIFICATION HISTORY:
       14-Jun-02 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/mk_shotlist.pro)


MONEVENTS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       monevents
 PURPOSE:
       Widget to monitor occurrence of MDSplus events & optional Shot #,
	if passed with the event declaration. The time of the event can also
	be displayed.
 EXPLANATION:
	Lists various events related to an NSTX shot cycle (as a default). 
	As the events are declared, the boxes turn color.
 	When the first event in the list is recognized, the other boxes are
	set to yellow (unless /noClear was set). Shot numbers declared with 
	the events may optionally be displayed.
 CATEGORY:
       MDSplus, Events, Monitoring Widget
 CALLING SEQUENCE:
       IDL> monevents
 INPUTS:
       none.  
 KEYWORD PARAMETERS:
    (optional) 
       EVENTS_WANTED - Character array of events to watch for
       GROUP_LEADER - Group_Leader ID
	NOCLEAR - if set, will not clear events when first event is recognized
	PRINT - if set, will print messages when events are recognized
	SHOWSHOTS - if set, will display shot numbers declared with the events
	TIME - if set, will display time-of-day when event was declared
 OUTPUTS:
       none.
 TESTING
	IDL> monevents, EVENTS_WANTED=['MY_TEST_EVENT_1','MY_TEST_event_2'], $
			/showShots
	   and from a VMS computer:  
	IDL> SetMDSShotEvent,'MY_TEST_EVENT_1', 999999
 COMMON BLOCKS:
       none
 ROUTINES USED:
	MK_COLOR, usingXwindows, MDSEVENT
 EXAMPLE:
	IDL> monevents
 LIMITATION:
	Shot numbers are only returned  when running on VMS currently.
 NOTES:
       The status fields are initially the background color.
	A real program might want to save !D.WINDOW before the TV commands
	and restore it immediately afterwards.
 MODIFICATION HISTORY:
	14-Jun-01 Default to showing time
       20-Jul-00 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/monevents.pro)


MONTHNAMES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MONTHNAMES
 PURPOSE:
       Returns a string array of month names.
 CATEGORY:
	Dates
 CALLING SEQUENCE:
       mnam = monthnames()
 INPUTS:
 KEYWORD PARAMETERS:
 OUTPUTS:
       mnam = string array of 13 items:     out
         ['Error','January',...'December']
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
       R. Sterner, 18 Sep, 1989

 Copyright (C) 1989, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /p/nstxusr1/util/idl_cvs/monthnames.pro)


MONTHNUMBER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       monthnumber
 PURPOSE:
       Returns a month number given a month name.
 CATEGORY:
	Dates
 CALLING SEQUENCE:
       monthNum = monthnumber(monthStr)
 INPUTS:
	monthStr - e.g., 'Dec', or 'MAR'
 KEYWORD PARAMETERS:
 OUTPUTS:
       monthNum = number of month, 1-12, or -1 if not found     	out
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
       29-Jan-00 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/monthnumber.pro)


MPLOTTITLE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       mplottitle
 PURPOSE:
       write a plot title with NSTX label and a list of shots on left
 CATEGORY:
       Plotting
 CALLING SEQUENCE:
       IDL> mplottitle, screenTitle, shots, HLP=hlp, $
	     COLORS=colors, LOGO=logo, $
	     CHARMAG=charMag, TopMargin=TopMargin, RIGHT=right, $
	     INSIDE=inside, XPOS=xPos
 INPUTS:
       screenTitle = whatever you want as the main plot title.  
       shots = array of shot numbers.
	
 KEYWORD PARAMETERS:
	HLP - When set, help information is printed.
	colors - color indices of each shot number (default = !p.color)
	logo - Characters to draw above shot list. Default = '=NSTX=
	TopMargin - in characters, extra space to shift down the characters
	right - if set, labels put on left
	inside - if set, lists shots inside plot box
	xPos - xPos, in Device Coordinates, for left side of shot list
		(overrides /RIGHT & /INSIDE)
 OUTPUTS:
       none
 COMMON BLOCKS:
       NONE
 EXAMPLES:
	IDL> !Y.OMARGIN=[0,1]
	IDL> plot,indgen(100)
	IDL> mplottitle, 'This is my title', [100523,100544]
	IDL> plot,indgen(100)
	IDL> cs=mk_color(/load, /quiet)
	IDL> colors=[cs.black, cs.red, cs.green, cs.blue, cs.magenta]
	IDL> mplottitle,' ', shots, colors=colors, logo='Shots:', $
                           charMag=1.35, topMargin=0.5
 NOTES:
       You'll probably want a little more room at the top of your plots, e.g.
	IDL> !Y.OMARGIN=[0,1]
 MODIFICATION HISTORY:
	01-Oct-01 Added keywords for inside & right [BD]
       21-Sep-99 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/mplottitle.pro)


MSG_BELL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       Msg_Bell
 PURPOSE:
       Print a message to the IDL session and ring a bell
 CATEGORY:
	Programming. Terminal Outpout
 CALLING SEQUENCE:
       Msg_Bell, msg, nrings
 INPUTS:
       msg - string to print to the IDL session
       nrings - (OPTIONAL) # of times to ring
 KEYWORD PARAMETERS:
 OUTPUTS:
 EXAMPLE:
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
	1997 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/msg_bell.pro)


MULTIPLOT

[Previous Routine] [Next Routine] [List of Routines]
 Name:
       MULTIPLOT
 Purpose:
       Create multiple plots with shared axes.
 Category:
	Plotting
 Explanation:
       This procedure makes a matrix of plots with *SHARED AXES*, either using
       parameters passed to multiplot or !p.multi in a non-standard way.
       It is good for data with one or two shared axes and retains all the
       versatility of the plot commands (e.g. all keywords and log scaling).
       The plots are connected with the shared axes, which saves space by
       omitting redundant ticklabels and titles.  Multiplot does this by
       setting !p.position, !x.tickname and !y.tickname automatically.
       A call (multiplot,/reset) restores original values.

       Note: This method may be superseded by future improvements in !p.multi
       by RSI.  For now, it's a good way to gang plots together.
 CALLING SEQUENCE:
       multiplot[pmulti][,/help][,/initialize][,/reset][,/rowmajor]
 Examples:
       multiplot,/help                 ; print this header.
       ; Then copy & paste, from your xterm, the following lines to test:

       x = findgen(100)                ;          MULTIPLOT
       t=exp(-(x-50)^2/300)            ;        -------------------------
       erase                           ;        |           |           |
       u=exp(-x/30)                    ;        |           |           |
       y = sin(x)                      ;        |  UL plot  |  UR plot  |
       r = reverse(y*u)                ;        |           |           |
       !p.multi=[0,2,2,0,0]            ;        |           |           |
       multiplot                       ;       y-------------------------
       plot,x,y*u,title='MULTIPLOT'    ;       l|           |           |
       multiplot & plot,x,r            ;       a|           |           |
       multiplot                       ;       b|  LL plot  |  LR plot  |
       plot,x,y*t,ytit='ylabels'       ;       e|           |           |
       multiplot                       ;       l|           |           |
       plot,x,y*t,xtit='xlabels'       ;       s-------------------------
       multiplot,/reset                ;                       xlabels
                                        
       wait,2 & erase                  ;                TEST
       multiplot,[1,3]                 ;       H------------------------
       plot,x,y*u,title='TEST'         ;       E|      plot #1         |
       multiplot                       ;       I------------------------
       plot,x,y*t,ytit='HEIGHT'        ;       G|      plot #2         |
       multiplot                       ;       H------------------------
       plot,x,r,xtit='PHASE'           ;       T|      plot #3         |
       multiplot,/reset                ;        ------------------------
                                       ;                PHASE

       multiplot,[1,1],/init,/verbose  ; one way to return to single plot
       % MULTIPLOT: Initialized for 1x1, plotted across then down (column major).
 Optional Inputs:
       pmulti = 2-element or 5-element vector giving number of plots, e.g.,
         multiplot,[1,6]               ; 6 plots vertically
         multiplot,[0,4,2,0,0]         ; 4 plots along x and 2 along y
         multiplot,[0,4,2,0,1]         ; ditto, except rowmajor (down 1st)
         multiplot,[4,2],/rowmajor     ; identical to previous line
 Optional Keywords:
       help = flag to print header
       initialize = flag to begin only---no plotting, just setup,
         e.g., multiplot,[4,2],/init,/verbose & multiplot & plot,x,y
       reset = flag to reset system variables to values prior to /init
       default = flag to restore IDL's default value for system variables
       rowmajor = flag to number plots down column first (D=columnmajor)
       verbose = flag to output informational messages
 Outputs:
       !p.position = 4-element vector to place a plot
       !x.tickname = either '' or else 30 ' ' to suppress ticknames
       !y.tickname = either '' or else 30 ' ' to suppress ticknames
       !p.noerase = 1
 Common blocks:
       multiplot---to hold saved variables and plot counter.  See code.
 Side Effects:
       Multiplot sets a number of system variables: !p.position, !p.multi,
       !x.tickname, !y.tickname, !P.noerase---but all can be reset with
       the call: multiplot,/reset
 Restrictions:
       1. If you use !p.multi as the method of telling how many plots
       are present, you have to set !p.multi at the beginning each time you
       use multiplot or call multiplot with the /reset keyword.
       2. There's no way to make an xtitle or ytitle span more than one plot,
       except by adding spaces to shift it or to add it manually with xyouts.
       3. There is no way to make plots of different sizes; each plot
       covers the same area on the screen or paper.
 Procedure:
       This routine makes a matrix of plots with common axes, as opposed to
       the method of !p.multi where axes are separated to allow labels.
       Here the plots are joined and labels are suppressed, except at the
       left edge and the bottom.  You tell multiplot how many plots to make
       using either !p.multi (which is then reset) or the parameter pmulti.
       However, multiplot keeps track of the position by itself because
       !p.multi interacts poorly with !p.position.
 Modification history:
	14-Dec-00 Account for !x.omargin and !x.ymargin [Bill Davis, PPPL]
       write, 21-23 Mar 94, Fred Knight (knight@ll.mit.edu)
       alter plot command that sets !x.window, etc. per suggestion of
         Mark Hadfield (hadfield@storm.greta.cri.nz), 7 Apr 94, FKK
       add a /default keyword restore IDL's default values of system vars,
         7 Apr 94, FKK
       modify two more sys vars !x(y).tickformat to suppress user-formatted
         ticknames, per suggestion of Mark Hadfield (qv), 8 Apr 94, FKK
       Converted to IDL V5.0   W. Landsman   September 1997

(See /p/nstxusr1/util/idl_cvs/multiplot.pro)


M_SMOOTH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       M_SMOOTH
 VERSION:
       3.0
 PURPOSE:
       Non broadening data smoothing.
 CATEGORY:
       Smoothing
 CALLING SEQUENCE:
       Result = M_SMOOTH( ARR, WID [keywords])
 INPUTS:
    ARR
       Array, numeric, no more than six dimensions.
    WID
       The width of the smoothing window.  Can be given either as a scalar (in
       which case it is applied to all the dimensions of the array, or as a 
       vector (in which case each entry applies to one dimension).  The WIDTH
       entry(s) should be an odd number(s), if it is even the next higher odd 
       number(s) will be used.
 OPTIONAL INPUT PARAMETERS:
       None.
 KEYWORD PARAMETERS:
    DERIV
       Causes the smoothed derivative (first or second) of the data to be 
       returned instead of the data itself.  Currently valid only for 1D 
       arrays.
    /EDGE_TRUNCATE
       Switch.  Same as in the IDL version of SMOOTH.
 OUTPUTS:
       Returns the smoothed array or (optionally) its first or second 
       derivative.
 OPTIONAL OUTPUT PARAMETERS:
       None.
 COMMON BLOCKS:
       None.
 SIDE EFFECTS:
       None.
 RESTRICTIONS:
       None.
 PROCEDURE:
       Uses a variation of the Savitzky-Golay procedure.  Superior to the IDL
       provided SMOOTH routine in the sense that it doesn't introduce peak 
       broadening.  Note that:

       1)  The width needed obtain a given degree of smoothing is about twice 
           as big as with SMOOTH (which isn't a problem since this extra width
           doesn't cause broadening.
       2)  Since the averaging kernel isn't positive definite, in some rare
           cases (high and very narrow peaks with little or no background)
           M_SMOOTH may generate artifacts.

       Calls CAST, DEFAULT, DIAGOARR, MAKE_GRID, M_CONVOL, SOLVE_LINSYS and
       TYPE from MIDL.
 MODIFICATION HISTORY:
       Created 25-JAN-1997 by Mati Meron.

(See /p/nstxusr1/util/idl_cvs/m_smooth.pro)


NEARESTI

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	NEARESTI
 PURPOSE:
  	Return index of input array closest to the value of "pt"

 CATEGORY:
	Search
 CALLING SEQUENCE: 
	i=NEARESTI(array,pt)

 INPUTS:   
	array - an array of numbers
       pt    - a number
 OUTPUTS:
	iclosest - the index of the array value closet to "pt"

 COMMON BLOCKS:
 NOTES:
	limited by precision. e.g., 
	IDL> print, nearesti([2,3], 2.5000001)
           0
 MODIFICATION HISTORY:
 	03-Dec-99 WMD make input a scalar, if necessary
	17-Jul-97 WMD more like Harris Library version - faster
 	29-Mar-88 WMD Written

(See /p/nstxusr1/util/idl_cvs/nearesti.pro)


NEARESTI_ARRAY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	NEARESTI_ARRAY
 PURPOSE:
  	Return indices of big input array closest to the values
            in the little input array.

 CATEGORY:
	Search, Arrays

 CALLING SEQUENCE: 
	i=NEARESTI_ARRAY(bigArray,littleArray)

 INPUTS:   
	bigArray - an array of numbers to look in
  littleArray - an array to look for matches in bigArray
 OUTPUTS:
	ret_indices - the indices of bigarray closest to values of littleArray

 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
 	17-Jul-97 WMD Written

(See /p/nstxusr1/util/idl_cvs/nearesti_array.pro)


NEXTGOODSHOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       nextGoodShot

 PURPOSE:
       find the next shot that has more than a certain Ip.

 CATEGORY:
	MDSplus, Shot Number

 CALLING SEQUENCE:
        nextShot = nextGoodShot( StartShot )

 INPUTS:
       StartShot - shot number to start from      in

 KEYWORD PARAMETERS:
    Inputs:
	goodValue - value required for tag for next good shot (default=30)
	Backwards - look backwards for good shots
	MaxShots  - Maximum number of shots to search over (default=1000 or end)
	Server 	  - MDS server (default is NSTX)
	TagToUse  - Tag to use for IP check (default to \OPERATIONS::CAL_IROGEVVUL1)
	Verbose   - if set, print debugging information
 OUTPUTS:
	nextShot - next Shot number, based on criterion
                  IF no good shot meeting criterion is found, -1 is returned
 EXAMPLE:
	IDL> ishot = NextGoodshot( laopenStathot, goodValue = 100. )
 COMMON BLOCKS:
 NOTES:
 	this routine just works for NSTX and DIII-D (uses gadat at GA).
 RESTRICTIONS:
	LASTSHOT() may sometimes return a small number during test periods
 MODIFICATION HISTORY:
	28-Sep-01 Return status. Assume values read are in Amps.
		  Use \ENGINEERING::IP1 as a backup value
	28-Nov-00 Changed Ip to look for \ENGINEERING::PPCC_IP1
	20-Sep-99 Add MaxShots keyword
	18-Sep-99 Keep going after 1 missing shot, but stop after 5
	16-Sep-99 Added TagToUse keyword & medsmooth to remove spikes [BD]
 	Written by Bill Davis March, 1999

(See /p/nstxusr1/util/idl_cvs/nextgoodshot.pro)


NICENUMBER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       NICENUMBER
 PURPOSE:
       Find a nice number close to the given number.
 CATEGORY:
	Math
 CALLING SEQUENCE:
       n = nicenumber(x)
 INPUTS:
       x = given number.              in
 KEYWORD PARAMETERS:
       Keywords:
         /FLOOR finds next nice number le to X.
         /CEIL finds the next nice number ge to X.
         MINOR=m  Returned suggested minor tick spacing.
 OUTPUTS:
       n = nice number close to x.    out
         1, 2, 2.5, or 5 scaled to size of x.
 COMMON BLOCKS:
 NOTES:
       Notes:
         Default operation is useful for finding tick spacings:
         dx = nicenumber((xmx-xmn)/nticks).
         /FLOOR and /CEIL are useful for scaling data plots:
         xmn = nicenumber(min(x),/floor)
         xmx = nicenumber(max(x),/ceil)
         plot, x, y, xrange=[xmn,xmx], . . .
         /floor and /ceil may not give values related to the
         step size, dx.  The following method will:
         ceil(t/dx)*dx is a multiple of dx on the high side of t.
         floor(t/dx)*dx  is a multiple of dx on the low side of t.
 MODIFICATION HISTORY:
	17-Feb-00 handle 190KHz ! (Bill Davis)
       R. Sterner, 6 Feb, 1990
       R. Sterner, 27 Jan, 1993 --- dropped reference to array.
       R. Sterner, 12 Feb, 1993 --- returned 1 element array as a scalar.

 Copyright (C) 1990, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /p/nstxusr1/util/idl_cvs/nicenumber.pro)


NONALPHANUM

[Previous Routine] [Next Routine] [List of Routines]
 NAME: nonAlphaNum

 PURPOSE: find position of first character which are not alphanumeric
	   (0-9, a-z, A-Z & _)

 CATEGORY:
       Strings, Character Search
  if none found, returns strlen(input)

 CALLING SEQUENCE:
        pos = nonAlphaNum( mdsSigName )

(See /p/nstxusr1/util/idl_cvs/nonalphanum.pro)


NONVARPOS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       nonVarPos
 PURPOSE:
 	find position of characters which are not valid for MDSplus names
 CATEGORY:
       MDSplus, Character Search, Strings
 CALLING SEQUENCE:
	posArray = nonVarPos( inStr )

 RETURNED:
       posArray = array of positions of characters which are not
		   valid characters for an MDSplus tag name
		-1 if none found
 KEYWORDS:
   (OPTIONAL)
	GOOD - if set, will retrun positions of good characters
	noNum - if set, don't count numbers as good characters
 MODIFICATION HISTORY:
	01-May-01 - Added keywords
	2001 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/nonvarpos.pro)


NSTXCORNER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       nstxcorner
 PURPOSE:
       write NSTX in upper left-hand corner of a plot
 CATEGORY:
       NSTX, Plotting
 CALLING SEQUENCE:
       IDL> nstxcorner
 MODIFICATION HISTORY:
       21-Aug-00 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/nstxcorner.pro)


NSTXLOGO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       nstxlogo
 PURPOSE:
       draw NSTX logo in upper left-hand corner of a plot
 CATEGORY:
       NSTX, Plotting
 CALLING SEQUENCE:
       IDL> nstxlogo
 KEYWORD PARAMETERS:
     Optional Keywords:
	CHARSIZE -Character size of NSTX characters (def=1.5)
	XLOC - X location of middle of logo, in normal coordinates
	YLOC - Y location of middle of logo, in normal coordinates
	iBar - if set, draw center stack as an "I" rather than ")("
	right -if set, drawn on the right
	blue  - if set, color table value for NSTX text
	red   - if set, color table value for bars and circles
	bottom - if set, drawn on the bottom
 EXAMPLE:
	IDL> !y.omargin=[0,1.5]
	IDL> plot,indgen(11)
	IDL> nstxlogo
 LIMITATONS:
	This was designed to work with the default IDL font (-1).
 NOTES:
	You will probably want to leave extra room at the top of your plot, e.g.
	   IDL> !y.omargin=[0,1.5]
 MODIFICATION HISTORY:
	14-May-01 Changed the look - no X.
	01-Nov-00 Cleaned up location. Default size to 1.5
       21-Aug-00 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/nstxlogo.pro)


NUMLINES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	NUMLINES
 PURPOSE:
	Return the number of lines in a file

 CATEGORY:
       Files
 CALLING SEQUENCE:
	nl = NUMLINES( filename )
 INPUT:
	filename = name of file, scalar string
 OUTPUT:
	nl = number of lines in the file, scalar longword
		Set to -1 if the number of lines could not be determined
 METHOD:
	If Unix then spawn to wc; otherwise read 1 line at a time and count

 PROCEDURE CALLS:
	OS_FAMILY() - Determine if a unix system; Users with IDL V4.0 or later
		can replace this with !VERSION.OS_FAMILY
 MODIFICATION HISTORY:
	W. Landsman                              February 1996
 	07-Oct-98 BD Added StopOnError Keyword
				 in unix, handle stuff printed from .cshrc when spawning wc

(See /p/nstxusr1/util/idl_cvs/numlines.pro)


NWORDS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       NWORDS
 PURPOSE:
       Return the number of words in the given text string or string array.
 CATEGORY:
	Strings
 CALLING SEQUENCE:
       n = nwords(txt)
 INPUTS:
       txt = text string to examine.             in
 KEYWORD PARAMETERS:
       Keywords:
         DELIMITER = d.  Set delimiter character (def = space).
 OUTPUTS:
       n = number of words found.                out
 COMMON BLOCKS:
 NOTES:
       Notes: See also getwrd.
 MODIFICATION HISTORY:
	09-Jun-00 do not count blank or null elements in an array
       Bill Daivs, Sep. '97, made to handle string arrays
       R. Sterner,  7 Feb, 1985.
       Johns Hopkins University Applied Physics Laboratory.
       RES 4 Sep, 1989 --- converted to SUN.

 Copyright (C) 1985, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /p/nstxusr1/util/idl_cvs/nwords.pro)


ONALPHA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       OnAlpha
 PURPOSE:
	Tests for running on an alpha computer. You can specify the
	the desired Alpha computer. Optionally beeps, and prints a 
       message and returns an error if not on the desired Alpha computer.
	
 CATEGORY:
        OS Specific
 CALLING SEQUENCE:
       IDL> OK = OnAlpha('KEES')
 INPUTS:
   (Optional)
       compWanted - string of VMS alpha system, e.g., 'mel' (default='KEES')
 KEYWORD PARAMETERS:
   (Optional)
	NOBEEP - if set, no beep when not on desired alpha
	QUIET - if set, no message is printed to the terminal
 OUTPUTS:
       OK = If = 1, then on desired alpha, else 0     	out
 COMMON BLOCKS:
       NONE
 EXAMPLE:
	IDL> OK = onAlpha(  )
 NOTES:
 MODIFICATION HISTORY:
	30-May-00 Since Multinet recently added places, remove need for 
		  it.
       20-Oct-99 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/onalpha.pro)


OPENMDSSHOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       OpenMDSshot

 PURPOSE:
       Open MDSplus shot

 CATEGORY:
	MDSplus

 CALLING SEQUENCE:
        status = OpenMDSshot( MDStree, shot_num, SERVER=server, /QUIET )

 INPUTS:
	MDStree - e.g. 'operations'				in
       shot_num - shot number					in

 KEYWORD PARAMETERS:
    Optional Inputs:
	QUIET - just passed to MDS routines
	SERVER - MDS server (default is europa.pppl.gov:8501 for NSTX)
	JUSTCONNECT - if set, will just connect to MDSplus
			(can be used before calling LastMDSshot()).

 OUTPUTS:
	Status - MDS status

 EXAMPLE:
	MDStree = 'operations'
	shot_num = 100193
	status = OpenMDSshot( MDStree, shot_num, /QUIET )
	IF status THEN y=MDSGetSig('\IP1')
  or,
   sts = OpenMDSshot( 'EFIT01', 95334, server='omega.gat.com')
   IF sts THEN PRINT, 'Opened GA shot successfully'

 COMMON BLOCKS:

 NOTES:
	This can be called repeatedly and will not re-connect or
	re-open a shot if it is already open.

	MDS Connections need Multinet at this time.

 MODIFICATION HISTORY:
  13-Sep-01 Don't avoid re-opening files, in case MDSopen was called directly.
  24-Aug-00 Changed the default server from Unix to europa.pppl.gov:8501
  13-Apr-00 Changed the default server from Unix to kees.pppl.gov:8501
  22-Oct-99 Took out check for at GA, because added 0.3 seconds
  04-Aug-99 fix for server= ' ' 
  17-Mar-99 Have the default server from Unix be birch.pppl.gov:8501
  12-Mar-99 refer to first argument as a tree. Make a keyword for server
  Written by Bill Davis, 2/99

(See /p/nstxusr1/util/idl_cvs/openmdsshot.pro)


OS_FAMILY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	OS_FAMILY
 PURPOSE:
	Return the current operating system as in !VERSION.OS_FAMILY 

 CATEGORY:
	OS Specific

 CALLING SEQUENCE:
	result = OS_FAMILY()
 INPUTS: 
	None
 OUTPUTS:
	result - scalar string containing one of the four values
		'Windows','MacOS','vms' or 'unix'
 NOTES:
	OS_FAMILY is assumed to be 'unix' if !VERSION.OS is not 'windows',
		'MacOS' or 'vms'

	To make procedures from IDL V4.0 and later compatibile with earlier
	versions of IDL, replace calls to !VERSION.OS_FAMILY with OS_FAMILY().	

 PROCEDURES CALLED:
	function tag_exists
 REVISION HISTORY:
	Written,  W. Landsman     

(See /p/nstxusr1/util/idl_cvs/os_family.pro)


OVPLOT

[Previous Routine] [Next Routine] [List of Routines]
  NAME:
       ovplot

  PURPOSE:
       Just like oplot, except it calls vcomp to "visually compress" 
	an array for faster delivery of graphs at the expense of CPU time. 
	All data spikes should be retained.

  CATEGORY:
       Plotting

  CALLING SEQUENCE:
       ovplot, time, data, _extra=_extra

  KEYWORDS
     Just like for oplot

  COMMON BLOCKS:
       none

  EXAMPLE:
       IDL> vplot, time, data, title='whatever', xrange=[0,2]
       IDL> ovplot, time, data/2.

  NOTES:
       VComp assumes equally spaced data, but might be OK for some cases.
	Probably want to use VPlot for first plot, but not necessary.
  LIMITATIONS:
	This is compuationally intensive, so is not appropriate for
	all applications, but for I/O-bound plotting can speed up 10x or more.
       Will return y points for each x -- the min & max values.
       IF nFinal GE N_ELEMENTS(inData)*2 will just return inputs
  MODIFICATION HISTORY:
       Written 20-May-01 by Bill Davis

(See /p/nstxusr1/util/idl_cvs/ovplot.pro)


PLOT0CHECK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       plot0check
 PURPOSE:
       Plots blank axis if no data in !x.range or !y.range
 CATEGORY:
       Plotting, X-Y Plotting
 CALLING SEQUENCE:
       IDL> plot0check, x, y, ...
 INPUTS:
       x, y, .. = just like on the PLOT command.  
 KEYWORD PARAMETERS:
       Keywords:
 OUTPUTS:
       none
 COMMON BLOCKS:
       NONE
 EXAMPLE:
	IDL>plot0check, x, y, line=1,color=1, /ylog
 NOTES:
 MODIFICATION HISTORY:
	18-May-01 Use Vcomp for "visual compression" if more points than resolution
       20-Nov-00 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/plot0check.pro)


PLOT7

[Previous Routine] [Next Routine] [List of Routines]
 NAME:	
	plot7

 PURPOSE: plot 7 NSTX signals on the same x-axis

 CATEGORY: NSTX, X-Y Plotting, MDSplus

 USE: IDL> plot7, shot [, t1, t2]

 KEYWORDS:
   all optional
	signames
	labels
	units
	scale
	ymins
	ymaxes
	tweenspace - fraction of screen between plots in vertical
	nospace - if set, overrides tweenspace to make plots abut vertically
 MODIFICATION HISTORY:
  	11-Jan-01 Added ymin & ymax and made variables optional keywords
  	06-Oct-00 Written by Bill Davis for Franco Paoletti

(See /p/nstxusr1/util/idl_cvs/plot7.pro)


PLOTNSHOTS

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
	plotnshots

 PURPOSE: make scope-like plots with overlays from multiple shots.

 CATEGORY: 
	Plotting
 USAGE:
	IDL> plotnshots, shots, t1=t1, t2=t2, signames=signames,  $
        	tweenspace=tweenSpace, labels=labels, $
		titles=titles, scales=scales, $
		rightSpace=rightSpace, leftSpace=leftSpace, colSpace=colSpace, $
		pcharsize=pcharsize, bgtime=bgtime, ncols=ncols, nrows=nrows, $
		biglabel=biglabel, nSmooth=nSmooth, $
        	SigUnits=SigUnits, topLabel=topLabel, zeroPlot=zeroPlot, $
        	yMins=yMins,  yMaxes=yMaxes, SERVER=server, noLogo=noLogo, $
		anyProblem=anyProblem, sameXlabels=sameXlabels

 METHOD: Reads in all requested shots for a signal, so can autoscale plot
	  correctly. One big 1-D array created by appending new signals, so
	  signals with different # of points, sampling rate, etc., will work.

 EXAMPLE:
	IDL> plotnshots, [104500,104501], $
		 signames=['\wf::ip','\engineering::ip1']
 LIMITATIONS:
	If 2-D data, will just take the first row for multiple plots.
	If max of X-data is > 100, assume not time and plot separately.

  20-May-02 - In autoscale X, force all x-axis to plot on largest x scale.
		also changed value indicating time (actually, meaning ranges
		won't be used) changed from 100 to 300.
  02-Jul-01 - convert from plot2shots, and plot 2-D images when 1 shot
  28-Jun-01 - added anyProblem keyword, and sameXlabels keyword  to 
		allow forcing time axis ticknames on plot
  18-May-01 - added vplot & ovplot for "visual compression"
  06-Mar-01 - added Yrange & made t1 & t2 be arrays
  06-Feb-02 - put back ability to display 2-D

(See /p/nstxusr1/util/idl_cvs/plotnshots.pro)


PLOTSCOPE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       plotscope
 PURPOSE:
       make scope-like plots, optionally with overlays from multiple shots.
 CATEGORY:
       MDSplus, SCOPE
 CALLING SEQUENCE:
	IDL> plotscope, shots=shots, scope=scope
 INPUTS:
	shots - scalar or array of shot numbers, e.g. [104500,104501]
	scope - name of scope input filename (else will get a dialog box)
 RETURNED:
	None
 KEYWORDS:
   (All Optional) Inputs:
	t1 - starting time desired. Defaults to scope value
	t2 - ending time desired. Defaults to scope value
	refshot - a reference shot to be overplotted.
       SameXlabels - If set and non-zero, just label x-axis at bottom
		     (This reserves less vertical space between plots)
	NRows - Maximum number of rows.
	NCols - Number of columns (default is to compute from rows & # sigs)
       nSmooth - # for median smoothing before using signal (default=0)
	pCharSize - Value desired for !P.CHARSIZE, else guesses
	Titles - string array of the plot titles from the scope file, else y-name
	xMins - array of each plot's x-minimum from the scope file (else global, or 0)
	xMaxes - array of each plot's x-maximum from the scope file (else global, or 0)
	yMins - array of each plot's y-minimum from the scope file (else global, or 0)
	yMaxes - array of each plot's y-maximum from the scope file (else global, or 0)
	tweenspace - vertical space between plots in normalized coordinates
	colSpace - horizontal space between plots in normalized coordinates
	rightSpace  - space on right in normalized coordinates
	leftSpace - space on left in normalized coordinates
 EXAMPLE:
   (Send plots to a Tektronix window, say, from on a Mac from VersaTerm):
	IDL> setup_tek
	IDL> plotscope, shots=104500, refshot=104501, scope='WF'
	IDL> unsetup_tek
    (Make a scope-like plot without space between plots 
      -- the tick labels are outside their grids, unlike in Scope)
	IDL> plotscope,shot=105830,scope='wf',tweenspace=0,colspace=0
 COMMON BLOCKS:
       none
 NOTES:
 LIMITATIONS:
 MODIFICATION HISTORY:
	24-Aug-01 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/plotscope.pro)


PLOTSYM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PLOTSYM
 PURPOSE:
	Define useful plotting symbols not in the standard !PSYM definitions.
 CATEGORY:
	Plotting
 EXPLANATION:
	After a symbol has been defined with PLOTSYM, a plotting command should
	follow with either PSYM = 8 or !P.PSYM = 8 (see USERSYM)

 CALLING SEQUENCE:
	PLOTSYM, PSYM,[ PSIZE, /FILL, THICK=]

 INPUTS:
     PSYM -  The following integer values of PSYM will create the
             corresponding plot symbols
     0 - circle
     1 - downward arrow (upper limit), base of arrow begins at plot value             value
     2 - upward arrow (lower limt)
     3 - 5 pointed star
     4 - triangle
     5 - upside down triangle
     6 - left pointing arrow
     7 - right pointing arrow
     8 - square

     Arrows are defined such that their base begins at their origin.

 OPTIONAL INPUTS:
     PSIZE - Size of the plotting symbol in multiples of the default size
               (default PSIZE=1).  Does not need to be an integer

 OPTIONAL INPUT KEYWORD:
     FILL -  Parameter indicating whether to fill the symbol (see USERSYM)
             The default is 0, unfilled symbol.  Does not affect arrows
             or character symbols.
     THICK -  Thickness of unfilled symbols. Default is 1.

 OUTPUTS:
     None

 EXAMPLES:
     Plot Y vs. X with filled stars as the symbol, twice the default size
     IDL> PLOTSYM, 3 ,2, /FILL       ;Plotting symbol is a filled star,
                                       ;twice default size
     IDL> PLOT,X,Y,PSYM=8            ;Set PSYM = 8 to get star symbol

     Now plot Y vs. X with an open circle as the symbol

      IDL> PLOTSYM, 0               ;Plotting symbol is a circle
      IDL> PLOT,X,Y,PSYM=8

 METHOD:
     Appropriate X,Y vectors are used to define the symbol and passed to the
     USERSYM command.

 REVISION HISTORY
      Written       W. Landsman         June 1992
      18-JAN-1996    Added a square symbol, HCW.
      98Aug20         Added keyword thick parameter - RCB.

(See /p/nstxusr1/util/idl_cvs/plotsym.pro)


POLY_SMOOTH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       poly_smooth

 PURPOSE:
       Reduce noise in 1-D data (e.g. time-series, spectrum)
       but retain dynamic range of variations in the data by
       applying a least squares smoothing polynomial filter,
       also called the Savitzky-Golay smoothing filter.
       The low-pass filter coefficients are computed by effectively
       least-squares fitting a polynomial in moving window,
       centered on each data point, so the new value will be the
       zero-th coefficient of the polynomial. Approximate first derivates
       of the data can be computed by using first degree coefficient of
       each polynomial, and so on. The filter coefficients for a specified
       polynomial degree and window width are computed independent of any
       data, and stored in a common block. The filter is then convolved
       with the data array to result in smoothed data with reduced noise,
       but retaining higher order variations (better than averaging).

 CATEGORY:
	Smoothing, Math

 CALLING SEQUENCE:

       spectrum = poly_smooth( data, width, DEGREE=4 )

 INPUTS:
       data = 1-D array, such as a spectrum or time-series.

       width = total number of data points to use in filter convolution,
               (default = 5, using 2 past and 2 future data points),
               must be larger than DEGREE of polynomials, and a guideline is 
               make WIDTH between 1 and 2 times the FWHM of desired features.

 KEYWORDS:

       DEGREE = degree of polynomials to use in designing the filter
               via least squares fits, (default DEGREE = 2), and
               the higher degrees will preserve sharper features.

       NLEFT = # of past data points to use in filter convolution,
               excluding current point, overrides width parameter,
               so that width = NLEFT + NRIGHT + 1.  (default = NRIGHT)

       NRIGHT = # of future data points to use (default = NLEFT).

       DERIV_ORDER = order of derivative desired (default = 0, no derivative).

       COEFFICIENTS = optional output of the filter coefficients applied,
               but they are all stored in common block for reuse, anyway.
 RESULTS:
       Function returns the data convolved with polynomial filter coefs.

 COMMON BLOCKS:
       common poly_smooth, degc, nlc, nrc, coefs, ordermax
 PROCEDURE:
       As described in Numerical Recipies, sec.14.8, Savitsky-Golay filter.
       Matrix of normal eqs. is formed by starting with small terms
       and then adding progressively larger terms (powers).
       The filter coefficients of up to derivative ordermax are stored
       in common, until the specifications change, then recompute coefficients.
       Coefficients are stored in convolution order, zero lag in the middle.
 MODIFICATION HISTORY:
       Written, Frank Varosi NASA/GSFC 1993.

(See /p/nstxusr1/util/idl_cvs/poly_smooth.pro)


PPPL_PRINTERS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       PPPL_Printers

 PURPOSE:
       return an array of strings of printer descriptions at PPPL

 CATEGORY:
	Printing

 CALLING SEQUENCE:
 	printer_list = PPPL_Printers()

 INPUTS:
       StartShot - shot number to start from      in

 KEYWORD PARAMETERS:
    Inputs:
	FILENAME - name of file to read printer descriptions from
          an example of an entry in the file is:
		crc-color    - Color printer in B152

 OUTPUTS:
	printer_list - String Array

 EXAMPLE:
 	printer_list = PPPL_Printers()

 COMMON BLOCKS:

 NOTES:
	On VMS, the file read is PRINTERS_VMS.txt, on Unix it is
	   PRINTERS_UNIX.txt.
 	If environmental variable local_idl_dir is defined, this routine
	   will look for the file in this area

 MODIFICATION HISTORY:
	26-Mar-99 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/pppl_printers.pro)


PRIME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PRIME
 PURPOSE:
	Return an array with the specified number of prime numbers.
 CATEGORY:
	Math
 EXPLANATATION:
	This procedure is similar to PRIMES in the standard IDL distribution,
	but stores results in a common block, and so is much faster 

 CALLING SEQUENCE:
       p = prime(n)
 INPUTS:
       n = desired number of primes, scalar positive integer
 OUTPUTS:
       p = resulting array of primes, vector of positive integers
 COMMON BLOCKS:
       prime_com
 NOTES:
       Note: Primes that have been found in previous calls are
         remembered and are not regenerated.
 MODIFICATION HISTORY:
       R. Sterner  17 Oct, 1985.
       R. Sterner,  5 Feb, 1993 --- fixed a bug that missed a few primes.
       Converted to IDL V5          March 1999

 Copyright (C) 1985, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /p/nstxusr1/util/idl_cvs/prime.pro)


PRINT_PATH

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
    print_path

 PURPOSE: 
     prints component directories of an IDL path string.

 CATEGORY:
	Utility, Programming

 CALLING SEQUENCE: 
     print_path, PATHS [ /NoCurrent]

 INPUTS: 
     PATHS   = A string containing one or more directory paths.  The
               individual paths are separated by commas, although in UNIX, 
               colons can also be used.  In other words, PATHS has the same 
               format as !PATH, except that commas can be used as a separator 
               regardless of operating system.
	    IF not present, uses !PATH

               A leading $ can be used in any path to signal that what follows 
               is an environmental variable, but the $ is not necessary.  (In 
               VMS the $ can either be part of the path, or can signal logical
               names for compatibility with Unix.)  Environmental variables
               can themselves contain multiple paths.

 OUTPUT: 
      The result of the function is a string array of directories.
      Unless the NOCURRENT keyword is set, the first element of the array is 
      always the null string, representing the current directory.  All the 
      other directories will end in the correct separator character for the 
      current operating system.

 OPTIONAL INPUT KEYWORD:
      /NOCURRENT = If set, then the current directory (represented by
               the null string) will not automatically be prepended to the
               output.

 PROCEDURE CALLS:
      Functions:  BREAK_PATH()

 REVISION HISTORY:

(See /p/nstxusr1/util/idl_cvs/print_path.pro)


PROGRESSW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       progressw
 PURPOSE:
       show progress bar until done, or the user clicks the STOP button.
 USE:
	customize for your use for progress indications.
 CATEGORY:
       Demo; Real Time applications
 CALLING SEQUENCE:
       IDL> done = progressw( seconds )
 INPUTS:
       seconds - total seconds for finish
 KEYWORD PARAMETERS:
    Optional:
	print - if set, will print time elapsed
	waitSeconds - seconds to wait (pause) after a timer event is fielded
			default = 1/2 second.
	xsize - length in pixels of progress bar
	ysize - width in pixels of progress bar
	group_leader - higher level widget to place this on top of 
 OUTPUTS:
       done - 1, if time expired, or 0 if user hit STOP
 COMMON BLOCKS:
       NONE
 EXAMPLE:
	IDL> done = ProgressW( 20 )	; seconds expected for motor to run
	IDL> IF NOT done THEN stopmotor
 RELATED ROUTINE:
	BarometerW
 NOTES:
	Only works on X.
 MODIFICATION HISTORY:
	19-Jul-00 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/progressw.pro)


PSF_GAUSSIAN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       PSF_GAUSSIAN

 PURPOSE:
       Create a 1-d, 2-d, or 3-d Gaussian with specified FWHM, center 
 CATEGORY:
	Math
 EXPLANATION:
       Return a point spread function having Gaussian profiles,
       as either a 1D vector, a 2D image, or 3D volumetric-data.

 CALLING SEQUENCE:
       psf = psf_Gaussian( NPIXEL=, FWHM= , [/NORMALIZE, /ST_DEV,  )
 or:
       psf = psf_Gaussian( parameters, NPIXEL =  )

 REQUIRED INPUT KEYWORD:
       NPIXEL = number pixels for each dimension, specify as an array,
               or just one number to make all sizes equal.

 OPTIONAL KEYWORDS:

       NDIMEN = dimension of result: 1 (vector), 2 (image), or 3 (volume),
               default = 2 (an image result).

       FWHM = the desired Full-Width Half-Max (pixels) in each dimension,
               specify as an array, or single number to make all the same.

       CENTROID = pixels numbers of PSF maximum ( 0.5 is center of a pixel ),
               default is exact center of requested vector/image/volume.

       STDEV = optional way to specify width by standard deviation param.

       XY_CORREL = scalar between 0 and 1 specifying correlation coefficient
               Use this keyword, for example, to specify an elliptical 
               gaussian oriented at an angle to the X,Y axis

       /NORMALIZE causes resulting PSF to be normalized so Total( psf ) = 1.

 INPUTS (optional):

       parameters = an NDIMEN by 3 array giving for each dimension:
                       [ maxval, center, stdev ],  overrides other keywords.

 EXAMPLE:
       Create a 31 x 31 array containing a normalized centered gaussian 
       with an X FWHM = 4.3 and a Y FWHM = 3.6

       IDL> array = PSF_GAUSSIAN( Npixel=31, FWHM=[4.3,3.6], /NORMAL

 EXTERNAL CALLS:
       function Gaussian

 HISTORY:
       Written, Frank Varosi NASA/GSFC 1991.
       Converted to IDL V5.0   W. Landsman   September 1997

(See /p/nstxusr1/util/idl_cvs/psf_gaussian.pro)


PSWINDOW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    PSWINDOW

 PURPOSE:

    This function is used to calculate the size of a PostScript
    window that has the same aspect ratio (ratio of height to
    width) as the current display graphics window. It creates
    the largest possible PostScript output window with the
    desired aspect ratio. This assures that graphics output
    looks similar, if not identical, to PostScript output.

 AUTHOR:

   FANNING SOFTWARE CONSULTING
   David Fanning, Ph.D.
   1645 Sheely Drive
   Fort Collins, CO 80526 USA
   Phone: 970-221-0438
   E-mail: davidf@dfanning.com
   Coyote's Guide to IDL Programming: http://www.dfanning.com/

 CATEGORY:

    Graphics.

 CALLING SEQUENCE:

    pageInfo = PSWINDOW()

 INPUTS:

    None.

 KEYWORD PARAMETERS:

    CM: Normally the structure value that is returned from this
    function reports its values in inches. Setting this keyword
    causes the return values to be in units of centimeters.

    FUDGE: A quick way to set symetrical XFUDGE and YFUDGE factors.
    If this keyword is set to a value, XFUDGE and YFUDGE keywords are
    set to the same value.

    LANDSCAPE: Normally this function assumes a PostScript window
    in Portrait mode. Setting this keyword assumes you want
    the graphic in Landscape mode.

    MARGIN:  The margin around the edges of the plot. The value must be
    a floating point value between 0.0 and 0.5. It is expressed in
    normalized coordinate units. The default margin is 0.15.

    PAGESIZE: Set this keyword to a string indicating the type
    of PostScript page size you want. Current values are "LETTER",
    "LEGAL", and "A4". Default is "LETTER".

    PRINTER: Set this keyword if the output will be used to
    configure the PRINTER device, rather than the PS device.
    (In the PRINTER device, offsets are always calculated from
    the lower-left corner of the page and do not rotate in
    Landscape mode, as they do with the PS device.) Note that
    the PRINTER device is only able to accept these keywords
    in IDL 5.1 and higher.

    XFUDGE: Printers calculate the offset point from the printable
    edge of the paper (sometimes), rather from the corner of the paper.
    For example, on my Lexmark printer, both X and Y offsets are
    calculated from a point 0.25 inches in from the edge. This keyword
    allows you to set a "fudge" factor that will be subtracted from
    the XOFFSET that is returned to the user. This allows you to create
    output that is centered on the page. The fudge factor should be in
    the same units as the returned size and offset values.

    YFUDGE: Printers calculate the offset point from the printable
    edge of the paper (sometimes), rather from the corner of the paper.
    For example, on my Lexmark printer, both X and Y offsets are
    calculated from a point 0.25 inches in from the edge. This keyword
    allows you to set a "fudge" factor that will be subtracted from
    the YOFFSET that is returned to the user. This allows you to create
    output that is centered on the page. The fudge factor should be in
    the same units as the returned size and offset values.

 OUTPUTS:

    pageInfo: The output value is a named structure defined like
    this:

      pageInfo = {PSWINDOW_STRUCT, XSIZE:0.0, YSIZE:0.0, $
         XOFSET:0.0, YOFFSET:0.0, INCHES:0, PORTRAIT:0, LANDSCAPE:0}

    The units of the four size fields are inches unless the CM
    keyword is set.

    The output can be used to immediately configure the PostScript
    or Printer device, like this:

       Set_Plot, 'PS' ; or 'PRINTER'
       Device, _Extra=pageInfo

 RESTRICTIONS:

    The aspect ratio of the current graphics window is calculated
    like this:

       aspectRatio = FLOAT(!D.Y_VSIZE) / !D.X_VSIZE

 EXAMPLE:

    To create a PostScript output window with the same aspect
    ratio as the curently active display window, type:

     pageInfo = PSWINDOW()
     SET_PLOT, 'PS'
     DEVICE, _Extra=pageInfo

     To configure the PRINTER device:

     pageInfo = PSWINDOW(/Printer, Fudge=0.25)
     SET_PLOT, 'PRINTER'
     DEVICE, _Extra=pageInfo

 MODIFICATION HISTORY:

    Written by: David Fanning, November 1996.
       Fixed a bug in which the YOFFSET was calculated incorrectly
          in Landscape mode. 12 Feb 97.
       Took out a line of code that wasn't being used. 14 Mar 97.
       Added correct units keyword to return structure. 29 JUN 98. DWF
       Fixed a bug in how landscape offsets were calculated. 19 JUL 99. DWF.
       Fixed a bug in the way margins were used to conform to my
          original conception of the program. 19 JUL 99. DWF.
       Added Landscape and Portrait fields to the return structure. 19 JUL 99. DWF.
       Added PageSize keyword, changed MARGIN keyword, and completely
          rewrote most of the intenal code. 9 FEB 2000. DWF.
       Fixed a bug in how I calculated the aspect ratio. 1 MAR 2000. DWF.
       Added PRINTER keyword to return proper offset values for the
          PRINTER device, where the offset location is not rotated. 1 MAR 2000. DWF.
       Added PRINTER fudge factors to take into account that printer offsets are
          calculated from the printable area of the paper, rather than the corner
          of the paper. 8 AUG 2000. DWF.
  07-Mar-02 made work for correctly for landscape/portrait

(See /p/nstxusr1/util/idl_cvs/pswindow.pro)


PWD

[Previous Routine] [Next Routine] [List of Routines]
  NAME:
	pwd
  PURPOSE:
	print the current working directory

 CATEGORY:
	Utility, Programming
  OUTPUT:
   cwd     directory name string. if present in argument list
           directory string is not printed to terminal.

  AUTHOR:  Paul Ricchiazzi                            jan93
           Institute for Computational Earth System Science
           University of California, Santa Barbara

(See /p/nstxusr1/util/idl_cvs/pwd.pro)


READCOL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	READCOL

 PURPOSE:
	Read a free-format ASCII data file with columns of data into IDL 
	variables.  Lines of data not meeting the specified format (e.g. 
	comments) are ignored.  Columns may be separated by commas or spaces.
	Use READFMT to read a fixed-format ASCII file.   Use RDFLOAT for
	much faster I/O (but less flexibility).

 CATEGORY:
	Files

 CALLING SEQUENCE:
	READCOL, name, v1 [, v2, v3, v4, v5, ...  v25 , 
             FORMAT = , /DEBUG ,  /SILENT , SKIPLINE = , NUMLINE = ]

 INPUTS:
	NAME - Name of ASCII data file, scalar string.  In VMS, an extension of 
		.DAT is assumed, if not supplied.

 OPTIONAL INPUT KEYWORDS:
	FORMAT - scalar string containing a letter specifying an IDL type
		for each column of data to be read.  Allowed letters are 
		A - string data, B - byte, D - double precision, F- floating 
		point, I - integer, L - longword, and X - skip a column.

		Columns without a specified format are assumed to be floating 
		point.  Examples of valid values of FMT are

	'A,B,I'        ;First column to read as 6 character string, then 
			1 column of byte data, 1 column integer data
	'L,L,L,L'       ;Four columns will be read as longword arrays.
	' '             ;All columns are floating point

	If a FORMAT keyword string is not supplied, then all columns are 
	assumed to be floating point.

	SILENT - Normally, READCOL will display each line that it skips over.
		If SILENT is set and non-zero then these messages will be 
		suppressed.
	DEBUG - If this keyword is non-zero, then additional information is
		 printed as READCOL attempts to read and interpret the file.
	SKIPLINE - Scalar specifying number of lines to skip at the top of file
		before reading.   Default is to start at the first line.
	NUMLINE - Scalar specifying number of lines in the file to read.  
		Default is to read the entire file
	LINESSKIPPED - Ascii array of lines skipped
	TABDELIM - If set, then assume columns are delimitted by tabs

 OUTPUTS:
	V1,V2,V3,...V15 - IDL vectors to contain columns of data.
		Up to 25 columns may be read.  The type of the output vectors
		are as specified by FORMAT.

 EXAMPLES:
	Each row in a file POSITION.DAT contains a star name and 6 columns
	of data giving an RA and Dec in sexigesimal format.   Read into IDL 
	variables.     (NOTE: The star names must not contain internal spaces.)

	IDL> FMT = 'A,I,I,F,I,I,F'
	IDL> READCOL,'POSITION',F=FMT,name,hr,min,sec,deg,dmin,dsec  

	The HR,MIN,DEG, and DMIN variables will be integer vectors.

	Alternatively, all except the first column could be specified as
	floating point.

	IDL> READCOL,'POSITION',F='A',name,hr,min,sec,deg,dmin,dsec 

	To read just the variables HR,MIN,SEC
	IDL> READCOL,'POSITION',F='X,I,I,F',HR,MIN,SEC

 RESTRICTIONS:
	This procedure is designed for generality and not for speed.
	If a large ASCII file is to be read repeatedly, it may be worth
	writing a specialized reader.

	Columns to be read as strings must not contain spaces or commas, 
	since these are interpreted as column delimiters.  
	(UNLESS /TABDELIM is used). Use READFMT to read such files.

	Numeric values are converted to specified format.  For example,
	the value 0.13 read with an 'I' format will be converted to 0.

 PROCEDURES CALLED
	GETTOK(), NUMLINES(), REPCHR(), STRNUMBER(), ZPARCHECK

 REVISION HISTORY:
	24-Aug-99 Added LINESSKIPPED keyword
    10/99 Added TABDELIM keyword [Bill Davis]
	Written         W. Landsman                 November, 1988
	Modified	     J. Bloch 			June, 1991
	(Fixed problem with over allocation of logical units.)
	Added SKIPLINE and NUMLINE keywords  W. Landsman    March 92
	Read a maximum of 25 cols.  Joan Isensee, Hughes STX Corp., 15-SEP-93.
	Call NUMLINES() function W. Lansdman          Feb. 1996

(See /p/nstxusr1/util/idl_cvs/readcol.pro)


READ_LIST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       READ_LIST
 PURPOSE:
      Read a list from a text file and return a string array
 CATEGORY:
       Files
 CALLING SEQUENCE:
       IDL> str_array = READ_LIST(filename)
 INPUTS:
       filename = name of file containing lines of ascii data.  
 KEYWORD PARAMETERS:
       Keywords:
	  HLP - When set, help information is printed.
 OUTPUTS:
       str_array = returned array of strings - 1 per line             	out
 COMMON BLOCKS:
       NONE
 EXAMPLE:
	IDL> str_array = READ_LIST( filename )
 NOTES:
 MODIFICATION HISTORY:
       1-Apr-99 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/read_list.pro)


READ_NUMBERS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       read_numbers
 PURPOSE:
	Read a numeric array (1-D) from a text file
 CATEGORY:
       Files
 CALLING SEQUENCE:
       IDL> num_array = read_numbers(filename)
 INPUTS:
       filename = name of file containing lines of ascii data.  
 KEYWORD PARAMETERS:
       Keywords:
 OUTPUTS:
       num_array = returned array of floating point values
 COMMON BLOCKS:
       NONE
 EXAMPLE:
	IDL> num_array = read_numbers( filename )
 NOTES:;
 MODIFICATION HISTORY:
       28-Feb-2002 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/read_numbers.pro)


REMCHAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	REMCHAR

 PURPOSE:
	Remove all appearances of character (char) from string (st)

 CATEGORY:
	Strings

 CALLING SEQUENCE:
	REMCHAR, ST, CHAR

 INPUTS:
	ST  - String from which character will be removed.  
	CHAR- Character to be removed from string. 

 EXAMPLE:
	If a = 'a,b,c,d,e,f,g' then 

	IDL> remchar,a, ','

      will give a = 'abcdefg'

 REVISIONS HISTORY
	Written D. Lindler October 1986
	Test if empty string needs to be returned   W. Landsman  Feb 1991

(See /p/nstxusr1/util/idl_cvs/remchar.pro)


REMOVE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       REMOVE
 PURPOSE:
       Contract a vector or up to 7 vectors by removing specified elements   
 CATEGORY:
	Arrays
 CALLING SEQUENCE:
       REMOVE, index, v1,[ v2, v3, v4, v5, v6, v7]     
 INPUTS:
       INDEX - scalar or vector giving the index number of elements to
               be removed from vectors.  Duplicate entries in index are
               ignored.    An error will occur if one attempts to remove
               all the elements of a vector.

 INPUT-OUTPUT:
       v1 - Vector or array.  Elements specifed by INDEX will be 
               removed from v1.  Upon return v1 will contain
               N fewer elements, where N is the number of values in
               INDEX.

 OPTIONAL INPUT-OUTPUTS:
       v2,v3,...v7 - additional vectors containing
               the same number of elements as v1.  These will be
               contracted in the same manner as v1.

 EXAMPLES:
       (1) If INDEX = [2,4,6,4] and V = [1,3,4,3,2,5,7,3] then after the call

               IDL> remove,index,v      

       V will contain the values [1,3,3,5,3]

       (2) Suppose one has a wavelength vector W, and three associated flux
       vectors F1, F2, and F3.    Remove all points where a quality vector,
       EPS is negative

               IDL> bad = where( EPS LT 0, Nbad)
               IDL> if Nbad GT 0 then remove, bad, w, f1, f2, f3

 METHOD:
       If more than one element is to be removed, then HISTOGRAM is used
       to generate a 'keep' subscripting vector.    To minimize the length of 
       the subscripting vector, it is only computed between the minimum and 
       maximum values of the index.   Therefore, the slowest case of REMOVE
       is when both the first and last element are removed.

 REVISION HISTORY:
       Written W. Landsman        ST Systems Co.       April 28, 1988
       Cleaned up code          W. Landsman            September, 1992
       Converted to IDL V5.0   W. Landsman   September 1997
       Major rewrite for improved speed   W. Landsman    April 2000

(See /p/nstxusr1/util/idl_cvs/remove.pro)


REM_ELEM

[Previous Routine] [Next Routine] [List of Routines]
   Name: rem_elem

   Purpose: return subscripts of input array remaining after elements in 
            a second array are removed

   Category: 
	Arrays
   Input Parameters:
      inarray - array to search/remove from
      remarray - array of elements to search/remove from inarray

   Output Parameters:
      count - number of elements (subscripts) returned     

   Calling Sequence:
      ss = rem_elem(inarray,remarray) ; subscripts remaining or -1

   History:
      slf, 20-jan-1993
      slf,  7-feb-1993 - documentation carification and variable name change

(See /p/nstxusr1/util/idl_cvs/rem_elem.pro)


REPCHR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       REPCHR
 PURPOSE:
       Replace all occurrences of one character with another in a text string.
 CATEGORY:
	Strings
 CALLING SEQUENCE:
       new = repchr(old, c1, [c2])
 INPUTS:
       old = original text string.          in
       c1 = character to replace.           in
       c2 = character to replace it with.   in
            default is space.
 KEYWORD PARAMETERS:
 OUTPUTS:
       new = edited string.                 out
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
       R. Sterner.  28 Oct, 1986.
       Johns Hopkins Applied Physics Lab.
       RES 1 Sep, 1989 --- converted to SUN.
       R. Sterner, 27 Jan, 1993 --- dropped reference to array.

 Copyright (C) 1986, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /p/nstxusr1/util/idl_cvs/repchr.pro)


RESAMPLE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       resample

 PURPOSE:
       Resample a vector with triangular smoothing.

 CATEGORY:
	Smoothing

 CALLING SEQUENCE:
       smallerVector = resample( VECTOR, nth )

 INPUTS:
       VECTOR  = The vector to be smoothed
       nth = The full width of the window over which the median is 
               determined for each point (if even, use window+1).

 OUTPUT:
       Function returns every nth point of the smoothed input vector
 KEYWORDS:
	Indices - Optionally returned. Indices of resulting vector
	Guass - if set, will do psuedo-gaussian weighting, rather than triagular

 SUBROUTINES CALLED: 

 PROCEDURE:
       Each point is replaced by triangular weighting of the nearest WINDOW of points.
       The width of the window shrinks towards the ends of the vector.
 LIMITATION:
	This type of looping is inherently slow in IDL. 
	Should make a FORTRAN routine based on 
	BDAVIS$:[IDL.MDS.FOR]BCSMOOTH.FOR or interpwf.for & 
	use a CALL_EXTERNAL
 REVISION HISTORY:
       Written, Bill Davis. 23-Mar-00

(See /p/nstxusr1/util/idl_cvs/resample.pro)


RESETPLT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:                 
	RESETPLT

 PURPOSE:              
	This procedure will reset all or a selection
       of the system plot variables to their initial values

 CATEGORY:             
	Plotting

 CALLING SEQUENCE:     
			resetplt,/all           ;clear the !p, !x, !y, !z
                       resetplt,/x,/z          ;clear the !x and !z variables
                       resetplt,/x             ;only clear the !x variable
                       resetplt,/x,/invert     ;clear all except the !x
 INPUTS:
       KEYWORDS:
               x,y,z,p = clear the appropriate variable
               all     = clear all, this is equivalent to /x,/y,/z,/p
               invert  = invert the logic. Clear all unselected variables.
                         Therefore "clearplt,/all,/invert" does nothing.
 OUTPUTS:      
	none
 COMMON BLOCKS:
       none.
 SIDE EFFECTS:
      The sytem plot variables are changed.
 MODIFICATION HISTORY:
       Written by: Trevor Harris, Physics Dept., University of Adelaide,
               July, 1990.

(See /p/nstxusr1/util/idl_cvs/resetplt.pro)


RIGHTYAXISLIMITS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       rightYaxisLimits
 PURPOSE:
       Widget to set some Y Axis values for the right-hand axis
	in mdsw
 CATEGORY:
       Graphics, Widgets
 CALLING SEQUENCE:
       IDL> rightYaxisLimits
 INPUTS:
       none required  
 KEYWORD PARAMETERS:
    Inputs (Optional):
	nPlots - # of plots to allow for (def=8)
	GROUP_LEADER - This widget is destroyed if it's GL is destroyed
 OUTPUTS:
 COMMON BLOCKS:
       rightAxis
 EXAMPLE:
	IDL> rightYaxisLimits
 NOTES:
	Upgrade could use a user-defined system variable rather than common
 MODIFICATION HISTORY:
	13-Feb-01 Added multiple axes settings
	07-Feb-01 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/rightyaxislimits.pro)


RIGHT_ASPECT

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
	Right_Aspect

 PURPOSE: 
	Allow contour plots to have aspect ratio of data

 CATEGORY: 
	Graphics

 USE: IDL> Right_Aspect, xarray, yarray, POSITION=position
      IDL> Contour, xarray, yarray, Z, XSTYLE=1,YSTYLE=1, POSITION=position

 KEYWORD PARAMETERS:

  MARGIN:  The margin around the edges of the plot. The value must be
     a floating point value between 0.0 and 0.5. It is expressed in
     normalized coordinate units. The default margin is 0.15.
     If margin is a 2-element array, the first value is the left and 
     bottom margin, and the second is the right and top margin. Otherwise,
     the right and top margin is set to 1/2 the value of margin.

  WINDOWASPECT: The aspect ratio of the target window. If not provided,
     the value is obtained from the current graphics window.

  position: (OUTPUT) A four-element floating array of normalized coordinates.
     The order of the elements is [x0, y0, x1, y1], similar to the
     !P.POSITION system variable or the POSITION keyword on any IDL
     graphic command. If not present, will set system variable !p.position.

 LIMITATION: if the POSITION keyword is not used, then the 
	      !P.POSITION variable will be set after calling this routine. 
             So, after plotting, do this:  IDL> !P.POSITION = [0,0,0,0]
 MODIFICATIONS:
	04-Apr-01 Do like David Fanning routine, ASPECT, so will work with A4 paper
	14-Mar-01 Take into account !p.multi settings when computing !p.position
		  Also remove adjustment for x & y pixel number differences.
		  Add POSITION keyword (not fully tested)

(See /p/nstxusr1/util/idl_cvs/right_aspect.pro)


RUNTOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       runTot
 PURPOSE:
       compute a running total of an array by calling an external routine
	(this is inefficient in normal IDL)
 CATEGORY:
       Math
 CALLING SEQUENCE:
       IDL> outarray = runTot(inarray)
 INPUTS:
       inarray = a numeric array.  
 KEYWORD PARAMETERS:
       Keywords:
	  HLP - When set, help information is printed.
 OUTPUTS:
       outarray = returned array of running total                 			out
 COMMON BLOCKS:
       NONE
 EXAMPLE:
 	IDL> MDSOPEN, 'operations', 100601
	IDL> ip = MDSVALUE( '\operations::ip_ipf1b_1' )
	IDL> V = runTot( ip )
 NOTES:
       When the routine is called with no parameters, or with the
	keyword hlp set, help information is printed.
 MODIFICATION HISTORY:
       04-Oct-99 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/runtot.pro)


SCREENDUMP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       screendump
 PURPOSE:
       Postscript file from an IDL window, whether 8- or 24-bit graphics
 CATEGORY:
       Printing, 24-bit graphics
 CALLING SEQUENCE:
       IDL> screendump, filename, Encapsulated=encapsulated
 INPUTS:
       filename (or will be prompted)  
 KEYWORD PARAMETERS:
       Keywords:
	  Encapsulated - if set, will get encapsulated postscript
	  Right_Aspect - if set, will maintain aspect ration of window
 OUTPUTS:
       just the output file
 MODIFICATION HISTORY:
	09-May-02 Added bits_per_pixel=8 when not true color [BD]
		  still not working in 24-bit color (???)
	27-Jun-02 Added Right_Aspect keyword [BD]
	07-Mar-02 Added landscape determination [BD]
       ?? Written by David Fanning, www.dfanning.com.

(See /p/nstxusr1/util/idl_cvs/screendump.pro)


SCREEN_TITLE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       screen_title
 PURPOSE:
       write a plot title with shot date and time and NSTX label
 CATEGORY:
       Plotting
 CALLING SEQUENCE:
       IDL> screen_title, mytitle, ishot
 INPUTS:
       mytitle = whatever you want as the main plot title.  
       ishot = shot number.  
 KEYWORD PARAMETERS:
       Keywords:
	  noShot - if set, do not plot shot number
	  noTime - if set, do not plot time
	  HLP - When set, help information is printed.
 OUTPUTS:
       none
 COMMON BLOCKS:
       NONE
 EXAMPLE:
	IDL> !Y.OMARGIN=[0,1]
	IDL> plot,indgen(100)
	IDL> screen_title, 'This is my title', 100523 
 NOTES:
       You'll probably want a little more room at the top of your plots, e.g.
	IDL> !Y.OMARGIN=[0,1]
 MODIFICATION HISTORY:
       21-Sep-00 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/screen_title.pro)


SDEV

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       SDEV
 PURPOSE:
       Returns standard deviation of an array.
 CATEGORY:
	Math
 CALLING SEQUENCE:
       s = sdev(a)
 INPUTS:
       a = input array.               in
 KEYWORD PARAMETERS:
 OUTPUTS:
       s = standard deviation of a.   out
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
	01-Aug-00 Commented-out checks for a major speed up. [BD]
       Written by K. Kostoff, 1/16/85
       Johns Hopkins University Applied Physics Laboratory.
       Modified by B. Gotwols, R. Sterner --- 1 Oct, 1986.

 Copyright (C) 1986, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /p/nstxusr1/util/idl_cvs/sdev.pro)


SEARCHMDSNODES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        SearchMDSNodes
 PURPOSE:
      Search MDSplus nodes for string contents
 CATEGORY:
       MDSplus, Searching
 CALLING SEQUENCE:
       IDL> paths= SearchMDSNodes( keyword[, sensitivity, text=text][,path=path])
 INPUTS:
       keyword - string to search on
	sensitivity - (Optional) if ='Sensitive', then make search case sensitive
 KEYWORD PARAMETERS:
    Input (Optional):
       JustText - if set, just look for Text nodes (no effect if /TAGS set)
	nonNodeStr - exclude nodes in returned array if this string found in name
	tags - if set, just look for nodes with tags, and search tagnames
       sizesearch - when searching text, length of string to check (def=256)
    Returned (Optional):
       text (contains the full text found), path(returns the full path to the text)
	status - status from mdsvalue call
 OUTPUTS:
	result - status of function: 0 = success, -1 = failed to find
 COMMON BLOCKS:
       none
 EXAMPLE:
	IDL> result=SearchMDSNodes('xray', text=text,path=path)
 NOTES:
	tree must already be open before SearchMDSNodes can be called
	if no records are found in current tree returns -1 else returns 0
 MODIFICATION HISTORY:
	01-Dec-00 Added capability for wildcards in search string
	10-Nov-00 Added sensitivity [BD]
       7-Feb-00 Written by Dana Mastrovito, PPPL

(See /p/nstxusr1/util/idl_cvs/searchmdsnodes.pro)


SEARCHTEXTNODES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        SearchTextNodes
 PURPOSE:
      Search MDS Plus Trees for Textual Data
 CATEGORY:
       MDSplus, Searching
 CALLING SEQUENCE:
       IDL> result= SearchTextNodes( keyword[, sensitivity, text=text][,path=path])
 INPUTS:
       keyword - string to search on
	sensitivity - (Optional) if ='Sensitive', then make search case sensitive
 KEYWORD PARAMETERS:
       text (contains the full text found), path(returns the full path to the text)

 OUTPUTS:
	result - status of function: 0 = success, -1 = failed to find
   
 COMMON BLOCKS:
       none
 EXAMPLE:
	IDL> result=SearchTextNodes('xray', text=text,path=path)
 NOTES:
	tree must already be open before tsearch can be called
	if no records are found in current tree returns -1 else returns 0

 MODIFICATION HISTORY:
	01-Dec-00 Added capability for wildcards in search string
	10-Nov-00 Added sensitivity [BD]
       7-Feb-00 Written by Dana Mastrovito, PPPL

(See /p/nstxusr1/util/idl_cvs/searchtextnodes.pro)


SELECT_FONT

[Previous Routine] [Next Routine] [List of Routines]
 Name:
    SELECT_FONT
 Purpose:
    Select a Unix hardware font for IDL graphics.
 Category:
    Utility, Fonts

 Usage:
    SELECT_FONT

 Input:
    None required.

 Optional Keywords:
    /HELVETICA    Select a Helvetica font (default)
    /TIMES        Select a Times font
    /PALATINO     Select a Palatino font
    /COURIER      Select a Courier font
    /BOLD         Select a bold font (default is no bold)
    /ITALIC       Select and italic font (default is no italics)
    SIZE          If set to a named variable, sets the font size (default=12)
    NAME          If set to a named variable, returns the font name selected

 Revised:
    17-OCT-1997 Liam Gumley, CIMSS/SSEC
    Created

 Notes:
    (1) This procedure currently only works on Unix IDL platforms.
    (2) The NAME value returned by SELECT_FONT can be used to set the
        default widget font by the command

 Example:
 !P.MULTI=[0,1,2,0,0]
 PLOT,INDGEN(10)
 SELECT_FONT,/BOLD
 PLOT,INDGEN(10)

 NOTE:
     this version is only for Unix at the moment

(See /p/nstxusr1/util/idl_cvs/select_font.pro)


SETPMULTI

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 	setpmulti

 PURPOSE:
  	partition the screen into different graphs

  if 7 or less plot boxes, then 1 column of plots
  if more than 7 plot boxes, then 2 columns of plots

 CATEGORY:
       Graphics, Color Specification.

 CALLING SEQUENCE:
	setpmulit, nboxes
	setpmulit, nboxes, /SameXTitles
	setpmulit, nboxes, /SameXTitles, /sameXlabels, /SamePTitles
 INPUTS:
       nboxes: number of plot boxes per page
 KEYWORD PARAMETERS:
	CharSize   : Value desired for !P.CHARSIZE, else guesses
       SameXTitles: If set and non-zero, just place xtitle at bottom
		     (This reserves less vertical space between plots)
       SamePTitles: If set and non-zero, just place title at top
		     (This reserves less vertical space between plots)
       SameXlabels: If set and non-zero, just label x-axis at bottom
		     (This reserves less vertical space between plots)
	NRows	   : Maximum number of rows (default is 7) 
 COMMON BLOCKS:
       SetPMulti_Local

 SIDE EFFECTS:
       Leaves !P.MULTI set unless you call UnSetPMulti.
	Changes character sizes, etc.
 MODIFICATION HISTORY:
	01-May-01 fix for # of rows and columns
	24-Jan-01 Don't force !x.margin[1] to 3. Only reduce this for multi-
		  columns if !x.margin[1] = 3.
	11-Jan-01 Undid setting of !y.ticks, because can't force axis then
	21-Nov-00 Fine tuned !y.multi values; if no columns, make x.margin[1]=3
	18-Sep-00 Corrected SamePtitle keyword use
	24-Jun-99 changed charsize when more than one plot (to 1.4 if rows or cols > 2)
	03-Jun-99 added CHARSIZE keyword [BD]
	Jan-99 - Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/setpmulti.pro)


SETUP_PS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       setup_ps

 PURPOSE:
   	open postscript file and set system variables for postscript device

 CATEGORY:
	Printing

 CALLING SEQUENCE:  
   	SETUP_PS, name, PRINTER=printer

 INPUTS:
    (Optional)
	name - name of file (defaults to IDL)
		(if no extention, will add .ps)

 KEYWORD PARAMETERS:
    Optional Inputs:
	PRINTER  - printer to send file to (else will be default printer)
		  NOTE: if PRINTER begins with postscript', file will not be 
			sent to a printer
	PORTRAIT - If set, print is in portrait mode
	FONT     - font for printing, e.g., TIMES, HELVETICA, AVANTGARDE,
		   BKMAN, BOLD,PALATINO,ZAPFCHANCERY,NARROW (Default is Times)
	AspectRatio - if set, Ascpect ratio of image is maintained
	CharMagnification - magnify !p.charsize (or, if !p.charsize=0, use as charsize)
 OUTPUTS:
	none

 CALLING EXAMPLE:
   	 printer = 'picasso color printer'	; or
   	 printer = 'postscript color '		; or
   	 printer = 'b143 Laserwriter in B143'	; or
   	 printer = 'default printer'		; 
   	 setup_ps,'myplot', PRINTER=printer
   	 plot,indgen(11)			; any number of plot commands
   	 unsetup_ps				; send to printer and back to X

 RELATED ROUTINES:
   	unsetup_ps

 SIDE EFFECTS:
	System variables are changed until unsetup_ps is called.

 NOTE:
	If you haven't already, you may wish to plot on a white background, e.g.,
	   IDL> !p.background=MK_COLOR('white')
	   IDL> !p.color=MK_COLOR('black')

 MODICATION HISTORY:
   03-Aug-01 Append .ps to output filename if not specified
   04-Apr-01 make max paper width 8.25 to account for A4 paper size.
		make margins 3/4" (rather than 1")
   21-May-99 Added Font keyword (default changed to Times) [BD]
    1-Apr-99 Added Portrait Keyword [BD]
   12-Feb-99 Write file in the login area. Don't send to D4D area. [BD]
		Printer can have "color" after the name (following a space)
   27-Jan-99   BD  - change y.margin settings
   10/15/97    BD  - Removed bold fonts and set to landscape mode
   10/13/97    TBT - Added phaser5
    6/11/97    TBT - took out printer from discolor and added as
                     a keyword
    5/22/97    TBT - added phaser4 & phaser4_trans & hpdj2
    5/21/97    TBT - added include discolor to get printer passed in.
    5/21/97    Ted Terpstra - Put in color printer check &
                              added phaser2 and phaser3 to the list.
    5-16-95    K. Greene -- When setting up output file name, check
               operating system.  VMS cannot use Unix format.

(See /p/nstxusr1/util/idl_cvs/setup_ps.pro)


SETUP_TEK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       setup_tek

 PURPOSE:
   	Set system variables for tektronix device.
  	Use to direct plots to the Tek window in Versaterm, or to XTC.
 CATEGORY:
	Graphics, Cross-platform plotting

 CALLING SEQUENCE:  
   	setup_tek

 INPUTS:

 KEYWORD PARAMETERS:
    Optional Inputs:
	CharMagnification - magnify !p.charsize (or, if !p.charsize=0, use as charsize)
 OUTPUTS:
	none

 CALLING EXAMPLE:
   	 setup_tek
   	 plot,indgen(11)			; any number of plot commands
   	 unsetup_tek				; send to printer and back to X

 RELATED ROUTINES:
   	unsetup_tek

 LIMITATIONS:
	Y-axis ticklabels may overlay the axis. If so, you may use:
	   IDL> plot, x, y, YTICKFORMAT='betterticklabels', ...	
 SIDE EFFECTS:
	System variables are changed until unsetup_tek is called.

 NOTE:
 MODICATION HISTORY:
   26-Oct-00 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/setup_tek.pro)


SHADE_SURFRANGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       shade_surfrange
 PURPOSE:
       make SHADE_SURF plots with x & y ranges (correctly)
 CATEGORY:
	2-D Plotting
 CALLING SEQUENCE:
        shade_surfrange, f, x, y, XRANGE=xrange, YRANGE=yrange, _EXTRA =_extra
 INPUTS:
       f, x & y are just as for surf      in
 KEYWORD PARAMETERS 
	Input:
	  XRANGE - array containing min x & max x
	  YRANGE - array containing min y & max y
	  ZRANGE - array containing min y & max y
	  _EXTRA - standard idl EXTRA keyworrd
 OUTPUTS:
	none
 EXAMPLE:
	x=findgen(100)
	y=x 
	f=DIST(100)
	_EXTRA = { title: 'My Title', $		; pass any extra SHADE_SURF keywords here
	           xtitle: 'seconds', $
		   ax : 40  }
	shade_surfrange, f, x, y, xrange=[20,40], yrange=[50,70],  _EXTRA =_EXTRA
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
     09-Jul-02 Handle when yrange or xrange reversed (i.e., first > last)
     17-Aug-01 Handle correctly when !z.range set
     17-Oct-00 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/shade_surfrange.pro)


SHOWBITS

[Previous Routine] [Next Routine] [List of Routines]
  NAME:
       showbits
  PURPOSE:
       Given a byte or integer, return a vector of 8 or 16 values
       which are the binary representation of the value.
  CATEGORY:             
	Bits, Hardware
  USAGE:
	bitarr = SHOWBITS( invalue, /print )
  INPUT:
       invalue - The byte or integer value to check
  OUTPUT:
       bitarr  - The 8-element array with values set
                 if the bit is set
  KEYWORDS:
    (Optional)
	NtoShow - # of bits to show
  HISTORY:
	29-Oct-99 Converted to Function by Bill Davis, ntoshow added
       Written 1988 by M.Morrison
       13-Nov-92 (MDM) - Modified to allow integer*2 values
                         and to allow an array of values.
        7-Apr-94 (MDM) - Allow integer*4 values
       15-Aug-94 (MDM) - Corrected error from 7-Apr-94 mod which
                         did not allow an array of inputs
  LIMITATIONS:
	Only works for non-negative, fixed-point numbers

(See /p/nstxusr1/util/idl_cvs/showbits.pro)


SIGN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       SIGN
 VERSION:
       3.0
 PURPOSE:
       Gives the sign of X, i.e. 1 for positive, -1 for negative, 0 for 0.
 CATEGORY:
       Math
 CALLING SEQUENCE:
       Result = SIGN(X)
 INPUTS:
    X
       Numerical, otherwise arbitrary.
 OPTIONAL INPUT PARAMETERS:
       None.
 KEYWORD PARAMETERS:
       None.
 OUTPUTS:
       Returns the value of SIGN(X), see above, as an long integer.
 OPTIONAL OUTPUT PARAMETERS:
       None.
 COMMON BLOCKS:
       None.
 SIDE EFFECTS:
       None.
 RESTRICTIONS:
       For complex X the result is SIGN(REAL(X)), the imaginary part is ignored
 PROCEDURE:
       Straightforward.  Using CAST from MIDL.
 MODIFICATION HISTORY:
       Created 15-JUL-1991 by Mati Meron.
       Modified 25-DEC-1991 by Mati Meron.
       Modified 5-DEC-1993 by Mati Meron.  Output type changed to LONG.

(See /p/nstxusr1/util/idl_cvs/sign.pro)


SMOOTH2

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       SMOOTH2
 PURPOSE:
       Do multiple smoothing. Gives near Gaussian smoothing.
 CATEGORY:
	Smoothing
 CALLING SEQUENCE:
       b = smooth2(a, w)
 INPUTS:
       a = array to smooth (1,2, or 3-d).  in
       w = smoothing window size.          in
 KEYWORD PARAMETERS:
	EDGE_TRUNCATE - as in SMOOTH
 OUTPUTS:
       b = smoothed array.                 out
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
       R. Sterner.  8 Jan, 1987.
       Johns Hopkins University Applied Physics Laboratory.
       RES  14 Jan, 1987 --- made both 2-d and 1-d.
       RES 30 Aug, 1989 --- converted to SUN.
       R. Sterner, 1994 Feb 22 --- cleaned up some.
	25-Apr-00 Added EDGE_TRUNCATE keyword.

 Copyright (C) 1987, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /p/nstxusr1/util/idl_cvs/smooth2.pro)


SPAWNPRINT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       spawnprint
 PURPOSE:
       Spawn command on VMS or Unix to print a Postscript file
 CATEGORY:
       Printing
 CALLING SEQUENCE:
       IDL> spawnprint, filename, printer=printer
 INPUTS:
       filename (or will be prompted)  
 KEYWORD PARAMETERS:
       Keywords:
	  printer - else will go to the default printer
		  NOTE: if PRINTER begins with postscript', file will not be 
			sent to a printer
 OUTPUTS:
       none
 MODIFICATION HISTORY:
       07-Mar-02 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/spawnprint.pro)


SPEC_DIR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SPEC_DIR
 PURPOSE:
	Provide a complete file specification by appending a default disk
	or directory if necessary.

 CATEGORY:
	Files, OS Specific, Strings
 CALLING SEQUENCE:                      
	File_spec = SPEC_DIR( filename, [ extension ] )
 INPUT:
	filename - character string giving partial specification of a file
		name.  Examples for different operating systems include the
			following:
		VMS: '$1$DUA5:TEST.DAT','[.SUB]TEST'
		Unix: pro/test.dat, $IDL_HOME/test
		MacOS: ':Programs:test'
		Windows: '\pro\test.dat','d:\pro\test'

 OPTIONAL INPUT:
	exten - string giving a default file name extension to be used if
		filename does not contain one.  Do not include the period.

 OUTPUT:
	File_spec - Complete file specification using default disk or 
		directory when necessary.  

 EXAMPLE:
	IDL> a = spec_dir('test','dat')

	is equivalent to the commands
	IDL> cd, current=cdir
	IDL> a = cdir + delim + 'test.dat'

	where delim is the OS-dependent separator 
 METHOD:
	SPEC_DIR() decomposes the file name using FDECOMP, and appends the 
	default directory (obtained from the CD command) if necessary.   
	Under VMS, SPEC_DIR() will also try to translate disk and directory 
	logical names.

	SPEC_DIR() does not check whether the constructed file name actually
	exists.
 PROCEDURES CALLED:
	FDECOMP, OS_FAMILY()
 REVISION HISTORY:
	Written W. Landsman         STX         July, 1987
	Added Unix compatibility, W.  Landsman, STX   August 1991
	Added Windows and Macintosh compatibility   W. Landsman  September 1995

(See /p/nstxusr1/util/idl_cvs/spec_dir.pro)


SPRED_VIPS_SHOTS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       spred_vips_shots
 PURPOSE:
      Search MDS Plus Trees for valid Spred and Vips2 shot numbers 
 CATEGORY:
       Utility
 CALLING SEQUENCE:
       IDL> spred_vips_shots ; This is interactive widget version
 or    IDL>spred_vips_shots, 'spred',beginshotnumber,endshotnumber
 or	IDL>spred_vips_shots, 'vips2',beginshotnumber,endshotnumber
 INPUTS:
       none 
 KEYWORD PARAMETERS:
       none
 OUTPUTS:
       on screen: valid shot numbers in entered range               			
 COMMON BLOCKS:
       none
 NOTES:
       
 MODIFICATION HISTORY:
       3-JAN-2001 Written by Dana Mastrovito, PPPL

(See /p/nstxusr1/util/idl_cvs/spred_vips_shots.pro)


STACKPLOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
	stackplot

 PURPOSE: 
	An example of X-window widgets for plotting some GA data

 CATEGORY:             
	Plotting, Example, Widgets, GA

 CALLING SEQUENCE: 
	stackplot

 USE:
  	If you have a file named mdsplussig.txt in the directory
	from which you are running IDL, signal names in the file
	will be plotted when you click on "My Signals." The names
	should be one per row.

 MAJOR FUNCTIONS and PROCEDURES:
       PLOT: X-Y plotting.
       SMOOTH: Smooths data and overplots.

 MODIFICATION HISTORY: Written by:  WMD, PPPL, March, 1997
                       based on RSI's Forecast example
	26-Jan-99 Modified for using MDS at PPPL by Bill Davis
       21-Oct-97 WMD Simplified for IDL class example at GA
       15-Apr-97 WMD Changed for remote plotting test

(See /p/nstxusr1/util/idl_cvs/stackplot.pro)


STRARRAYSAME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
      StrArraySame
 PURPOSE:
      Returns TRUE if two strings, or string arrays, are identical, else FALSE
 CATEGORY:
      Strings
 CALLING SEQUENCE:
      Result = StrArraySame( STRING1, STRING1 )
 INPUTS:
    STRING1 & STRING1
      Character strings.
 KEYWORD PARAMETERS:
      IGNORECASE - if set then ignore case in comparison
 OUTPUTS:
      Returns 1 if the words in two strings, or string arrays are identical, 
	else 0.
       e.g. 'ece1 ece2' is considered equal to ['ece1','ece2']
 OPTIONAL OUTPUT PARAMETERS:
      None.
 COMMON BLOCKS:
      None.
 SIDE EFFECTS:
      None.
 RESTRICTIONS:
      None.
 MODIFICATION HISTORY:
      Created 19-Sep-97 by Bill Davis

(See /p/nstxusr1/util/idl_cvs/strarraysame.pro)


STRMATCH

[Previous Routine] [Next Routine] [List of Routines]
  NAME:    
	strmatch

  PURPOSE:    
	check for string match to a wild card specification

 CATEGORY:             
	Strings

  USAGE:     
	result=strmatch(str,spec)

  INPUT:
    	str       string
   	spec      wild card specification

  OUTPUT:    1 if STR matches SPEC
             0 if STR does not match SPEC

  LIMITATIONS:
             Currently the only wild card character is asterisk, "*"
             which matches 1 or more arbitrary characters.

  
  EXAMPLE:    
             print,strmatch('string','st*ng')      ;  => 1
             print,strmatch('string','*st*ng')     ;  => 0
             print,strmatch('string','*t*ng')      ;  => 1
             print,strmatch('string','st*ng*')     ;  => 0
             print,strmatch('string','st*n*')      ;  => 1

  AUTHOR:  Paul Ricchiazzi                            jan94
           Institute for Computational Earth System Science
           University of California, Santa Barbara

(See /p/nstxusr1/util/idl_cvs/strmatch.pro)


STRNUMBER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	STRNUMBER
 PURPOSE:
	Function to determine if a string is a valid numeric value.
 CATEGORY:             
	Strings
 CALLING SEQUENCE:
       result = strnumber(st,val)
 INPUTS:
       st - string
 OUTPUTS:
       1 is returned as the function value if the string st has a
       valid numeric value, otherwise, 0 is returned.
 OPTIONAL OUTPUT:
       val - (optional) value of the string.  real*8
 WARNING:
       Note that (as of Version 2.0.10) a blank string (e.g. " ") is not
       a valid numeric value, although an empty string ("") is.
 HISTORY:
       version 1  By D. Lindler Aug. 1987

(See /p/nstxusr1/util/idl_cvs/strnumber.pro)


STRPARSE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       STRPARSE
 VERSION:
       3.0
 PURPOSE:
       Parses the string LINE using the characters in DELIM as delimiters.  
       Puts individual pieces into consecutive locations in LIST.
 CATEGORY:
       Strings
 CALLING SEQUENCE:
       Result = STRPARSE( LINE, DELIM [, LIST])
 INPUTS:
    LINE
       Character string.
    DELIM
       Character string.  Each Character of DELIM is used as a delimiter.
 OPTIONAL INPUT PARAMETERS:
       None.
 KEYWORD PARAMETERS:
       None.
 OUTPUTS:
       Returns the number of pieces found minus one i.e. the index of the last
       element of LIST if LIST is provided.  If LINE is a null string or not a
       string, the function returns -1l.
 OPTIONAL OUTPUT PARAMETERS:
    LIST
       Character array.  If name is provided, the pieces of LINE resulting 
       from the parsing process are returned in consecutive locations in LIST.
 COMMON BLOCKS:
       None.
 SIDE EFFECTS:
       None.
 RESTRICTIONS:
       None.
 PROCEDURE:
       Straightforward.  Using the function TYPE from MIDL.
 MODIFICATION HISTORY:
       Created 15-JUL-1991 by Mati Meron.

(See /p/nstxusr1/util/idl_cvs/strparse.pro)


STRWHERE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:  
	strwhere

 PURPOSE:  
	a "where" operator for strings matching a set of string 
       wild cards

 CATEGORY:             
	Strings, Searching

 USAGE:  result = strwhere( starr, wildcard )
         result = strwhere( starr, wildcard, nfound )

 INPUT:    
   starr   an array of strings                   

   wildcard  wild card specifier composed of regular and special
           characters.  The special characters are  asterisk '*'
           and vertical bar '|'.  The asterisk matches any number of
           characters the vertical bar indicates an "or" operation
           between different wild card specifications.

 KEYWORD INPUT:

   orchar  character used to indicate "or" wildcard operation.
           (default = '|')

 OUTPUT:
   result  an index array such that starr(result) = those elements of
           STARR that match the wild card specification in WILDCARD
   

 EXAMPLE:  

  f=findfile(/home/paul/arm/arese/bsrn/sgpbsrnC1.a1.*.cdf)
  clrdays='*1018*|*1022*|*1030*'
  print,f(strwhere(f,clrdays))

 AUTHOR:   Paul Ricchiazzi                        14 Jan 97
           Institute for Computational Earth System Science
           University of California, Santa Barbara
           paul@icess.ucsb.edu

 REVISIONS:
	21-Jan-00 Make work for no matches. Add nfound. [Bill Davis]

(See /p/nstxusr1/util/idl_cvs/strwhere.pro)


SURFRANGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       surfrange
 PURPOSE:
       make SURF plots with x & y ranges (correctly)
 CATEGORY:
	2-D Plotting
 CALLING SEQUENCE:
        surfrange, f, x, y, XRANGE=xrange, YRANGE=yrange, _EXTRA =_extra
 INPUTS:
       f, x & y are just as for surf      in
 KEYWORD PARAMETERS 
	Input:
	  XRANGE - array containing min x & max x
	  YRANGE - array containing min y & max y
	  ZRANGE - array containing min y & max y
	  _EXTRA - standard idl EXTRA keyworrd
 OUTPUTS:
	none
 EXAMPLE:
	x=findgen(100)
	y=x 
	f=DIST(100)
	_EXTRA = { title: 'My Title', $		; pass any extra SURF keywords here
	           xtitle: 'seconds', $
		   ax : 40  }
	surfrange, f, x, y, xrange=[20,40], yrange=[50,70],  _EXTRA =_EXTRA
 COMMON BLOCKS:
 NOTES:
	logic is still not perfect. See, e.g., 
	AUSER4:[BDAVIS.TEST.NDD]NDD3D.PRO for a working example of overlaying
	surface plot on a shaded surface plot with ranges set.
 MODIFICATION HISTORY:
     09-Jul-02 Handle when yrange or xrange reversed (i.e., first > last)
     17-Aug-01 Handle correctly when !z.range set
     17-Oct-00 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/surfrange.pro)


TAGRANKOF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       tagRankOf
 PURPOSE:
       Return a list of MDSplus signals with a certain rank
	(that contain data)
 CATEGORY:
       MDSplus
 CALLING SEQUENCE:
       tags = tagRankOf( rankDesired )
 INPUTS:
       rankDesired = 0 for scalars, 1 for vectors, etc.  
 KEYWORD PARAMETERS:
    Optional Keywords:
	filter - wild card specifer. E.g. '*ip*' will get all of 
		 specifed rank with ip in the the tag name.
	fullpaths - returns full pathnames of tags found
	print  - if set, tags and full pathnames found will be printed
 OUTPUTS:
       tags = tagnames of specifed rank fitting any filter specified
		if none are found fitting criteria, 'none' is returned.
 EXAMPLE:
	IDL> stat=openMDSshot('microwave',101523)
	IDL> scalarNames = tagRankOf(0)
	IDL> someSigs = tagRankOf( 1, filter='n*', /print )
 COMMON BLOCKS:
       none
 NOTES:
       Only returns signals with data in them.
 LIMITATIONS:
	An MDSplus shot file must be open first.
 MODIFICATION HISTORY:
	14-Mar-00 more efficient & added keywords [BD]
	20-Jan-00 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/tagrankof.pro)


TAGSEARCH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       tagsearch
 PURPOSE:
      Search MDS Plus Trees for a tag
 CATEGORY:
       Utility
 CALLING SEQUENCE:
       IDL> result=tagsearch(searchtag[,tag=tag, path=path])
 INPUTS:
       searchnode and optional variable to return an array of full paths containing
	 tag name and an array containing the tag names
 KEYWORD PARAMETERS:
    Returned:
       fullpath
	tag
 OUTPUTS:
       status of function              			
 COMMON BLOCKS:
       none
 EXAMPLE:
	IDL> result=tagsearch('xp_', tag=tag, fullpath=path)
 NOTES:
       will return 0 if tag is found and -1 if it is not found in the tree specified
 MODIFICATION HISTORY:
	01-Dec-00 Added capability for wildcards in search string
       28-Feb-00 Written by Dana Mastrovito, PPPL

(See /p/nstxusr1/util/idl_cvs/tagsearch.pro)


TAG_EXIST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	TAG_EXIST
 PURPOSE:
	To test whether a tag name exists in a structure.
 CATEGORY:
	MDSplus, structure
 CALLING SEQUENCE:
       status = tag_exist(str, tag)
 INPUTS: 
	str  -  structure variable to search
       tag  -  tag name to search for
 OUTPUTS: 
	Function returns 1 if tag name exists or 0 if it does not.
 KEYWORDS:
	INDEX = index of matching tag
 METHOD:
	Routine obtains a list of tagnames and tests whether the
       requested one exists or not. The search is recursive so 
       if any tag names in the structure are themselves structures
       the search drops down to that level.
 Common      : None
 Restrictions: None
 Side effects: None
 Written     : C D Pike, RAL, 18-May-94
 Modified    : Version 1.1, D Zarro, ARC/GSFC, 27-Jan-95
               Passed out index of matching tag
 Version     : Version 1.1, 27-Jan-95

(See /p/nstxusr1/util/idl_cvs/tag_exist.pro)


TDIS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       tdis
 PURPOSE:
      Search MDS Plus Trees for TDI DATA
 CATEGORY:
       MDSplus, Utility
 CALLING SEQUENCE:
       IDL> result = tdis( keyword[,sensitvity][, tdi=tdi][,path=path] )
 INPUTS:
       searchstring and optional variables to control case sensitivity and return an array of text strings found
	and an array of paths to those strings
 KEYWORD PARAMETERS:
   (output)
       tdi  - the full tdi found 
	path - the full path to the text

 OUTPUTS:
	result=status of function
   
 COMMON BLOCKS:
       none
 EXAMPLE:
	IDL> result=tdi('build','sensitive',tdi=tdi,path=path)
 NOTES:
       this version is specifically for idl4 (?)
	tree must already be open before tsearch can be called
	if no records are found in current tree returns -1 else returns 0

 MODIFICATION HISTORY:
	30-Jan-00 Speed up. Fixed node names.
	01-Dec-00 Added capability for wildcards in search string
       07-Feb-00 Written by Dana Mastrovito, PPPL

(See /p/nstxusr1/util/idl_cvs/tdis.pro)


TEMPLATE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       TEMPLATE
 PURPOSE:
       Provide a template for IDL routines to be used by others
 CATEGORY:
       Utility
 CALLING SEQUENCE:
       IDL> opt = template(input)
 INPUTS:
       input = whatever.  
 KEYWORD PARAMETERS:
       Keywords:
	  HLP - When set, help information is printed.
 OUTPUTS:
       opt = returned value                 			out
 COMMON BLOCKS:
       NONE
 EXAMPLE:
	IDL> opt = TEMPLATE( /HLP )
 NOTES:
       When the routine is called with no parameters, or with the
	keyword hlp set, help information is printed.
 MODIFICATION HISTORY:
       28-Oct-00 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/template.pro)


TESTCMD

[Previous Routine] [Next Routine] [List of Routines]
  NAME:
	testcmd 
  PURPOSE:
	test batch execution

 CATEGORY:             
	Example, Batch

  INVOCATION: 
	$ IDL runtestcmd.pro

    Where runtestcmd.pro might contain:
	testcmd, key='key input', file='newfile.txt'
	exit

 WRITTEN by Bill Davis, 23-Apr-99

(See /p/nstxusr1/util/idl_cvs/testcmd.pro)


TH_IMAGE_CONT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       TH_IMAGE_CONT
 PURPOSE:
       Plot contours of Images with both contour lines and colors
 CATEGORY:
	2-D Plotting
 USAGE:
******************** HIGH FREQUENCY RADAR DIVISION, SRL **********************
*************************** Ionospheric Effects ******************************
HELP
1 TH_IMAGE_CONT
	Overlays an image and a contour plot and optionally adds a scale bar.
	Based on the IDL USERLIB routine IMAGE_CONT. This routine supersedes 
	the USERLIB one, having far more functionality, yet capable of EXACTLY
	reproducing the effect of IMAGE_CONT. Scale bar appears on the 
	right-hand-side unless /NOBAR is set. NB: the scale bar is
	automatically created by a recursive call to this routine using the
	same colour and image parameters 

 Format:
	In its simplest form (allowing all parameters to default)

    IDL> TH_IMAGE_CONT, IMAGE

	or,

    IDL> TH_IMAGE_CONT, IMAGE, X, Y

	And in its most complex form, specifying ALL parameter

    IDL> TH_IMAGE_CONT, IMAGE, $
		ASPECT=aspect, $
		BADPTS=badpts,$
     		BAR_LABEL_LENGTH=bar_label_length, $
		BAR_RANGE=bar_range, $
		BAR_SEPARATION=bar_separation, $
		BAR_TICKLEN=bar_ticklen, $
		BAR_TICKNAME=bar_tickname, $
		BAR_TICKS=bar_ticks, $
		BAR_TICKV=bar_tickv,$
		BARSZ_CHARS=barsz_chars, $
		BOTTOMCOLOUR=bottomcolour,$
		C_COLORS=c_colors,$
		C_LINESTYLE=c_linestyle, $
		C_THICK=c_thick, $
		CONGRID=congrid, $
		CONT=cont, $
		CRANGE=crange, $
		CT=ct, $
		CUBIC=cubic, $
		DEBUG=debug, $
		EXACT=exact, $
		RAISE_PTITLE=raise_ptitle
		IMAGE_WINDOW=image_window, $
		INTERP=interp,$
		LEVELS=levels,$
		MAX_VALUE=max_value, $
		NLEVELS=nlevels, $
		NOBAR=nobar, $
		NOCONT=nocont, $
		NOERASE=noerase,$
		TOPCOLOUR=topcolour,$
		TSIZE=tsize, $
		WINDOW_SCALE=window_scale, $
		XRANGE=xrange, $
		YRANGE=yrange
 
2	IMAGE
		2-dimensional array to display as an image.

2	/ASPECT
		set to retain image's aspect ratio.  Assumes square
		pixels.  If /WINDOW_SCALE is set, the aspect ratio is retained.

2	BADPTS
		indices into IMAGE data which define the bad points.
		These will not be contoured

2 BAR_LABEL_LENGTH
     the space, in characters (default = 2), for the bar label
2	BAR_RANGE	
	 	set the range limits for the colour scale bar
		(same as CRANGE, defaults to autoscaling if
		 BAR_TICKV not set)

2	BAR_SEPARATION	
		the separation, in characters (default = 2), between the scale
		bar and the image. Note that the |y-ticklength| will be added
		to this value if y-ticklength < 0.
		Both the image and the colour bar need to fit 
		into the space allowed for the plot window, otherwise an
		informative message will be printed and unpredictable results
		may occur for the displayed image 

2	BAR_TICKS
		set the number of tick intervals for the labelling
		of the scale bar 
		(defaults to !z.ticks)

2	BAR_TICKV
		the values to label on the scale bar. If this is set
		then the scale bar will have AT LEAST this range
		(defaults to !z.tickv)

2	BAR_TICKNAME
		the labels to use on the scale bar 
		(defaults to !z.range)

2	BAR_TICKLEN
		the length of the ticks on the scale bar  in fractions of tick
		bar window, (defaults to !z.ticklen)

2	BARSZ_CHARS
		the size of the scale bar in characters (default = 2). 
		Both the image and the colour bar need to fit 
		into the space allowed for the plot window, otherwise an
		informative message will be printed and unpredictable results
		may occur for the displayed image. If the value of this
		keyword is <=0 then no bar will be displayed BUT the scaling
		and window size will be calculated as those a colour bar is to
		be used. This is useful when doing multiple plots per page
		where only some scale bars are not required but you want the
		plots to all be the same size. Set BARSZ_CHARS = -#chars to
		allow room for a bar of #chars size but not to put a scale bar
		on the plot. Then set BARSZ_CHARS = +#chars to plot the bar on
		alongside another plot, to end up with images of the same
		size. Useful in collaboration with the SIDES procedure (which
		will set flags for when the plot is on the Left,Right,Top and
		Bottom of the plot window).


2	BOTTOMCOLOUR
		Set this keyword to the colour index of the desired bottom
		colour (range from 0 to TOPCOLOUR-1).
		Note that the default value for this keyword is 1,
		which allows the colour of the image to
		be independent of the background and axes colours
		(!P.background and !P.color). If the user sets this keyword
		then allowance should be made for these colours as they are
		generally swapped for POSTSCRIPT and X-Window devices

2	/CONGRID 	
		if the image has to be resampled then use the USERLIB CONGRID
		routine 

2	/CONT 	
		only do the contouring (no image)

2	CRANGE	
		set the range limits for the colour scale bar
		(same as BAR_RANGE, defaults to autoscaling if
		 BAR_TICKV not set)

2	CT	
		load a color table (uses LOADCT via MK_COLOR)

2	/CUBIC	
		if the image has to be resampled AND interpolated then use the
		CUBIC interpolation rather than the bi-linear (see INTERP
		Keyword) 

2	/DEBUG	
		write out some inforamtion as it goes


2	/EXACT
 
		When set this will force the contour routine to fit to the
		exact positions relative to the image.
		When data is displayed as an image each datum is expanded out
		to fill a pixel of finite dimensions. The assignment of where
		the "data value" resides within this space is open to debate,
		but is most appropriately (to this author) assigned to the
		geometric centre of the pixel. Most defaults assign this
		position to be at the bottom left-hand corner of the
		pixel. Contour will fit to the 2-d plane assuming that the
		data value is associated with the bottom left-hand corner. To
		reconcile this with the notion of the value being in the
		middle of the pixel the contour call is made with the x/y
		values and ranges for the image adjusted (effectively by half
		a pixel in the x/y directions). This is the EXACT mapping. By
		default, the mapping will be the default contour one.

2	RAISE_PTITLE
		Raise the plot title by this many character units above the
		plot to allow room to put a label on the top x-axis. Default
		is raise by 1 char. If not called then the default y-position
		is 1 char unit above plot (allowing room for xticks, and
		scaled by !P.charsize)

2	IMAGE_WINDOW
		the position of the image window. Can be used to set
		!p.position so you can over-plot the image.
		(Only useful when the scale-bar has been used)

2	/INTERP 
		set to bi-linear interpolate if image is resampled.
		(see also the CUBIC keyword)

2	/NOBAR 
		dont put a scale bar on the right-hand-side

2	/NOCONT
		only do the imaging (no contours)

2	/NOERASE
		dont erase the previous plot

2	TOPCOLOUR
		Set this keyword to the colour index of the desired bottom
		colour (range from BOTTOMCOLOUR+1 to !D.n_colors-1). Note that
		the default value for this keyword is !D.n_colors-2, which
		allows the colour of the image to be independent of the
		background and axes colours (!P.background and !P.color). If
		the user sets this keyword then allowance should be made for
		these colours as they are generally swapped for POSTSCRIPT and
		X-Window devices 

2	TSIZE	
		size of the plot title (default = 1)
 
2	/WINDOW_SCALE
		set to scale the window size to the image size,
		otherwise the image size is scaled to the window size.
		Ignored when outputting to devices with scalable pixels.

2	XRANGE
		will set the ranges for the x-axes labelling

2	YRANGE
		will set the ranges for the y-axes labelling

2	Contour
		most of the CONTOUR parameters are passed directly

2 Examples
 IDL>   th_image_cont, image

 IDL>	th_image_cont, image, /nocont, /nobar

 IDL>	!p.title = "!17 This is an example of what can be done"
 IDL>	!x.title = "X Title"	& !y.title = "Y Title"	& !z.title = "Z Title"
 IDL>	!x.ticklen = -0.02	& !y.ticklen = -0.02	& !z.ticklen = -0.02
 IDL>	!p.charsize = 1.5
 IDL>	levels = findgen(5)*2
 IDL>	image = findgen(20,20)/40.
 IDL>	th_image_cont, image, crange=[0,10], /follow, level=levels, $
			tsize=1.5*!p.charsize, bar_tickv=levels, c_char=1.5

2 Error_responses
 Returns to the calling procedure on an error

2 Limitations/Assumptions 
	The currently selected display is affected.
	If the device has scalable pixels then the image is written over
	the plot window.
	As with all TV style image displays, the axes range is independent of 
	the image, so it is up to the user the ensure correct labelling of the
	axes.
	NOTE: if the user aborts while this routine is processing then the 
	system variables (in particular !p.position) will have 
	been changed, causing subsequent plots to appear different. Issue the 
	command "resetplt,/all" to reset all the system variables back to the 
	startup state.

	NOTE: if x or y does not have a constant interval, the image will be
		wrong. Instead, use contour, /fill...
2 References 
 	See USERLIB IMAGE_CONT

2 Keywords
	Graphics images contours

2 MODIFICATIONS:
  -------------
  25-Oct-01 Made Contours work when /ASPECT set. Made Contours work when
	     XRANGE or YRANGE set.
  18-Apr-00 Made interpolated image align with data. /EXACT does not give
		  an exact representation. Warn if !x.style=2
  06-Dec-99 Added another pixel to TV image size, so it fills the grid square
  23-Aug-99 Allow Contour, Z, X, Y format. Use MK_COLOR
  07-Jan-98 BD allow more space at the bottom and right-hand side for text
               (keyword BAR_LABEL_LENGTH added)
  07-Aug-97 Bill Davis- v. 2.24
                (1) added _extra call to main CONTOUR and removed
                    it from those making the bar.
 (more modifications in file)

(See /p/nstxusr1/util/idl_cvs/th_image_cont.pro)


TREE_EXISTS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:  
 	tree_exists
 PURPOSE: 
	Return a true if an MDSplus tree exists for a given shot number

 CATEGORY:
	MDSplus, Trees
 EXAMPLE:  
    This will only work on VMS; 
	IDL> IF tree_exists(101526,'derived') THEN ...

    on Unix, use: 
	IDL> stat=openMDSshot(shotnum, 'nstx')
	IDL> if nsearch('operations') NE -1 THEN ...

 NOTE:
    nsearch uses 5 seconds and this routine uses 1.2 sec on Birch

(See /p/nstxusr1/util/idl_cvs/tree_exists.pro)


TRIMTAGNAMES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       trimtagnames
 PURPOSE:
       Trim tree info from an MDSplus tag name
 CATEGORY:
	MDSplus, Tagnames
 CALLING SEQUENCE:
         trimmedList = trimtagnames( sigList )
 INPUTS:
       sigList - a string array of MDSplus tag names 			 in
 KEYWORD PARAMETERS:
   (Optional)
	all - if set, trim everything but string following the last :
       treeOnly - if set only remove the tree (& top:). 
		   Leave the backslash, TDI, etc.
 OUTPUTS:
	trimmedList - a string array of MDSplus tag names 
 EXAMPLE:
	trimmedList = trimtagnames( sigList )
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
	18-Oct-00 Added keyword treeOnly:
		  Don't assume tree name at beginning of string
		  (allows for trimming tree names from TDI expressions)
 	Written by Bill Davis March, 1999

(See /p/nstxusr1/util/idl_cvs/trimtagnames.pro)


TRISMOOTH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       trismooth

 PURPOSE:
       Triangular smoothing of a vector, including points near the ends.

 CATEGORY:
	Smoothing
         
 CALLING SEQUENCE:
       SMOOTHED = trismooth( VECTOR, WINDOW_WIDTH )

 INPUTS:
       VECTOR  = The vector to be smoothed
       WINDOW_WIDTH = The full width of the window over which the weighted  
               average is determined for each point (if even, use window+1).

 OUTPUT:
       Function returns the smoothed vector

 SUBROUTINES CALLED: 

 PROCEDURE:
       Each point is replaced by triangular weighting of the nearest WINDOW of points.
       The width of the window shrinks towards the ends of the vector.


 REVISION HISTORY:
       Written, Bill Davis. 23-Mar-00

(See /p/nstxusr1/util/idl_cvs/trismooth.pro)


TRUNS_GET

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       truns_get
 PURPOSE:
       List info (in a database) on NSTX TRANSP runs (to a screen or file)
 CATEGORY:
       TRANSP, Database
 CALLING SEQUENCE:
       IDL> truns_get, shotyear=shotyear, shotnumber=shotnumber, runID=runID,  $
                rundate=rundate, runby=runby,  $
                outFile=outFile
 INPUTS:
	(none required)
 KEYWORD PARAMETERS:
   (all optional)
       shotyear - e.g., '2001' 
	shotnumber - e.g., 105535
	runID - e.g., 01
	rundate - run date (YYYYMMDD), e.g., 20010802
	runby - person, e.g. 'KAYE'
	outFile - string (if not present, data listed to screen)
 OUTPUTS:
       data to screen or file, if specified
 COMMON BLOCKS:
       NONE
 EXAMPLE:
	IDL> truns_get, shotYear=2001		; all 2001 NSTX TRANSP runs to screen
	IDL> truns_get, rundate=20010911
 MODIFICATION HISTORY:
       30-Jan-2002 Written by Bill Davis, PPPL
	Based on a program by Stan Kaye.

(See /p/nstxusr1/util/idl_cvs/truns_get.pro)


TWOSCOMPLEMENT

[Previous Routine] [Next Routine] [List of Routines]
  NAME:
	TWOSCOMPLEMENT

  PURPOSE:
 	Taking the Two's Complement of an integer

 CATEGORY:
	Math, Hardware, CAMAC

 CALLING SEQUENCE:
       twoscomp = TwosComplement( int )

 INPUT:
       int - raw encoder value (8, 16 or 32 bit integer)

 OUTPUT:
       twoscomp - Two's complement of input.

 KEYWORDS:
    Optional Input:
	NBITS - # of bits; throw away this bit if there is a carry after 
		adding 1 to the complement. Default is determined by data type.
	IfNeg - Only return the Two's Complement if value negative
 ALGORITHM:

	Taking the Two's Complement of a k-Digit Bitstring:

   1.Complement the bitstring; i.e., change all 0s to 1s and all 1s to 0s; retain all leading 0s in your result. 
   2.Add 1 to this binary number  (if there is a carry of 1 into the (k+1)st position, throw it away so that the
     result is still k-digits). 
   3.The result from (2) is the two's complement of the bitstring 

 COMMENT:
	Works in many cases, but sign bit may get extended in some applications
  MODIFICATION HISTORY:
 	5-Jun-00 WMD Added Nbits & IfNeg Keywords

(See /p/nstxusr1/util/idl_cvs/twoscomplement.pro)


TYPE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       TYPE
 VERSION:
       3.0     
 PURPOSE:
       Finds the type class of a variable.
 CATEGORY:
       Programming.
 CALLING SEQUENCE:
       Result = TYPE(X)
 INPUTS:
    X
       Arbitrary, doesn't even need to be defined.
 OPTIONAL INPUT PARAMETERS:
       None.
 KEYWORD PARAMETERS:
       None.
 OUTPUTS:
       Returns the type of X as a long integer, in the (0,9) range.
 OPTIONAL OUTPUT PARAMETERS:
       None.
 COMMON BLOCKS:
       None.
 SIDE EFFECTS:
       None.
 RESTRICTIONS:
       None.
 PROCEDURE:
       Extracts information from the SIZE function.
 MODIFICATION HISTORY:
       Created 15-JUL-1991 by Mati Meron.

(See /p/nstxusr1/util/idl_cvs/type.pro)


UNSETUP_PS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       unsetup_ps

 PURPOSE:
   	close a postscript file (opened by setup_ps) and re-set system 
	variables for previous device.

 CATEGORY:
	Printing, Cross-platform Printing of Plots

 CALLING SEQUENCE:  
   	UNSETUP_PS, name, PRINTER=printer

 INPUTS:
    (Optional)
	name - name of file without extenstion (defaults to IDL)
		(extention will always be .ps)

 KEYWORD PARAMETERS:
    Inputs:
	PRINTER  - printer to send file to (only the string before the
		   first blank is used). The printer may have been
		   specified in the call to SETUP_PS, else the default 
		   is used printer.
		  NOTE: if PRINTER='postscript', file will not be sent
			to a printer
 OUTPUTS:
	none

 CALLING EXAMPLE:
   	 printer = 'picasso color printer'	; or
   	 printer = 'postscript color '		; or
   	 printer = 'b143 Laserwriter in B143'	; or
   	 printer = 'default printer'		; 
   	 setup_ps,'myplot', PRINTER=printer
   	 plot,indgen(11)			; any number of plot commands
   	 unsetup_ps				; send to printer and return to X

 RELATED ROUTINES:
   	setup _ps

 MODICATION HISTORY:
   12-Feb-99 If printer = 'postscript' or 'file', don't send to 
		a printer.  If printer = 'default', send to the 
		default printer (i.e., none specified)
		Write file in the login area.
   27-Jan-99 adapt for SunOS; change y.margin settings [BD]
   14-Oct-97 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/unsetup_ps.pro)


UNSETUP_TEK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       unsetup_tek

 PURPOSE:
   	undo system variables from setup_tek call.

 CATEGORY:
	Printing, Cross-platform plotting

 CALLING SEQUENCE:  
   	UNsetup_tek

 INPUTS:
    (Optional)
	name - name of file without extenstion (defaults to idl)
		(extention will always be .tek)

 KEYWORD PARAMETERS:
 OUTPUTS:
	none

 CALLING EXAMPLE:
   	 setup_tek
   	 plot,indgen(11)			; any number of plot commands
   	 unsetup_tek				; send to printer and back to X

 RELATED ROUTINES:
   	setup_tek
 LIMITATIONS
	If using the CH_ crosshair routines, will need to call the following
	after this routine:
	   IDL> CH_SET, yourGraph, NewX=!x,NewY=!y,NewP=!p
 MODICATION HISTORY:
	08-May-01 call CH_SET, if user calling cross-hair routines
   	26-Oct-00 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/unsetup_tek.pro)


USINGXWINDOWS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       usingXwindows
 PURPOSE:
       Prompt user for switching Plot device to X.
 CATEGORY:
       Widgets, X-windows
 CALLING SEQUENCE:
       IDL> OK = usingXwindows()
 COMMON BLOCKS:
       NONE
 USE:
	Called in case a user was using Tektronix graphics, or the Postscript 
	device and forgot to SET_PLOT,'X' before using widgets, etc. 
 MODIFICATION HISTORY:
	Aug-00 Written [BD]

(See /p/nstxusr1/util/idl_cvs/usingxwindows.pro)


VCOMP

[Previous Routine] [Next Routine] [List of Routines]
  NAME:
       vcomp

  PURPOSE:
       "visually compress" an array for faster plotting.
       All data spikes should be retained, more or less.
       Will return y points for each x -- the min & max values.
       IF nFinal GE N_ELEMENTS(inData)*2 will just return inputs

  CATEGORY:
       Plotting

  CALLING SEQUENCE:
       VComp, inTime, inData, outTime, outData, NFINAL=4096

  KEYWORDS
     Optional:
       NFINAL - # of points to "compress" to. Defaults to estimated
		 # of pixels on x axis

  COMMON BLOCKS:
       none

  EXAMPLE:
       IDL> vcomp, inTime, inData, outTime, outData, NFINAL=4096

  NOTES:
       assumes equally spaced data, but might be OK for some cases.
  LIMITATIONS:
	This is compuationally intensive, so is not appropriate for
	most applications.
  MODIFICATION HISTORY:
       Written 10-Nov-99 by Bill Davis

(See /p/nstxusr1/util/idl_cvs/vcomp.pro)


VECTORSURF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       vectorsurf

 PURPOSE:
       Shows a fancy way to plot irregulary spaced data from x,y & z vectors.

 CATEGORY:
	2-D Plotting, Example

 CALLING SEQUENCE:
        vectorsurf, x, y, z

 INPUTS:
       tag - MDSplus tag or node name      in

 KEYWORD PARAMETERS 
    Input:
	DRAWXSIZE = drawXsize
	DRAWYSIZE = drawYsize
       BG_COLOR = bg_color

 OUTPUTS:
	none

  EXAMPLE:
     IDL> x=[4,6,1,7,1,8,5,2,4]
     IDL> y=[3,3,1,6,4,5,6,8,1]
     IDL> z=sqrt((x-3)^2+(y-2)^2)+randomn(seed)+2 
     IDL> vectorsurf, x, y, z

  MODIFICATION HISTORY:
       05-Sep-97 Written by Bill Davis
                 from IDL's d_mathstat.pro in the IDL 5.0 release
                 Written by:  DC, RSI,  1995

(See /p/nstxusr1/util/idl_cvs/vectorsurf.pro)


VGDS_TITLE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       vgds_title
 PURPOSE:
       write a plot title with shot date and time and NSTX label
 CATEGORY:
       Plotting
 CALLING SEQUENCE:
       IDL> vgds_title, mytitle, ishot
 INPUTS:
       mytitle = whatever you want as the main plot title.  
       ishot = shot number.  
 KEYWORD PARAMETERS:
       Keywords:
	  noShot - if set, do not plot shot number
	  noTime - if set, do not plot time
	  TopMargin - in characters, extra space to shift down the characters
	  HLP - When set, help information is printed.
 OUTPUTS:
       none
 COMMON BLOCKS:
       NONE
 EXAMPLE:
	IDL> !Y.OMARGIN=[0,1]
	IDL> plot,indgen(100)
	IDL> vgds_title, 'This is my title', 100523 
 NOTES:
       You'll probably want a little more room at the top of your plots, e.g.
	IDL> !Y.OMARGIN=[0,1]
 MODIFICATION HISTORY:
       21-Sep-99 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/vgds_title.pro)


VIEWTEXT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    viewtext
 PURPOSE: 
    View a string, or string array, of text in a scrollable text widget.
 DESCRIPTION:

 CATEGORY:
    Widgets
 CALLING SEQUENCE:
    viewtext, text [, KEYWORDS]
 INPUTS:
    text : String (scalar, 1-D or 2-D array) of text to be displayed.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:
    EXIT   = Label for exit button.  Default is 'Dismiss'.
    FONT   = Font to use for the text.  Default is '8x13'.
    GROUP  = Group Leader.
    TITLE  = Title of widget.
    XSIZE  = Width of text.  Default is 80 characters.
    YSIZE  = Length of text.  Default is 40 lines.
 OUTPUTS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    08-Jun-00 Added support for VMS (Bill Davis)
    Written by Doug Loucks, Lowell Observatory, May, 1993.
    1/7/94, DWL, Added Hardcopy button.
    8/25/94, DWL, Minor mods.
    96/07/02, MWB, changed YSIZE default to 40 lines.

(See /p/nstxusr1/util/idl_cvs/viewtext.pro)


VPLOT

[Previous Routine] [Next Routine] [List of Routines]
  NAME:
       vplot

  PURPOSE:
       Just like plot, except it calls vcomp to "visually compress" 
	an array for faster delivery of graphs at the expense of CPU time. 
	All data spikes should be retained.

  CATEGORY:
       Plotting

  CALLING SEQUENCE:
       vplot, time, data, _extra=_extra

  KEYWORDS
     Just like for plot

  COMMON BLOCKS:
       none

  EXAMPLE:
       IDL> vplot, time, data, title='whatever', xrange=[0,2]

  NOTES:
       VComp assumes equally spaced data, but might be OK for some cases.
	Use oVPlot for overplotting.
  LIMITATIONS:
	This is compuationally intensive, so is not appropriate for
	all applications, but for I/O-bound plotting can speed up 10x or more.
       Will return y points for each x -- the min & max values.
       IF nFinal GE N_ELEMENTS(inData)*2 will just return inputs
  MODIFICATION HISTORY:
       Written 20-May-01 by Bill Davis

(See /p/nstxusr1/util/idl_cvs/vplot.pro)


VT100

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
     VT100

 PURPOSE: 
     Define the TEK and VT100 commands for use in IDL.  Especially
     useful for MAC users who use Versaterm or users who otherwise
     want to do Tektronix plots while connected to their UNIX
     platform of choice.

 CATEGORY:
	Misc

 CALLING SEQUENCE: 
     VT100

 INPUT PARAMETERS: 
     NONE

 OPTIONAL INPUT PARAMETERS: 
     NONE

 KEYWORDS: 
     NONE

 OUTPUTS: 
     NONE

 COMMON BLOCKS: 
     NONE

 SIDE EFFECTS: 
     NONE

 RESTRICTIONS:
     If you want to use the TEK command, you need to issue the VT100
     command first.

 PROCEDURE: 

 CODE TYPE: modeling, analysis, control

 CODE SUBJECT:  operation, handling, edge, rf, transport, equilibrium

 EASE OF USE: can be used with existing documentation

 OPERATING SYSTEMS:  UNIX of all flavors

 EXTERNAL CALLS:  NONE

 RESPONSIBLE PERSON: Ray Jong
	
 DATE OF LAST MODIFICATION:  01/19/99

 MODIFICATION HISTORY:
     Created by Michael D. Brown, LLNL

(See /p/nstxusr1/util/idl_cvs/vt100.pro)


WEBDISPLAY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       webdisplay
 PURPOSE:
       Display web pages from IDL for Help, or other purposes.
 CATEGORY:
       Utility
 CALLING SEQUENCE:
       IDL> webdisplay, url
 INPUTS:
       url = URL to display.  
 KEYWORD PARAMETERS:
 OUTPUTS:
       NONE               			
 COMMON BLOCKS:
       NONE
 MODIFICATION HISTORY:
       16-Apr-99 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/webdisplay.pro)


WEEKDAY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       WEEKDAY
 PURPOSE:
       Compute weekday given year, month, day.
 CATEGORY:
	Dates
 CALLING SEQUENCE:
       wd = weekday(y,m,d,[nwd])
 INPUTS:
       y, m, d = Year, month, day (Like 1988, 10, 31).      in
 KEYWORD PARAMETERS:
 OUTPUTS:
       wd = Returned name of weekday.                       out
       nwd = optional Weekday number.                       out
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
       R. Sterner. 31 Oct, 1988.
       Johns Hopkins University Applied Physics Laboratory.
       RES 18 Sep, 1989 --- converted to SUN

 Copyright (C) 1988, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /p/nstxusr1/util/idl_cvs/weekday.pro)


WFMDSSHOTEVENT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	wfMDSshotEvent
 PURPOSE:
	Wait for an MDSplus event, with shot number coming in
 CATEGORY:
	MDSplus, Events
 CALLING SEQUENCE:
	wfMDSshotEvent, event, shotnum, [,/QUIET][,STATUS=istat]
 INPUT PARAMETERS:
	event = name of an MDSplus event to wait for.
 RETURNED PARAMETERS:
	shotnum - whatever data was passed when the event was set.
	          for MDSplus events, except for nstx_acq_started
 Keywords (Optional):
       QUIET = prevents IDL error if MDSplus command fails
       STATUS = return status, low bit set = success
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
	Does not get Shot number on Unix
 PROCEDURE:
	Makes a call to MDSplus shared image library
       procedure MDS$WTEVENT and checks for errors.
 MODIFICATION HISTORY:
	24-May-01 If on Unix, connect to VMS if not already [BD]
	06-Nov-00 Made same version work on VMS & Unix [BD]
	copied from mds$wfevent.pro, so could have the same name on vms & unix
	VERSION 1.0, CREATED BY T.W. Fredian, April 22,1991

(See /p/nstxusr1/util/idl_cvs/wfmdsshotevent.pro)


WHERE_ARR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       where_arr
 PURPOSE:
       Return the subscripts where a given set of values equal the values
       in the input array.  It is basically an expansion of IDL where in
       which the condition to match can be an array.
 CATEGORY:             
	Strings, Searching
 CALLING SEQUENCE:
       ss = where(full_arr, sub_arr)
       ss = where(a, b)
       ss = where(a, b, count)
       ss = where(a, b, count, /notequal) - invert sense
       ss = where(a, b, count, /map_ss)
 INPUT:
       full_arr- The complete array which is to be searched
       sub_arr - The subset array of the values to search "full_arr" of

 KEYWORD PARAMETERS:
       notequal - if set, return indices where values are NOTEQUAL
       map_ss  - If set, then return the index in the "sub_arr" where
                 first occurance of the element exists in the "full_arr"
                 The length of the output is the same as "full_arr"
 OUTPUT:
       returns the subscripts where "sub_arr" occurrs in "full_arr".  If
       there are no matches, return a -1.
 OPTIONAL OUTPUT:
       count   - The number of matches
 HISTORY:
       Written 30-Apr-91 by M.Morrison
                1-Jul-94 (SLF) - add NOTEQUAL keyword 
               14-Nov-97 (MDM) - Added /MAP_SS keyword
               09-Mar-98 (JSN) - change loop from integer to long

(See /p/nstxusr1/util/idl_cvs/where_arr.pro)


WHICH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	WHICH

 PURPOSE:
	Like Unix which, prints the path of an IDL routine.

 CATEGORY:
	Help, documentation.

 CALLING SEQUENCE:

	Which, Name 	;Extract documentation for procedure Name using
				the current !PATH.

 INPUTS:
	Name:	The string containing the name of the procedure.
		If no '.' in name, ".pro" is appended.
		Under Unix, Name may be "*" to get information on all routines.

 KEYWORDS:
	PRINT:	If set, this keyword sends the output of WHICH to the
		default printer.  Under Unix, if PRINT is a string, it is
		interpreted as a shell command used for output with
		the documentation from WHICH providing standard input
		(i.e. PRINT="cat > junk").

	OUTPUT: returns full path of file found; 
               will return null string if none found

	QUIET: 	If set, no printing is done
 UNIX KEYWORDS:
   DIRECTORY:	The directory to search.  If omitted, the current directory
		and !PATH are used.

	MULTI:	If set, this flag allows printing of more than one file if the
		requested module exists in more than one directory in the path
		and the current directory.

 VMS KEYWORDS:
	FILE:	If this keyword is set, the output is left in the file
		"userlib.doc", in the current directory.

	PATH:	An optional directory/library search path.  This keyword uses
		the same format and semantics as !PATH.  If omitted, !PATH is
		used.

 OUTPUTS:
	Documentation is sent to the standard output unless /PRINT
	is specified.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	Output is produced on terminal or printer.

 RESTRICTIONS:
	The DIRECTORY and MULTI keywords are ignored under VMS. The
	FILE and PATH keywords are ignored under Unix.

 EXAMPLE:
	To obtain documentation for the User's Library function DIST, enter:
		Which, 'DIST', output=fullpathname

	For a graphical interface to WHICH, see the procedure XDL.

 MODIFICATION HISTORY:
	13-Apr-99 Allow findind files on VMS if not in libraries [BD]
	Converted from IDL DOC_LIBRARY by Bill Davis, March, 1999
	   optionally return path in keyword OUTPUT. Added QUIET keyword.
	   allow extentions other than .pro
	   allow uppercase finds.
	Written, DMS, Sept, 1982.
	Added library param, Jul 1987.
	Unix version, DMS, Feb, 1988.
	New VMS version, DMS, Dec. 1989
	Wrapper procedure to call the correct version
		under Unix and VMS, AB, Jan 1990
       Added support for DOS, SNG, Dec, 1990
	Added support for Macintosh, DJE, Nov, 1994

(See /p/nstxusr1/util/idl_cvs/which.pro)


WITHRANKOF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       WithRankOf
 PURPOSE:
       Return a list of MDSplus signals with a certain rank
	(that contain data)
 CATEGORY:
       MDSplus
 CALLING SEQUENCE:
       sigs=withrankof(2)
 EXAMPLE:
	IDL> stat=mdsopen('passivespec',101964)
	IDL> scalarNames = withrankof(0)
 COMMON BLOCKS:
       none
 NOTES:
       Only returns signals with data in them.
 LIMITATIONS:
	An MDSplus shot file must be open first.
 MODIFICATION HISTORY:
	20-Jan-00 Written by Bill Davis

(See /p/nstxusr1/util/idl_cvs/withrankof.pro)


WORDARRAY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       WORDARRAY
 PURPOSE:
       Convert text string or string array to a 1-d array of words.
 CATEGORY:
	Strings
 CALLING SEQUENCE:
       wordarray, instring, outlist
 INPUTS:
       instring = string or string array to process.  in
 KEYWORD PARAMETERS:
       Keywords:
         IGNORE=string of characters to ignore (array allowed).
           These characters are removed before processing.
           Ex: wordarray,in,out,ignore=',;()'
               wordarray,in,out,ignore=[',',';','(',')']
         DELIMITERS = word delimiter characters, like IGNORE.
         /WHITE means include white space (spaces,tabs) along
           with the specified delimiters.
 OUTPUTS:
       outlist = 1-d array of words in instring.      out
 COMMON BLOCKS:
 NOTES:
       Notes: Words are assumed delimited by given delimiters
        (defaults are spaces and/or tabs)
        Non-delimiters are returned as part of the words.
        Delimiters not needed at the front and end of the strings.
        See commalist for a near inverse.
 MODIFICATION HISTORY:
       R. Sterner, 29 Nov, 1989
       BLG --- Modified June 22,1991 to include tabs as delimiters
       R. Sterner, 11 Dec, 1992 --- fixed to handle pure white space.
       R. Sterner, 27 Jan, 1993 --- dropped reference to array.
       R. Sterner, 1998 Apr 1 --- Added DELIMITER.  Modified IGNORE.

 Copyright (C) 1989, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /p/nstxusr1/util/idl_cvs/wordarray.pro)


XAXISW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       xAxisW
 PURPOSE:
       Widget to set some X Axis values via the system variable !X
 CATEGORY:
       Graphics, Widgets
 CALLING SEQUENCE:
       IDL> xAxisW
 INPUTS:
       input = whatever.  
 KEYWORD PARAMETERS:
       Optional Keywords:
	  UPDATECALLBACK - a routine to call after axis system variable is set
	  GROUP_LEADER - This widget is destroyed if it's GL is destroyed
 OUTPUTS:
       The system variable !X is changed               	out
 COMMON BLOCKS:
       NONE
 EXAMPLE:
	IDL> xAxisW,  UPDATECALLBACK='myAxisUpdating'
 NOTES:
 MODIFICATION HISTORY:
	22-Jan-01 Added Default and Auto Scale buttons [BD]
	20-Sep-00 Added TickLen & GridStyle fields [BD]
       30-Mar-99 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/xaxisw.pro)


XCDEDIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   XcdEdit
 PURPOSE:
   A table editor modified from XVAREDIT for ppcc c.d file.
 CATEGORY:
   Widgets
 CALLING SEQUENCE:
   XcdEdit, filename
 INPUTS:
   filename = The file to be edited.
 KEYWORD PARAMETERS:
   NAME = The NAME of the variable.  This keyword is overwritten with the
       structure name if the variable is a structure.
   GROUP = The widget ID of the widget that calls XcdEdit.  When this
       ID is specified, a death of the caller results in a death of
       XcdEdit.
   X_SCROLL_SIZE = The X_SCROLL_SIZE keyword allows you to set
       the width of the scrolling viewport in columns.
       Default is 4.
   Y_SCROLL_SIZE = The Y_SCROLL_SIZE keyword allows you to set
       the height of the scrolling viewport in rows.
       Default is 4.
 OUTPUTS:
   VAR= The variable that has been edited, or the original when the user
       Quits from the file menu.
 COMMON BLOCKS:
   None.
 SIDE EFFECTS:
   Initiates the XManager if it is not already running.
 RESTRICTIONS:
   None known.
 PROCEDURE:
   Create and register the widget and then exit.
   If the user selects "save", the values in the editor are written
   to the file passed in, otherwise, they are ignored.
 MODIFICATION HISTORY:
   Written by: Steve Richards, February, 1991
   Modified: September 96, LP - rewritten with TABLE widget
   Converted from XcdEdit.pro by Bill Davis, Oct. 1998
		07-Oct-98 BD Took out check for "commit" because it was always wrong.

(See /p/nstxusr1/util/idl_cvs/xcdedit.pro)


XFONT_4

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	XFONT_4

 PURPOSE:
	XFONT_4 is a modal widget for selecting and viewing an X Windows font.
 
 CATEGORY:
	Widgets, Fonts

 CALLING SEQUENCE:
	Selected_font = XFONT_4()

 INPUTS:
	No explicit inputs.

 KEYWORD PARAMETERS:
	GROUP:    The widget ID of the widget that calls XFONT_4. When this
		  ID is specified, a death of the caller results in a death
		  of XFONT_4.
	PRESERVE: If set, XFONT_4 saves the server font directory in common
		  blocks so that subsequent calls to XFONT_4 start-up much
		  faster. If not set, the common block is cleaned.

 OUTPUTS:
	A string containing the font name.  If nothing is selected, or
	the CANCEL button is pressed, a null string is returned.

 COMMON BLOCKS:
	XFONT_4_COM.

 SIDE EFFECTS:
	Initiates the XManager if it is not already running.
	Resets the current X Window font.  

 RESTRICTIONS:
	The current X window font is manipulated without being restored.

 PROCEDURE:
	Create and register the widget and then exit.

 MODIFICATION HISTORY:
	Modified from a template written by: Hans-Joachim Bothe, CreaSo GmbH,
		November, 1991, by DMS, RSI, November, 1992.
	1 July 1995, AB, Fixed sizing of toggle buttons.

(See /p/nstxusr1/util/idl_cvs/xfont_4.pro)


XIA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
		XIA

 PURPOSE:
	Display an animated sequence of images using X-windows Pixmaps.
	The speed and direction of the display can be adjusted using 
	the widget interface.

 CATEGORY:
	Animation, Image display, widgets.

 CALLING SEQUENCE:
	To initialize:
		XIA, SET = [Sizex, Sizey, Nframes]

	To load a single image:
		XIA, IMAGE = Image, FRAME = Frame_Index

	To load a single image that is already displayed in an existing window:
		XIA, FRAME = Frame_index, $
			WINDOW = [Window_Number [, X0, Y0, Sx, Sy]]
	(This technique is much faster than reading back from the window.)

	To display the animation after all the images have been loaded:
		XIA [, Rate] 

	To close and deallocate the pixmap/buffer (which also takes place
	automatically when the user presses the "Done With Animation"
	button or closes the window with the window manager):
		XIA, /CLOSE

 OPTIONAL INPUTS:
	Rate:	A value between 0 and 100 that represents the speed of the 
		animation as a percentage of the maximum display rate.
		The fastest animation is with a value of 100 and the slowest
		is with a value of 0.  The default animation rate is 100.  
		The animation must be initialized using the SET
		keyword before calling XIA with a rate value.

 KEYWORD PARAMETERS:
	CLOSE:	Set this keyword to delete the offscreen pixwins and Widget, 
		freeing storage.

	CYCLE: If set, cycle.  Normally, frames are displayed going either
		forward or backwards.  If CYCLE is set, reverse direction
		after the last frame in either direction is displayed.
		Provide this keyword with the SET keyword.

	FRAME:	The frame number when loading frames.  This keyword only has
		an effect when used in conjunction with the SET keyword.
		FRAME must be set to a number in the range 0 to Nframes-1.

	GROUP:	The widget ID of the widget that calls XIA.  When 
		this ID is specified, the death of the caller results in the 
		death of XIA.

	IMAGE:	A single image to be loaded at the animation position given 
		by FRAME.  The keyword parameter FRAME must also be specified.

	KEEP_PIXMAPS: If TRUE, XIA doesn't destroy the animation
		pixmaps when it is killed. Calling it again without
		going through the SET and LOAD steps will cause the same
		animation to play without the overhead of creating
		the pixmaps.
	BLOCK:  Set this keyword to have XMANAGER block when this
		application is registered.  By default the Xmanager
               keyword NO_BLOCK is set to 1 to provide access to the
               command line if active command 	line processing is available.
               Note that setting BLOCK for this application will cause
		all widget applications to block, not only this
		application.  For more information see the NO_BLOCK keyword
		to XMANAGER.
	ORDER:	Set this keyword to display images from the top down instead
		of the default bottom up.  This keyword is only used when 
		loading images.
       MODAL:  If set, then XIA runs in "modal" mode, meaning that
               all other widgets are blocked until the user quits
               XIA.
       MPEG_OPEN: Set this keyword to open an MPEG file.
       MPEG_FILENAME: Set this keyword equal to a string for the desired
               MPEG filename.  If not set, idl.mpg is used.
       MPEG_CLOSE: Set this keyword to write the MPEG file.
     SHOWLOAD:	Set this keyword (in conjunction with the SET keyword) to 
		display each frame and update the frame slider as frames are 
		loaded.

	SET:	This keyword initializes XIA.  SET should be equated
		to a 3-element integer vector containing the following 
		parameters:
		  Sizex, Sizey:	The width and height of the images to be 
				displayed, in pixels.

		  Nframes:	The number of frames in the animated sequence 
				(since XIA is an animation routine, 
				Nframes must be at least 2 frames).

	TITLE:	A string to be used as the title of the widget.  If this 
		keyword is not specified, the title is set to "XIA" 
		This keyword has an effect only when used in conjunction with
		the SET keyword).

	TRACK: If set, the frame slider tracks the current frame.  Default
		is not to track.  Provide this keyword with the SET keyword.

	WINDOW:	When this keyword is specified, an image is copied from an 
		existing window to the animation pixmap.  When using X 
		windows, this technique is much faster than reading
		from the display and then calling XIA with a 2D 
		array.

		The value of this parameter is either an IDL window
		number (in which case the entire window is copied),
		or a vector containing the window index and the rectangular 
		bounds of the area to be copied, for example:
		WINDOW = [Window_Number, X0, Y0, Sx, Sy]

      XOFFSET:	The horizontal offset, in pixels from the left of the frame, 
		of the image in the destination window.

      YOFFSET:	The vertical offset, in pixels from the bottom of the frame,
		of the image in the destination window.

 OUTPUTS:
	No explicit outputs.

 COMMON BLOCKS:
	XIA_COM: a private common block.

 SIDE EFFECTS:
	A pixmap and widget are created.

 RESTRICTIONS:
	Only a single copy of XIA can run at a time.

 PROCEDURE:
	When initialized, this procedure creates an approximately square
	pixmap or memory buffer, large enough to contain Nframes of
	the requested size.  Once the images are loaded, using the 
	IMAGE and FRAME keywords, they are displayed by copying the images 
	from the pixmap or buffer to the visible draw widget.

 EXAMPLE:
	Enter the following commands to open the file ABNORM.DAT (a series
	of images of a human heart) and animate the images it contains using
	XIA.  For a more detailed example of using XIA, 
	see the example in the "Using IDL Widgets" chapter of "IDL Basics".
	Read the images into the variable H by entering:

		OPENR, 1, FILEPATH('abnorm.dat', SUBDIR = 'images')
		H = BYTARR(64, 64, 16)
		READU, 1, H
		CLOSE, 1
		H = REBIN(H, 128, 128, 16)

	Initailize XIA with the command:

		XIA, SET=[128, 128, 16], /SHOWLOAD
		
	Load the images into XIA and play the animation by entering:

		FOR I=0,15 DO XIA, FRAME = I, IMAGE = H[*,*,I]
		XIA

 MODIFICATION HISTORY:
	02-Aug-01 modified XInterAnimate to have printing [Bill Davis]

(See /p/nstxusr1/util/idl_cvs/xia.pro)


XSECTIONW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       xsectionw
 PURPOSE:
       Widget to display a tiff file, or input image and x-y plots 
	of cross-sections.
 CATEGORY:
       Image Processing, 2-D Plotting
 CALLING SEQUENCE:
       IDL> xsectionw[, image]
 INPUTS:
       image - a 2D array. If missing, and Keyword Filename not
	        specified, a dialog box will appear allowing browsing
		for a TIFF image.
 KEYWORD PARAMETERS:
    (optional) 
	filename - TIFF file to read.
	path - directory to start for dialog_pickfile browsing
	xsize - horizontal size of window (default is 0.75 of screen, but > 800)
	ysize - vertical size of window
       magnification - magnification factor, for small images 
       INTERP - if magnification set, INTERP=1 will cause interpolation,
		rather than pixel replication.
	max_colors - # used by display (Default is 256)
	colorTable - color table to use. Default is 0 (Gray Scale)
       GROUP_LEADER - Group_Leader ID
 OUTPUTS:
       none.
 COMMON BLOCKS:
       none
 ROUTINES USED:
	MK_COLOR, usingXwindows, NWORDS, FLIP
 EXAMPLE:
	IDL> xsectionw, dist(200,200)
 NOTES:
	If you specify max_colors to be something other than 256, and
	want to change color tables, you need to do something like:
		IDL> dum=MK_COLOR( table=3 )
	Using XLOADCT, etc. won't work well, since it loads 256 colors.
 MODIFICATION HISTORY:
       11-Dec-01 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/xsectionw.pro)


XVAREDIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   XVAREDIT
 PURPOSE:
   This routine provides an editor for any IDL variable.
 CATEGORY:
   Widgets
 CALLING SEQUENCE:
   XVAREDIT, VAR
 INPUTS:
   VAR = The variable that is to be edited.
 KEYWORD PARAMETERS:
   NAME = The NAME of the variable.  This keyword is overwritten with the
       structure name if the variable is a structure.
   GROUP = The widget ID of the widget that calls XVarEdit.  When this
       ID is specified, a death of the caller results in a death of
       XVarEdit.
   X_SCROLL_SIZE = The X_SCROLL_SIZE keyword allows you to set
       the width of the scrolling viewport in columns.
       Default is 4.
   Y_SCROLL_SIZE = The Y_SCROLL_SIZE keyword allows you to set
       the height of the scrolling viewport in rows.
       Default is 4.
 OUTPUTS:
   VAR= The variable that has been edited, or the original when the user
       selects the "Cancel" button in the editor.
 COMMON BLOCKS:
   None.
 SIDE EFFECTS:
   Initiates the XManager if it is not already running.
 RESTRICTIONS:
   None known.
 PROCEDURE:
   Create and register the widget and then exit.
   If the user selects "accept", the values in the editor are written
   to the variable passed in, otherwise, they are ignored.
 MODIFICATION HISTORY:
   Written by: Steve Richards, February, 1991
   Modified: September 96, LP - rewritten with TABLE widget
		07-Oct-98 BD Took out check for "commit" because it was always wrong.

(See /p/nstxusr1/util/idl_cvs/xvaredit.pro)


XYANIM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       xyanim
 PURPOSE:
	Animate a series of X-Y plots.
       Makes an animation in a XINTERANIMATE window. An MPEG file
	can then be saved, or the movie can be played with VCR-like 
	controls
 CATEGORY:
       Animation
 CALLING SEQUENCE:
       IDL> xyanim, Radii, YvsT, times, xSize=xSize, ySize=ySize
 INPUTS:
       Radii - 1-D array of Radii (for example)
       YvsT  - 2-D array of Independent axis vs. time
	times - times for which an x-y plot will be made (defaults to 1/frame)
 KEYWORD PARAMETERS:
       Keywords:
	  xSize - x size of resulting output frame (default=400)
	  ySize - y size of resulting output frame (default=xSize)
 OUTPUTS:
       just the XinterAnimate window. MPEGs can be made from that widget.
 COMMON BLOCKS:
       NONE
 EXAMPLE:
	See /u/bdavis/cvs/idl_cvs/testxyanim.pro 
 MODIFICATION HISTORY:
       12-Jun-01 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/xyanim.pro)


YAXISW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       yAxisW
 PURPOSE:
       Widget to set some Y Axis values via the system variable !Y
 CATEGORY:
       Graphics, Widgets
 CALLING SEQUENCE:
       IDL> yAxisW
 INPUTS:
       input = whatever.  
 KEYWORD PARAMETERS:
       Optional Keywords:
	  UPDATECALLBACK - a routine to call after axis system variable is set
	  GROUP_LEADER - This widget is destroyed if it's GL is destroyed
 OUTPUTS:
       The system variable !Y is changed               	out
 COMMON BLOCKS:
       NONE
 EXAMPLE:
	IDL> yAxisW, UPDATECALLBACK='myAxisUpdating'
 NOTES:
	If an application overrides !Y.* parameters, or specifies them on
	the plot command, changing settings with this widget will have no
	affect.
 MODIFICATION HISTORY:
	22-Jan-01 Added Default and Auto Scale buttons [BD]
	28-Sep-00 Correct the display of initial values [BD]
	20-Sep-00 Added TickLen & GridStyle fields [BD]
       30-Mar-99 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/yaxisw.pro)


YMD2DATE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       YMD2DATE
 PURPOSE:
       Convert from year, month, day numbers to date string.
 CATEGORY:
	Dates
 CALLING SEQUENCE:
       date = ymd2date(Y,M,D)
 INPUTS:
       y = year number (like 1986).                         in
       m = month number (1 - 12).                           in
       d = day of month number (1 - 31).                    in
 KEYWORD PARAMETERS:
       Keywords:
         FORMAT = format string.  Allows output date to be customized.
            The following substitutions take place in the format string:
         Y$ = 4 digit year.
         y$ = 2 digit year.
         N$ = full month name.
         n$ = 3 letter month name.
         d$ = day of month number.
         0d$ = day of month number with leading 0 if < 10.
         W$ = full weekday name.
         w$ = 3 letter week day name.
 OUTPUTS:
       date = returned date string (like 24-May-1986).      out
 COMMON BLOCKS:
 NOTES:
       Notes:
         The default format string is 'd$-n$-Y$' giving 24-Sep-1989
         Example: FORMAT='w$ N$ d$, Y$' would give 'Mon 
 MODIFICATION HISTORY:
       R. Sterner.  16 Jul, 1986.
       RES 18 Sep, 1989 --- converted to SUN
       R. Sterner, 28 Feb, 1991 --- modified format.
       R. Sterner, 16 Dec, 1991 --- added space to 1 digit day.
       R. Sterner, 1996 Jan 5 --- Added leading 0 to day of month.
       Johns Hopkins University Applied Physics Laboratory.

 Copyright (C) 1986, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /p/nstxusr1/util/idl_cvs/ymd2date.pro)


YMD2JD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       YMD2JD
 PURPOSE:
       From Year, Month, and Day compute Julian Day number.
 CATEGORY:
	Dates
 CALLING SEQUENCE:
       jd = ymd2jd(y,m,d)
 INPUTS:
       y = Year (like 1987).                    in
       m = month (like 7 for July).             in
       d = month day (like 23).                 in
 KEYWORD PARAMETERS:
 OUTPUTS:
       jd = Julian Day number (like 2447000).   out
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
       R. Sterner,  23 June, 1985 --- converted from FORTRAN.
       Johns Hopkins University Applied Physics Laboratory.
       RES 18 Sep, 1989 --- converted to SUN

 Copyright (C) 1985, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /p/nstxusr1/util/idl_cvs/ymd2jd.pro)


YRMONTHDAY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       yrmonthday
 PURPOSE:
       Return a string of YYYYMMDD from a date string.
 CATEGORY:
       Dates
 CALLING SEQUENCE:
       IDL> dateNumberString = yrmonthday(dateString)
 INPUTS:
       dateString = date in one of two formats:
			  '7-jun-2001'
			  'Mon Jan 14 15:22:05 2002'
	   (defaults to today) 
 OUTPUTS:
       dateNumberString = 8-character string of numbers:
		YYYYMMDD
 EXAMPLE:
	IDL> print,yrmonthday()
	20020114
	IDL> print,yrmonthday('5-jun-2001')
	20010605
 NOTES:
 MODIFICATION HISTORY:
	15-Jan-02 Allow for 2-digit years
       14-Jan-02 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/yrmonthday.pro)


ZAXISW

[Previous Routine] [List of Routines]
 NAME:
       zAxisW
 PURPOSE:
       Widget to set some Z Axis values via the system variable !Y
 CATEGORY:
       Graphics, Widgets
 CALLING SEQUENCE:
       IDL> zAxisW
 INPUTS:
       input = whatever.  
 KEYWORD PARAMETERS:
       Optional Keywords:
	  UPDATECALLBACK - a routine to call after axis system variable is set
	  GROUP_LEADER - This widget is destroyed if it's GL is destroyed
 OUTPUTS:
       The system variable !Y is changed               	out
 COMMON BLOCKS:
       NONE
 EXAMPLE:
	IDL> zAxisW, UPDATECALLBACK='mzAxisUpdating'
 NOTES:
	If an application overrides !Z.* parameters, or specifies them on
	the plot command, changing settings with this widget will have no
	affect.
 MODIFICATION HISTORY:
	17-Oct-00 Written by Bill Davis, PPPL

(See /p/nstxusr1/util/idl_cvs/zaxisw.pro)