;+
;
; NAME: 
;	UVSP_CATHELP
;
; PURPOSE:
;	Display HELP message for the requested topic.
;
; CATEGORY:
;	UVSP catalog
;
; CALLING SEQUENCE:
;	UVSP_CATHELP, input=input, message=message
;
; CALLED BY:
;	UVSPCATREAD
;
; CALLS TO:
;	none
;
; INPUTS:
;       INPUT   :  Topic for help.
;
; OPTIONAL INPUTS:
;	none
;
; OUTPUTS:
;	none
;
; OPTIONAL OUTPUTS:
;	MESSAGE :  Return the help message to caller, don't print now. 
;
; COMMON BLOCKS:
;	none
;
; SIDE EFFECTS:
;	none
;
; RESTRICTIONS:
;	none
;
; PROCEDURE:
;	Calls to this routine display the hard coded help messages listed
;	below.
;
; MODIFICATION HISTORY:
;	July 1993 - Elaine Einfalt (HSTX)
;-

pro uvsp_cathelp, input=input, message=message

 input =  strcompress(strtrim(input,2),/remove_all)
 if (strmid(input,0,1) eq ',') or (strmid(input,0,1) eq '=') $
    then input = strmid(input, 1, 3) $ 		; lose delimeter
    else input = strmid(input, 0, 3)

 case input of	
    ''	: $			; this was the generic HELP without a topic
	hlp=['The Solar Maximum Mission UltraViolet Spectrometer/Polarimeter ',$
	     '(SMM/UVSP) catalog search program, allows the user to modify   ',$
	     'the catalog search parameters to meet specific requirements.   ',$
	     'The displayed menu shows all the current parameter settings.   ',$
	     '                                                               ',$
	     '   SHOW     Shows all the current parameter values             ',$
	     '   SEARCH   Searches catalog using current parameter values    ',$
	     '   RESET    Resets the parameter to full catalog               ',$
	     '   EXIT     Terminates the catalog search program              ',$
	     '                                                               ',$
	     'Execute a command by entering:                                 ',$
	     '                                                               ',$
	     '     <COMMAND> [; <COMMAND>]                                   ',$
	     '                                                               ',$
	     '          Where <COMMAND> is SHOW, SEARCH, RESET, EXIT,        ',$
	     '                or HELP                                        ',$
	     "          Where [] indicates optional input (don't type them). ",$
	     '                                                               ',$
	     'Modify the current search parameter by entering:               ',$
	     '                                                               ',$
	     '     <COMMAND> [<VALUE>] [; <COMMAND> [<VALUE>]]               ',$
	     '                                                               ',$
	     '          Where <COMMAND> is any keyword listed in the first   ',$
	     '                column of the menu or HELP                     ',$
	     '          Where <VALUE> is a new parameter value,              ',$
	     '                if <VALUE> is not present your will be promted.',$
	     "          Where [] indicates optional input (don't type them). ",$
	     '                                                               ',$
	     'Note:  ";" separates multiple commands lines,                  ',$
	     '       "-" indicates a range of values,                        ',$
	     '       "," separates individual values,                        ',$
	     '       3 only characters for commands are needed,              ',$
	     '       either upper or lower case is acceptable.               ',$
	     '                                                               ',$
	     'Help on a specific topic will be provide by entering:          ',$
	     '                                                               ',$
	     '       HELP [<COMMAND>]                                        ',$
	     '                                                               ',$
	     '          Where <COMMAND> is any keyword listed in the first   ',$
	     '            column of the menu or SHOW, SEARCH, RESET, EXIT,   ',$
	     '            or HELP                                            ',$
	     "          Where [] indicates optional input (don't type them). ",$
	     '                                                               ',$
	     'EXAMPLE: RAN 100-500,512, 514; xpix 5-80 ; YPIX 1; Show; SEARCH',$
	     '                                                               ',$
	     '                 Modifies the current RAN value to be 100      ',$
	     '                 through 500 and 512 and 514. And also,        ',$
	     '                 make the XPIX parameter values between        ',$
	     '                 5 and 80, and YPIX to be only 1. The SHOW     ',$
	     '                 displays all current settings to the screen,  ',$
	     '                 and SEARCH initiates the calatog search.      ',$
	     '                                                               ',$
	     '                                                               ',$
	     'Also see HELP for MAN.                                         ',$
	     '                                                               ']

    'HEL' : $			; help about help
	hlp=['Display help information about a topic.                        ',$
	     '                                                               ',$
	     'For help on a specific topic enter:                            ',$
	     '                                                               ',$
	     '       HELP [<COMMAND>]                                        ',$
	     '                                                               ',$
	     '          Where <COMMAND> is any keyword listed in the first   ',$
	     '              column of the menu or SHOW, SEARCH, RESET, EXIT, ',$
  	     '              or HELP                                          ',$
	     "          Where [] indicates optional input (don't type them). ",$
	     '                                                               ',$
	     '       Example :  HELP RAN; HELP TYPE                          ',$
	     '                  will display help about the command RAN      ',$
	     '                  and help about TYPE                          ',$
	     '                                                               ',$
	     'Note: for multiple helps use the multiple command format       ',$
	     '      where each help command line is separated by ";".        ',$
	     '                                                               ',$
	     'Entering HELP without a topic displays general information.    ',$
	     '                                                               ',$
	     '                                                               ']

    'EXI' : $ 			; user entered HELP EXIT
	hlp=['EXIT causes program to terminate without further processing,   ',$
	     '     and returns you to the interactive IDL session.           ',$
	     '                                                               ',$
	     'While in screen mode, an EXIT in the middle a print will print ',$
	     'the experiments processed up to termination.                   ',$
	     '                                                               ']

    'RES' : $	                ; user entered HELP RESET
	hlp=['RESET causes parameters to return to the default settings.     ',$
	     '                                                               ',$
	     'In widget mode, press and hold the button called RESET.        ',$
	     '   Then drag the mouse to the parameter to be reset and        ',$
	     '   release.                                                    ',$
	     '                                                               ',$
	     'In screen mode, type RESET, RESE or RES followed by the        ',$
	     '   parameter you want to reset.  If no parameter is entered,   ',$
	     '   then all parameters are reset.                              ',$
	     '                                                               ']

    'SEA' : $	                ; user entered HELP RUN
	hlp=['SEARCH causes the program to search the catalog for experiments',$
	     'that meet all the current parameter settings.                  ',$
	     '                                                               ',$
	     'NOTE: It is a VERY good idea to do the command "SHOW" prior to ',$
	     '      to a "SEARCH", just to be sure.                          ',$
	     '                                                               ']
    'GO' : $	                ; user entered HELP GO
	hlp=['GO is an alias for SEARCH, see HELP SEARCH                     ',$
	     '                                                               ']


    'SHO' : $	                ; user entered HELP SHOW
	hlp=['SHOW causes the program to display the menu with the currently ',$
	     'set values.                                                    ',$
	     '                                                               ']

    'LIS' : $	                ; user entered HELP LIST
	hlp=['LIST is an alias for SHOW, see HELP SHOW                       ',$
	     '                                                               ']

    'RAN' : $	                ; user entered HELP RAN
	hlp=['RAN is time range or the experiment range for the search.      ',$
	     'Do not mix formats.  However the "special case", listed below  ',$
	     'may be mixed with either the time or experiment number format. ',$
	     '                                                               ',$
	     'Special case for quick range inputs:                           ',$
	     '                                                               ',$
	     '   !WLD  :  Selects all working wavelength drive experiments   ',$
	     '   !80   :  Selects all 1980 experiments                       ',$
	     '   !84   :  Selects all 1984 experiments                       ',$
	     '   !85   :  Selects all 1985 experiments                       ',$
	     '   !86   :  Selects all 1986 experiments                       ',$
	     '   !87   :  Selects all 1987 experiments                       ',$
	     '   !88   :  Selects all 1988 experiments                       ',$
	     '   !89   :  Selects all 1989 experiments                       ',$
	     '                                                               ',$
	     '                                                               ',$
	     'Time range format is ([] indicate optional):                   ',$
	     '                                                               ',$
	     ' 	RAN YY-Mon-DD hh:mm [- YY-Mon-DD hh:mm                       ',$
	     '		[, YY-Mon-DD hh:mm [- YY-Mon-DD hh:mm]]]             ',$
	     '                                                               ',$
	     '     where YY is the last 2 digits of year                     ',$
	     '           Mon is the month abbreviated (ex: jan, Jan, JaN)    ',$
	     '           DD is the date                                      ',$
	     '           hh is the hour                                      ',$
	     '           mm is the minute                                    ',$
	     '                                                               ',$
	     '  Note   "-" between times indicates a range of times where    ',$
	     '              any part, of an experiment occurred.             ',$
	     '         A single time is a request for the closest            ',$
	     '                  to that time whether earlier or later.       ',$
	     '         "," separates ranges and individual times,            ',$
	     '         If only part of a time is present, the program will   ',$
	     '            try to make a resonable time.  But the result may  ',$
	     '            not be your intention.                             ',$
	     '                                                               ',$
	     'NOTE: It is a VERY good idea to do the command "SHOW" prior to ',$
	     '      to a "SEARCH", just to be sure.                          ',$
	     '                                                               ',$
	     ' 	EXAMPLE:                                                     ',$
	     '      RAN 89-Feb-01 - 20:34, 23:50, 89-feb-3 15:10 - 89-aUG-23 ',$
	     '                                                               ',$
	     '           search range includes all experiments occurring     ',$
	     '           completely or partially from                        ',$
	     '           Febuary 1, 1989 00:00 to Febuary 1, 1989 20:34,     ',$
	     '           and also the the experiment occurring closest to    ',$
	     '           Febuary 1, 1989, 23:50,                             ',$
	     '           and also all experiment in part or whole from       ',$
	     '           Febuary 3, 1989 15:10 to August 23, 1989 00:00.     ',$
	     '                                                               ',$
	     ' -OR-                                                          ',$
	     '                                                               ',$
	     'Experiment number format is ([] indicate optional):            ',$
	     '                                                               ',$
	     ' 	RAN experment # [- experiment #                              ',$
	     '		[, experiment # [- experiment #]]]                   ',$
	     '                                                               ',$
	     ' 	EXAMPLE: RAN 22155 - 22165, 30000, 99760 - 99771             ',$
	     '                                                               ',$
	     '           search range includes experiment 22155 to 22165,    ',$
	     '           and experiment 30000 and the range 99760 - 99771    ',$
	     '                                                               ']

    'NAM' : $	                ; user entered HELP NAME
	hlp=['NAME is a letter combination to be matched to the experiment   ',$
	     'definition name.                                               ',$
	     '                                                               ',$
	     'If your input is anywhere in the experiment name then that     ',$
	     'experiment qualifies. All letter are treated as upper case,    ',$
	     'and spaces are ignored.                                        ',$
	     '                                                               ',$
	     'Any number of wildcards are allowed.                           ',$
	     'The wildcard designator is the asterisk (*).                   ',$
	     '                                                               ',$
	     '  Example :    NAM O4*.s, f E, P*H*C*A*L                        ',$
	     '                                                               ',$
	     '               Will locate all qualifing experiments with:     ',$
	     '               "O4" anywhere, but the "O4" must have a         ',$
	     '                    following ".S",                            ',$
	     '                or  experiments that have a "FE" anywhere      ',$
	     '                    in the name,                               ',$
	     '                or  experiments that have a "P" followed by    ',$
	     '                    a "H" followed by a "C" followed by and    ',$
	     '                    "A" followed by a "L"                      ',$
	     '                                                               ',$
	     '                                                               ']

    'TYP' : $	                ; user entered HELP TYPE
	hlp=['TYPE is the experiment type number:                            ',$
	     '  1 = SPECTROHELIOGRAMS, 2 = DOPPLERGRAMS, 3 = POLARGRAMS,     ',$
	     '  4 = MAGNETOGRAMS,      5 = I-MAX,        6 = I-MIN,          ',$
             '  7 = FLASH WATCH,       8 = RED-MAX,      9 = blue-max,       ',$
 	     ' 10 = SPCTROGRAM,       11 = LAMBDA-MAX (GBL),                 ',$
             ' 12 = LAMBDA-MAX (LCL), 13 = LAMBDA-MIN (GBL),                 ',$
	     ' 14 = LAMBDA-MIN (LCL), 15 = SPECIAL,                          ',$
	     ' 16 = PROFILE MATRIX (PM),                                     ',$
	     ' 17 = MULTI-LINE PROFILE MAXTRIX,                              ',$
	     ' 18 = RASTER THROUGH THE LINE(RL),                             ',$
	     ' 19 = POLARIZED PROFILE MATRIX,                                ',$
	     ' 20 = POLARIZED MULTI-LINE PROFILE MATRIX,                     ',$
	     ' 21 = POLARIZED RASTER through the line.                       ',$
	     '                                                               ',$
	     'Command sequence: TYPE n [- n] [[, n] [- n]]                   ',$
	     '                                                               ',$
	     ' 	EXAMPLE: TYPE 1 - 12, 15, 17 - 21                            ',$
	     '                                                               ',$
	     '      search range includes experiments which used             ',$
	     '      used any experiment of type 1 to 12, or                  ',$
	     '      type 15, or any from type 17 to 21.                      ',$
	     '                                                               ']
 
    'SLI' : $	                ; user entered HELP SLIT
	hlp=['SLIT is the experiment slit number:   1 to 22                  ',$
	     '                                                               ',$
	     '  Example:   SLI 1-3, 20                                       ',$
	     '                                                               ',$
	     '             Will find all qualifing experiments the use slits ',$
	     '             1, 2, 3, or 20.                                   ',$
	     '                                                               ',$
	     '                                                               ']

    'DET' : $	                ; user entered HELP DET
	hlp=['DET is the experiment detector number:                         ',$
	     '                                                               ',$
	     'There are 5 detectors and an experiment may use 4 at a time.   ',$
	     'If any of the input detectors are present, then that experiment',$
	     'qualifies.                                                     ',$
	     '                                                               ',$
	     '  Example:   DET 1-3, 5                                        ',$
	     '                                                               ',$
	     '             Will fiind all qualifing experiment that use      ',$
	     '             detectors 1, 2, 3, or 5 in any of the 4 possible  ',$
	     '             detector operations.                              ',$
	     '                                                               ']

    'XPI' : $	                ; user entered HELP NX
 	hlp=['XPIX is the experiment X dimension size (pixels):              ',$
	     '                                                               ',$
	     'Commonly known as NX, this is the number of pixels in the X    ',$
	     'direction.  Usually 1 to 255 pixels are used for an experiment.',$
	     '                                                               ']

    'YPI' : $	                ; user entered HELP NY
	hlp=['YPIX is the experiment Y dimension size (pixels):              ',$
	     '                                                               ',$
	     'Commonly known as NY, this is the number of pixels in the Y    ',$
	     'direction.  Usually 1 to 255 pixels are used for an experiment.',$
	     '                                                               ']

    'XRE' : $	                ; user entered HELP DX
	hlp=['XRES is the experiment X pixel resolution (arcsec):            ',$
	     '                                                               ',$
	     'Commonly known as DX, this is the size of one of the X         ',$
	     'direction pixels.                                              ',$
	     '                                                               ']

    'YRE' : $	                ; user entered HELP DY	
	hlp=['YRES is the experiment X pixel resolution:                     ',$
	     '                                                               ',$
	     'Commonly known as DY, this is the size of one of the Y         ',$
	     'direction pixels.                                              ',$
	     '                                                               ']

    'SPE' : $	                ; user entered HELP SPEC
	hlp=['SPEC is a request for spectra:                                 ',$
	     '                                                               ',$
	     'Spectra is any experiment with more than 1 wavelengh value.    ',$
	     'It is sufficient to enter just N or Y, in upper or lower case. ',$
	     '                                                               ']

    'ANG' : $	                ; user entered HELP ANGS
	hlp=['ANGS is the wavelenth range (angstroms):                       ',$
	     '                                                               ',$
	     'If there are multiple detectors, then the wavelengths of each  ',$
	     'are tested to see if the experiment qualifies.  Remember that  ',$
	     "only the first detector's wavelength is output, and that may   ",$
	     'not have been the winner.                                      ',$
	     '                                                               ']

    'WLD' : $	                ; user entered HELP WLD
	hlp=['WLD is the number of WLD steps.                                ',$
	     '                                                               ']

    'SHI' : $	                ; user entered HELP SHIFT
	hlp=['SHIFT is the calibration WLD shift range:                      ',$
	     '                                                               ',$
	     'The number of wavelength drive steps offset for the line width ',$
	     'calibration.                                                   ',$
	     '                                                               ']

    'INT' : $	                ; user entered HELP INTVL
	hlp=['INTVL is the calibration interval:                             ',$
	     '                                                               ']

    'POL' : $	                ; user entered HELP POL
	hlp=['POL is the polarimeter status:                                 ',$
	     '                                                               ',$
	     'A or B indicate which waveplate is in. O (for out) means no    ',$
	     'waveplate in light path).                                      ',$
	     '                                                               ']

    'NPO' : $	                ; user entered HELP NP
	hlp=['NPOL is the number of polarimeter steps:                       ',$
	     '                                                               ',$
	     'The number of polarimeter waveplate positions for each repeat. ',$
	     '                                                               ']

    'DUR' : $	                ; user entered HELP DUR
	hlp=['DUR is the experiment duration (minutes):                      ',$
	     '                                                               ',$
	     'Duration is usually less than the daylight portion of an orbit,',$
	     'about 60 minutes.  Some experiment entries have values that are',$
	     'unreasonable. The output of these entries is indicted with a   ',$
	     'duration value of 99.                                          ',$
	     '                                                               ']
    'RSU' : $	                ; user entered HELP RSUN
	hlp=['RSUN is the radial distance from sun center:                   ',$
	     '                                                               ',$
	     'Radius vector of center of raster in units of the solar        ',$
	     'semidiameter.                                                  ',$
	     '                                                               ']

    'NOA' : $	                ; user entered HELP NOAA
	hlp=['NOAA is the pointing target code or the NOAA active region.    ',$
	     '                                                               ',$
	     'The active region number for the mission are 2287 to 5786.     ',$
	     '                                                               ',$
	     'The target codes are the objective for the experiment:         ',$
	     '                                                               ',$
	     ' 1 = S/C  = Center of Disk                                     ',$
	     ' 2 = Coal = Coalignment                                        ',$
	     ' 3 = Star = Stellar Observation                                ',$
   	     ' 4 = Hole = Coronal Hole                                       ',$
	     ' 5 = Fila = Filament                                           ',$
	     ' 6 = Limb = At or near Limb                                    ',$
	     ' 7 = BRPT = Bright Point                                       ',$
	     ' 8 = Prom = Prominence                                         ',$
	     ' 9 = Clos = UVSP door closed                                   ',$
	     '10 = Nite = SMM orbital night                                  ',$
	     '11 = Pole = At or near North of South Pole                     ',$
	     '12 = Plag = Plage (Active Region with no number)               ',$
	     '13 = QSun = Quiet Sun, not at Sun Center or Limb               ',$
	     '14 = S/CT = Sun Center with Solar Feature Tracking             ',$
	     '15 = Full = Part of complete or partial Full Disk image        ',$
	     '16 = Surv = Survey on Disk, similar to partial Full Disk image ',$
	     '                                                               ',$
	     'A combination of pointing target codes and active region       ',$
	     'numbers are allowed.                                           ',$
	     '                                                               ']

    'MAN' : $	                ; user entered HELP MAN 
	hlp=['MAN is a way to code in your own search parameters by directly ',$
	     'inputting a string that will be used by an IDL program to do   ',$
	     'a WHERE function on the catalog stored in variable CAT.        ',$
	     '                                                               ',$
	     'The variable CAT may be as large as integer array 64 x 99771   ',$
	     '    64 catalog fields for each experiment                      ',$
	     '    99771 experiments in the catalog (but not all valid)       ',$
	     '                                                               ',$
	     '                                                               ',$
	     'You may enter:                                                 ',$
	     '                                                               ',$
	     '  MAN <expression_1> [<boolean> <expression_n>]                ',$
	     '                                                               ',$
	     '    where:                                                     ',$
	     '                                                               ',$
 	     '    <expression_n> is CAT(<field>,*) <operator> <value>        ',$
	     '                                                               ',$
	     '           CAT     is the array name used by the program       ',$
	     '           <field> is your subset of the 64 fields indices     ',$
	     '           *       is the symbol that represents the subset    ',$
	     '                      of experiments that meet all the         ',$
	     '                      requirements determined by the standard  ',$
	     '                      parameters.                              ',$
	     '           <operator> is one of the relational operators       ',$
	     '                        EQ, NE, LE, LT, GE, GT                 ',$
	     '           <value> is your operand to be related to CAT        ',$
	     '                                                               ',$
	     '    <boolean> is a boolean operator (AND, OR, XOR)             ',$
	     '    [] indicates optional input                                ',$
	     '                                                               ',$
	     'To show your current manual parameter enter :                  ',$
	     '                                                               ',$
	     '     SHOW MAN		(not SHO MAN) 			     ',$
	     '                                                               ',$
	     '                                                               ',$
	     'No checking is performed before IDL tries to execute your      ',$
	     'expression.  The program will crash because of syntax errors.  ',$
	     '                                                               ',$
	     'NOTE: Remember to RESET MAN to undo manually input expressions ',$
	     '                                                               ',$
	     'Examples:                                                      ',$
	     '                                                               ',$
	     '    MAN ((cat(41,*) eq 127) and (cat(42,*) eq 127))            ',$
	     '                                                               ',$
	     '          In addition to the currently set parameters...       ',$
	     '          select only those experiments that have XCEN         ',$
	     '          and YCEN of 127 and 127.                             ',$
	     '                                                               ',$
	     '    MAN (CAT(23,*)/100 lt -2 or  CAT(23,*)/100 gt 2) and (CAT(2',$
	     '    3,*)/100 lt -22 or  CAT(23,*)/100 gt -18)                  ',$
	     '                                                               ',$
	     '          In addition to the currently set parameters...       ',$
	     '          select only those experiments that have roll         ',$
	     '          angles not within 2 degrees of 0 or -20 degrees.     ',$
	     '                                                               ',$
	     'The portion of the catalog that you selected is interactively  ',$
	     'accessible through the common COMMON UVCAT, CAT.               ',$
	     '                                                               ']


 else : hlp = 'Sorry no help for topic, "'+ input +'". Enter HELP for assistance.'
 endcase

 if n_elements(message) ne 0 then message=hlp $     ; return help message
 else begin                                     ; print help message

    if !version.os eq 'vms' then file = 'SYS$OUTPUT' $     	; VMS
		            else file = '/dev/tty'		; UNIX
    openw, unit, file, error=err, width=72, /get_lun, /more

    printf, unit, hlp, format='(a72)'
    free_lun, unit
 endelse

return
end
