;+
; NAME:
;     GET_SEGTYP
; PURPOSE:
;     Returns a string identifying a segment type from
;       segcode in the Time/Label field of a record.
; CATEGORY:
;     OVRO APC DATA-ANALYSIS
; CALLING SEQUENCE:
;     segtypstr = get_segtyp(segcode)
; INPUTS:
;     segcode    the segment code as read from Time/Label field
;                  of a segment record.
; OPTIONAL (KEYWORD) INPUT PARAMETERS:
; ROUTINES CALLED:
; OUTPUTS:
;     segtypstr  a string giving the segment type, or the
;                  string '***unknown segment type***' if
;                  the segcode is invalid.
; COMMENTS:
; SIDE EFFECTS:
; RESTRICTIONS:
; SEE ALSO:
;     get_scntyp
; MODIFICATION HISTORY:
;     Written 26-Sep-1997 by Dale Gary
;     07-Sep-1998  DG
;       Added MONITOR segment (added TRAJEC segment around 25 Aug).
;     03-Feb-1998  DG
;       Added EPHEMERIS segment (usurped the segment number of the
;       MONITOR segment, so MONITOR must now be segment code 10).
;     16-May-1999  DG
;       Added SCRDUMP segment and ENCODER segment
;     24-Jul-1999  DG
;       Added TPCAL, AMPCAL, and PHZCAL segments
;     13-Nov-1999  DG
;       Added EOF and INDEX segments
;     17-Nov-1999  DG
;       Added GAINPARM and TP-UPDATE segments
;     11-Mar-2000  DG
;       Changed CPC LOG segment type to DIALOG HISTORY segment type
;     07-Jun-2000  DG
;       Added DAILYPHZ segment
;-
function get_segtyp,segcode

   segtyp = ['EMPTY RECORD','HEADER segment','CONFIG segment',$
             'OBSEQ  segment','TRAJEC segment','ARRAY PARM segment',$
             'DIALOG HISTORY segment','DATA   segment','EOS',$
             'EPHEMERIS segment','MONITOR segment','ENCODER segment',$
             'SCRDUMP segment','TPCAL segment','AMPCAL segment',$
             'PHZCAL segment','INDEX segment','EOF','GAINPARM segment',$
             'TP-UPDATE segment','DAILYPHZ segment']

   nsegs = n_elements(segtyp)
   if (segcode lt 0 or segcode ge nsegs) then begin
      return,'***Unknown segment type***'
   endif else return,segtyp(segcode)
end
