      SUBROUTINE  W3FP07(IPDS0,IPDS,TITL,IERR)
C$$$  SUBPROGRAM DOCUMENTATION  BLOCK
C                .      .    .                                       .
C SUBPROGRAM:  W3FP07        ONE-LINE GRIB TITLER FROM PDS SECTION
C   PRGMMR: MCCLEES          ORG: NMC421      DATE:88-02-02
C
C ABSTRACT: CONVERTS GRIB FORMATTED PRODUCT DEFINITION SECTION TO A
C   ONE LINE READABLE TITLE.  GRIB SECTION 0 IS ALSO TESTED TO
C   VERIFY THAT GRIB DATA IS BEING DECIPHERED.
C
C PROGRAM HISTORY LOG:
C   87-09-19  ORIGINAL AUTHOR MCCLEES, A. J.
C   87-11-16  MCCLEES,A.J. DELE'S THE WORD GRIB IN THE FORMATTED LINE
C             AND INCREASES THE NO. OF CASES DECIPHERED.
C   88-01-27  MCCLEES,A.J.  CORRECTED AN ERROR WHICH REVERSED THE
C             CENTER IDENTIFICATION FOR UNITED KINGDOM AND EUROPEAN
C             CENTER.
C   88-07-03  R.E.JONES   CONVERTED TO MICROSOFT FORTRAN 4.10
C   88-10-18  R.E.JONES   ADD 7 MORE TYPES FOR PDS (OCTEL 9)
C   89-03-07  R.E.JONES   ADD 2 MORE TYPES FOR PDS (OCTEL 9)
C   89-03-14  R.E.JONES   CORRECT PRECIP AMOUNTS
C   89-04-26  R.E.JONES   CHANGES TO GRIB WMO CODE FM 92-VIII EXT.
C                         FOR APRIL 26,1989 REVISION.
C   89-06-02  R.E.JONES   CHANGES TO GRIB WMO CODE FM 92-VIII EXT.
C                         FOR JUNE 26,1989 REVISION.
C   90-04-20  R.E.JONES   ADD THUNDERSTORM PROBOBILITY TO TABLES
C   90-09-10  R.E.JONES   ADD CHANGES FOR PDS VERSION 1
C   91-03-30  R.E.JONES   CONVERT TO SiliconGraphics FORTRAN
C
C USAGE:    CALL W3FP07  (IPDS0,  IPDS,  TITL, IERR )
C   INPUT ARGUMENT LIST:
C     IPDS0    - GRIB SECTION 0 READ AS CHARACTER*4
C     IPDS     - GRIB PDS SECTION READ AS CHARACTER*24
C
C   OUTPUT ARGUMENT LIST:   
C     TITL     - CHARACTER*86 OUTPUT PRINT LINE
C     IERR   0 - COMPLETED SATISFACTORILY
C            1 - GRIB SECTION 0 NOT CORRECT
C            2 - COULD NOT MATCH TYPE INDICATOR
C            3 - COULD NOT MATCH TYPE LEVEL
C            4 - COULD NOT INTERPRET ORIGINATOR OF CODE
C
C ATTRIBUTES:
C   LANGUAGE: SiliconGraphics 3.3 FORTRAN 77
C   MACHINE:  SiliconGraphics IRIS-4D/25
C
C$$$
C
        INTEGER         HH(68)
        INTEGER         HHH(13)
        INTEGER         IERR
        INTEGER         IGEN(4)
C
        LOGICAL         VER
C
        CHARACTER * 4   HHHNAM(13)
        CHARACTER * 6   HHNAM(68)
        CHARACTER * (*) IPDS 
        CHARACTER * (*) IPDS0
        CHARACTER * 28  IDPDS
        CHARACTER * 4   GRIB
        CHARACTER * 28  KNAM1(4)
        CHARACTER * 3   MONTH(12)
        CHARACTER * 4   TIMUN(4)
        CHARACTER * 2   TIMUN1(4)
        CHARACTER * 86  TITL
C
        SAVE
C
        DATA  HH    /  1,   2,   3,   4,   5,
     &                 6,   8,  10,  11,  12,
     &                13,  14,  15,  17,  21,
     &                23,  24,  29,  30,  31,
     &                40,  44,  47,  48,  50,
     &                51,  55,  58,  59,  61,
     &                64,  65,  66,  67,  68,
     &                69,  70,  75,  76,  77,
     &                78,  90,  91,  92,  93,
     &                94,  95, 100, 101, 102,
     &               103, 104, 113, 115, 130,
     &               131, 141, 162, 163, 180,
     &               181, 182, 183, 190, 210,
     &               211,  60, 220/
       DATA  HHH   / 100, 103, 105, 107, 102,
     &                 1,   6,   7,   4, 104,
     &               106, 108, 101/
       DATA  HHHNAM/'HPA ','GPM ',' M  ','SIG ','MSL ',
     &              'SFC ','MWSL','TRO ','DEGS','GPHM',
     &              ' HM ','HSIG','KPA '/
       DATA  HHNAM /' PRES ',' HGT  ',' DIST ',' TMP  ',' T MAX',
     &              ' T MIN',' POT  ',' DPT  ',' DEPR ',' SPF H',
     &              ' R H  ',' MIXR ',' LFT X',' 4LFTX',' WIND ',
     &              ' U GRD',' V GRD',' STRM ',' REL V',' ABS V',
     &              ' V VEL',' VW SH',' P WAT',' C PCP',' PCP  ',
     &              ' SNO D',' NCPCP',' ASSTW',' UWTPA',' WTMP ',
     &              ' WVSWL',' SWDIR',' SWELL',' SWPER',' WVDIR',
     &              ' WVHGT',' WVPER',' DIRPW',' PERPW',' DIRSW',
     &              ' PERSW',' ICEC ',' ICETK',' ICEDU',' ICEDV',
     &              ' ICEG ',' ICECD',' PRES ',' THCK ',' HGT  ',
     &              ' DIST ',' TMP  ',' R H  ',' LFT X',' REL V',
     &              ' ABS V',' V VEL',' WTMP ',' SSTA ',' MXLD ',
     &              ' TTCD ',' MTCD ',' MTCDA',' Q IND',' DN HT',
     &              ' DN PR',' TSTM ',' LOGSP'/
       DATA  GRIB  /'GRIB'/
       DATA  IGEN  /  7,  58,  74,  98/
       DATA  KNAM1 /'   WMC/NMC WASHINGTON.  ',
     &              '   FNOC MONTEREY, CA.   ',
     &              '   UNITED   KINGDOM.    ',
     &              ' EUROPEAN CENTER MRF.   '/
       DATA  MONTH /'JAN','FEB','MAR','APR','MAY','JUN',
     &              'JUL','AUG','SEP','OCT','NOV','DEC'/
       DATA  TIMUN /'HRS.','DAYS','MOS.','YRS.'/
       DATA  TIMUN1/'HR','DY','MO','YR'/
C
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C
C$          1.0 INITIALIZATION - NO. OF ENTRIES IN INDCATOR PARM.
C$                             - NO. OF ENTRIES IN TYPE LEVEL
C$                             - NO. OF ENTRIES IN CNTR PROD. DTA.
C
        IQ   = 68
        IS   = 13
        IC   =  4
        IERR =  0
C      
C        TEST FOR PDS VERSION 0 OR 1
C
        NNN  = iichar(IPDS(1:1)) * 65536 + iichar(IPDS(2:2)) * 256 +
     &         iichar(IPDS(3:3))   
        IF (NNN.EQ.24) THEN
          VER = .TRUE.
          IDPDS(1:24) = IPDS(1:24)
        ELSE
          VER = .FALSE.
          IDPDS(1:28) = IPDS(1:28)
        ENDIF
C
         TITL(1:30)  = '                              '
         TITL(31:60) = '                              '
         TITL(61:86) = '                          '
C ---------------------------------------------------------------------
C$           2.0 TEST SECTION 0 TO SEE IF ASCII GRIB
C
         IF (GRIB(1:4) .NE. IPDS0(1:4)) THEN
           IERR = 1
           RETURN
         ENDIF
C
C                    4.0  FIND THE INDICATOR AND TYPE LEVELS
C
       IQQ = iichar (IDPDS(9:9))
       DO 100 II = 1,IQ
         IF (IQQ .EQ. HH(II)) GO TO 200
 100   CONTINUE
         IERR = 2
         RETURN
C
 200   CONTINUE
         TITL(21:27) = HHNAM(II)
         ISS = iichar (IDPDS(10:10))
       DO 300 JJ = 1,IS
         IF (ISS .EQ. HHH(JJ)) GO TO 400
 300   CONTINUE
         IERR = 3
         RETURN
C
 400   CONTINUE
           IF (JJ .LE. 4) THEN
             TITL(16:20) = HHHNAM(JJ)
             LEVEL = iichar(IDPDS(11:11)) * 256 + iichar(IDPDS(12:12))
             WRITE (TITL(11:15),FMT='(I4)') LEVEL
           ELSE IF (JJ .GE. 5 .AND. JJ .LE. 8) THEN
             TITL(16:20) = HHHNAM(JJ)
             TITL(1:4)   = '    '
             TITL(11:15) = '    '
           ELSE IF (JJ .GT. 9) THEN
             TITL(6:11)  = HHHNAM(JJ)
             TITL(16:20) = HHHNAM(JJ)
             ITEMP = iichar(IDPDS(11:11))
             WRITE (UNIT=TITL(1:4),FMT='(I4)') ITEMP
             ITEMP = iichar(IDPDS(12:12))
             WRITE (UNIT=TITL(11:15),FMT='(I4)') ITEMP
           ENDIF
C
C               5.0 INSERT THE YEAR,DAY,MONTH AND TIME
C
       IHR = iichar (IDPDS(16:16))
       IDA = iichar (IDPDS(15:15))
       IMO = iichar (IDPDS(14:14))
       IF (VER) THEN
         IYR = iichar (IDPDS(13:13)) + 1900
       ELSE
         IYR = iichar (IDPDS(13:13)) + iichar (IDPDS(25:25)) * 100
       ENDIF
       WRITE (UNIT=TITL(58:61),FMT='(I4)') IYR
       WRITE (UNIT=TITL(51:52),FMT='(I2)') IDA
       WRITE (UNIT=TITL(37:48),FMT='(A6,I2.2,A2)') 'AFTER ',IHR,' Z'
       TITL(54:56) = MONTH(IMO)
       ITIMUN      = iichar (IDPDS(18:18))
       TITL(33:35) = TIMUN(ITIMUN)
       ITEMP = iichar(IDPDS(19:19))
       JTEMP = iichar(IDPDS(20:20))
       KTEMP = iichar(IDPDS(21:21))
C
C      ADD CORRECTION FOR PRECIP AMOUNTS
C
       IF (KTEMP.EQ.4) THEN
         WRITE (UNIT=TITL(29:31),FMT='(I3)') JTEMP
         MTEMP      = JTEMP - ITEMP
         WRITE (UNIT=TITL(2:4),FMT='(I3)') MTEMP
         TITL(6:7)  = TIMUN1(ITIMUN)
         TITL(8:12) = ' ACUM'
       ELSE
         WRITE (UNIT=TITL(29:31),FMT='(I3)') ITEMP
       ENDIF
C
C      TEST FOR ANALYSIS (MAKE CORRECTION IF MODEL IS ANALYSIS)
C
       IF (KTEMP.EQ.0.AND.ITEMP.EQ.0) THEN
          TITL(29:41) = ' ANALYSIS VT '
          MODEL       = iichar(IDPDS(6:6))
          IF (MODEL.EQ.10.OR.MODEL.EQ.39.OR.MODEL.EQ.45.OR.
     &        MODEL.EQ.46.OR.MODEL.EQ.53.OR.MODEL.EQ.69) THEN
                TITL(29:41) = ' 00-HR FCST  '
          ENDIF    
       ENDIF
C
C      TEST FOR 00-HR FCST (INITIALIZED ANALYSIS)
C
       IF (KTEMP.EQ.1.AND.ITEMP.EQ.0) THEN
          TITL(29:41) = ' 00-HR FCST  '
       ENDIF  
C
C$            3.0 FIND WHO GENERATED THE CODE
C
         IGENC = iichar (IDPDS(5:5))
         DO 500 I = 1,IC
           IF (IGENC .EQ. IGEN(I)) GO TO 600
 500     CONTINUE
           IERR = 4
           RETURN
C
 600     CONTINUE
           TITL(62:86) = KNAM1(I)
           RETURN
C
C---------------------- END OF PDS VERSION 0 
C
        END
