This page was created by the IDL library routine `mk_html_help2`.

Last modified: Wed Jan 7 01:15:11 2009.

# Directory Listing of Routines

# ssl_general/misc/SSW

- BSORT
  Function to sort data into ascending order, like a simple bubble sort.
- DPRINT
  Diagnostic PRINT (activated only when DEBUG reaches DLEVEL)
- IN_SET[2]
- IS_ARRAY
- IS_NUM
- IS_STRING
- IS_STRUCT
- SSWHERE_ARR
  gives the subscripts in the array arr1 that are for elements
- TAG_EXIST
- WIDGET_VALID

# Routine Descriptions

## BSORT

[Next Routine] [List of Routines]

     NAME:
           BSORT
     PURPOSE:
           Function to sort data into ascending order, like a simple bubble sort.
     EXPLANATION:
           Original subscript order is maintained when values are equal (FIFO).
           (This differs from the IDL SORT routine alone, which may rearrange
           order for equal values)

     NOTE: this routine is originally from the NASA GSFC IDL Astro Library.
       http://idlastro.gsfc.nasa.gov/

     CALLING SEQUENCE:
           result = bsort( array, [ asort, /INFO, /REVERSE ] )

     INPUT:
           Array - array to be sorted

     OUTPUT:
           result - sort subscripts are returned as function value

     OPTIONAL OUTPUT:
           Asort - sorted array

     OPTIONAL KEYWORD INPUTS:
           /REVERSE - if this keyword is set, and non-zero, then data is sorted
                     in descending order instead of ascending order.
           /INFO = optional keyword to cause brief message about # equal values.

     HISTORY
           written by F. Varosi Oct.90:
           uses WHERE to find equal clumps, instead of looping with IF ( EQ ).
           compatible with string arrays, test for degenerate array
           20-MAY-1991     JKF/ACC via T AKE- return indexes if the array to
                           be sorted has all equal values.
           Aug - 91  Added  REVERSE keyword   W. Landsman
           Always return type LONG    W. Landsman     August 1994
           Converted to IDL V5.0   W. Landsman   September 1997
           Added to TDAS P.Cruce Jun 2008

    $LastChangedBy: pcruce $
    $LastChangedDate: 2008-07-01 14:43:50 -0700 (Tue, 01 Jul 2008) $
    $LastChangedRevision: 3230 $
    $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/misc/SSW/bsort.pro $

(See ssl_general/misc/SSW/bsort.pro)

## DPRINT

[Previous Routine] [Next Routine] [List of Routines]

     PROJECT:
           SOHO - CDS/SUMER
           THEMIS

     NAME:
           DPRINT

     PURPOSE:
           Diagnostic PRINT (activated only when DEBUG reaches DLEVEL)

     EXPLANATION:
           This routine acts similarly to the PRINT command, except that
           it is activated only when the common block variable DEBUG is
           set to be equal to or greater than the debugging level set by
           DLEVEL (default to 0).  It is useful for debugging.
           If DLEVEL is not provided it uses a persistent (common block) value set with the
           keyword SETDEBUG.

     CALLING SEQUENCE (typically written into code):
           DPRINT, v1 [,v2 [,v3...]]] [,format=format] [,dlevel=dlevel] [,verbose=verbose]
                 The values of v1,v2,v3 will only be printed if verbose >= dlevel

     CALLING SEQUENCE to change options (typically typed from IDL command line)
           DPRINT, setdebug=d   ; define persistent debug level
           DPRINT, print_trace=[0,1,2, or 3]  ; Display program trace info in subsequent calls to DPRINT
           DPRINT, /print_dtime       ; Display delta time between DPRINT statements.

     INPUTS:
           V1, V2, ... - List of variables to be printed out (20 max).

     OPTIONAL INPUTS:
           None.

     OUTPUTS:
           All input variables are printed out on the screen (or the
           given unit)

     OPTIONAL Keywords:
           FORMAT - Output format to be used
           UNIT   - Output unit through which the variables are printed. If
                    missing, the standard output (i.e., your terminal) is used.

     KEYWORD PARAMETERS:
           DLEVEL = DLEVEL - An integer indicating the debugging level; defaults to 0
           VERBOSE = VERBOSE - An integer indicating current verbosity level, If verbose is set
           it will override the current value of debug, for the specific call of dprint in which
           it is set.
           SETDEBUG=value            - Set debug level to value
           GETDEBUG=named variable   - Get current debug level
           DWAIT = NSECONDS  ; provides an additional constraint on printing.
                  It will only print if more than NSECONDS has elapsed since last dprint.

     CALLS:
           PTRACE()

     COMMON BLOCKS:
           DPRINT_COM.

     RESTRICTIONS:
         - Changed see SETDEBUG above
           Can print out a maximum of 12 variables (depending on how many
              is listed in the code)

     SIDE EFFECTS:
           None.

     CATEGORY:
           Utility, miscellaneous

     PREVIOUS HISTORY:
           Written March 18, 1995, Liyun Wang, GSFC/ARC

     MODIFICATION HISTORY:
           Version 1, Liyun Wang, GSFC/ARC, March 18, 1995
           Version 2, Zarro, SM&A, 30 November 1998 - added error checking
           Version 3, Zarro, (EIT/GSFC), 23 Aug 2000 - removed DATATYPE calls
           Version 4, Larson  (2007) stripped out calls to "execute" so that it can be called from IDL VM
                              Fixed bug that allows format keyword to be used.
                              Added PTRACE() call
                              Added SETDEBUG keyword and GETDEBUG keyword
                              Added DWAIT keyword

(See ssl_general/misc/SSW/dprint.pro)

## IN_SET[2]

[Previous Routine] [Next Routine] [List of Routines]

     function: in_set

     purpose: simple boolean function to check whether an element is a member of
              a set(array).  It is mainly syntactic sugar for a frequently repeated
              operation.

     inputs: ele: The element to be searched for
             set: The set to be searched

     output: 1=yes, 0=no

     $LastChangedBy: pcruce $
     $LastChangedDate: 2008-11-10 12:47:28 -0800 (Mon, 10 Nov 2008) $
     $LastChangedRevision: 3952 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/misc/SSW/in_set.pro $

(See ssl_general/misc/SSW/in_set.pro)

## IS_ARRAY

[Previous Routine] [Next Routine] [List of Routines]

    Name: is_array

    Purpose: determines if input is an array

    Inputs: input: the input can of any type

    Outputs: 1:yes 0:no

     $LastChangedBy: pcruce $
     $LastChangedDate: 2008-09-15 16:21:35 -0700 (Mon, 15 Sep 2008) $
     $LastChangedRevision: 3498 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/misc/SSW/is_array.pro $

(See ssl_general/misc/SSW/is_array.pro)

## IS_NUM

[Previous Routine] [Next Routine] [List of Routines]

    Name: is_num

    Purpose: determines if input is a number

    Inputs: num: the number can be single element or array

    Outputs: 1:yes 0:no

    Keywords: unsigned: set this if you only want to know if it is
                        unsigned
              signed: set this if you only want to know if it is signed

              real: set this if you want to know only if it is real

              complex: set this if want to know only if it is complex

              floating: set this if you want to know if it is floating
                        point

              integer: set this is you want to know if it is not floating point

              single: set this if you want to know if it is single precision floating point

              double: set this if you want to know if it is double precision floating point

     NOTES: if you can think of other classes of number worth testing
    that involve more than one idl type feel free to add
            if you specify and impossible numerical class like:
            b = is_num(1,/signed,/unsigned)
               -or-
            b = is_num(1,/unsigned,/complex)

            it will return 0

    LAST MODIFICATION:  02/11/01
     $LastChangedBy: davin-win $
     $LastChangedDate: 2007-10-22 07:26:16 -0700 (Mon, 22 Oct 2007) $
     $LastChangedRevision: 1758 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/tplot/tplot.pro $

(See ssl_general/misc/SSW/is_num.pro)

## IS_STRING

[Previous Routine] [Next Routine] [List of Routines]

     Project     : HESSI

     Name        : IS_STRING

     Purpose     : return true is input is a non-blank string

     Category    : string utility

     Syntax      : IDL> a=is_string(input)

     Inputs      : INPUT_STR = input variable to check

     Outputs     : 0/1 if blank/nonblank

     Keywords    : return true (1), even if string is blank

     Opt. Outputs: NONBLANK = noblank copies of input
                   (if input is array, then nonblanks are filtered out)

     History     : 17-Nov-1999, Zarro (SM&A/GSFC)
                    5-Feb-2003, Zarro (EER/GSFC) - added /BLANK

     Contact     : dzarro@solar.stanford.edu

(See ssl_general/misc/SSW/is_string.pro)

## IS_STRUCT

[Previous Routine] [Next Routine] [List of Routines]

     Project     :	HESSI

     Name        :	is_struct

     Purpose     :	returns, 1/0 if valid/invalid input structure

     Category    :	Structure handling

     Syntax      : IDL> output=is_struct(input)

     Inputs      :	INPUT = input structure array

     Outputs     :	OUTPUT = 1/0

     Written     : Zarro (EITI/GSFC), 17 Sept 2001

     Contact     : dzarro@solar.stanford.edu

(See ssl_general/misc/SSW/is_struct.pro)

## SSWHERE_ARR

[Previous Routine] [Next Routine] [List of Routines]

     NAME:
    	sswhere_arr
     CALLING SEQUENCE:
    	ss=sswhere_arr(arr1, arr2)
     PURPOSE:
    	gives the subscripts in the array arr1 that are for elements
    	of arr2
     INPUT:
    	arr1, arr2 = two arrays
     OUTPUT:
    	ss = the subscripts of arr1 that are also in arr2
     KEYWORD:
           notequal = if set, return the array elements of arr1 that are
                      not in arr2
     HISTORY
    	Spring '92 JMcT
           Added notequal, extra, jun 2007, jmm

(See ssl_general/misc/SSW/sswhere_arr.pro)

## TAG_EXIST

[Previous Routine] [Next Routine] [List of Routines]

     Project     : SOHO - CDS

     Name        : TAG_EXIST()

     Purpose     : To test whether a tag name exists in a structure.

     Explanation : 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.  (However, see the keyword
    		TOP_LEVEL).

     Use         : IDL>  status = tag_exist(str, tag)

     Inputs      : str  -  structure variable to search
                   tag  -  tag name to search for

     Opt. Inputs : None

     Outputs     : Function returns 1 if tag name exists or 0 if it does not.

     Opt. Outputs: None

     Keywords    : INDEX	  = Index of matching tag

    		TOP_LEVEL = If set, then only the top level of the structure is
    			    searched.
                   RECURSE  = set to recurse on nested structures

     Category    : Util, structure

     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 2, William Thompson, GSFC, 6 March 1996
    			Added keyword TOP_LEVEL
                   Version 2.1, Zarro, GSFC, 1 August 1996
                           Added call to help
                   Version 3, Zarro, EIT/GSFC, 3 June 2000
                           added check for input array structure
                   Version 4, Zarro, EIT/GSFC, 23 Aug 2000
                           removed calls to DATATYPE
                   Version 5, Zarro, EIT/GSFC, 29 Sept 2000
                           added /quiet
                   Version 6, Zarro (EER/GSC), 22 Dec 2002
                           made recursion NOT the default
                   Removed datatype calls, jmm, 4-jun-2007

(See ssl_general/misc/SSW/tag_exist.pro)

## WIDGET_VALID

[Previous Routine] [List of Routines]

     Project     : Solar-B

     Name        : widget_valid

     Purpose     : check if variable is a valid widget id

     Category    : utility widgets

     Syntax      : IDL> s=widget_valid(id)

     Inputs      : ID = id to check

     Outputs     : 1/0 if it is or isn't

     Keywords    : None

     History     : 12-Jan-2006, Zarro (L-3Com/GSFC) - written

     Contact     : DZARRO@SOLAR.STANFORD.EDU

(See ssl_general/misc/SSW/widget_valid.pro)