      PROGRAM QUICKHOURS
C
C  READ HOUR AVERAGES DATA OUTPUT BY VOYPROD PROCESSING
C  OUTPUT SELECTED FIELDS.
C
C        word   type   variable
C
C        1      I*4    spacecraft label
C        2       "     year - 1900
C        3       "     day (JAN 1 = 1)
C        4       "     hour (0,23)
C        5      R*4    x - spacecraft position (A.U. in IHG system)
C        6       "     y
C        7       "     z
C        8       "     r = sqrt(x**2+y**2+z**2)
C        9       "     F1 field magnitude (nanotesla)
C        10      "     F2 field modulus
C        11      "     delta (azimuthal field angle - HG system, IMP in SE)
C        12      "     lambda (meridional field angle in degrees)
C        13      "     bulk speed (km/sec)
C        14      "     meridional flow direction
C        15      "     azimuthal flow direction
C        16      "     ion density (#/cc)
C        17      "     ion temperature (degrees kelvin)
C        18            SPARE
C        19      "     electron velocity
C        20      "     electron density
C        21      "     electron temperature
C        22            RMS field modulus (Voyager 1992+ only)
C        23            RMS field magnitude (Voyager 1992+ only)
C        24            RMS field x component (Voyager 1992+ only)
C        25            RMS field y component (Voyager 1992+ only)
C        26            RMS field z component (Voyager 1992+ only)
C        27      "     cosmic ray counts HET-A (Voyager only)
C        28      "     sigma for word 27
C        29      "     cosmic ray counts HET-B (Voyager only)
C        30      "     sigma for word 29
C        31      "     alpha speed (km/sec)
C        32      "     alpha density (#/cc)
C        33      "     alpha temperature (degrees kelvin)
C        34            SPARE
C        35            SPARE
C
      CHARACTER DSN*80
      LOGICAL*1 REC(140)
      INTEGER*4 IN(35)
      LOGICAL*4 LIN(35)
      REAL*4 FIN(35),LAM
C
      DEG = 180.0 / 3.14159
      RAD = 3.14159 / 180.0
C
      WRITE(6,*)
      WRITE(6,*) 'ENTER INPUT DSN'
      READ(5,'(A)') DSN
      OPEN(50,FILE=DSN,STATUS='OLD',FORM='UNFORMATTED')
C
      WRITE(6,*)
      WRITE(6,*) 'ENTER OUTPUT DSN'
      READ(5,'(A)') DSN
      OPEN(51,FILE=DSN,STATUS='NEW',FORM='FORMATTED',
     &     CARRIAGECONTROL='LIST')
C
      IREAD = 0
      IWRITE = 0
   10 CONTINUE
       READ(50,END=100,ERR=10) (IN(I),I=1,4),(FIN(I),I=5,35)
       IREAD = IREAD + 1
C FIELD
       IF ( FIN(9).GT.0.0 .AND. FIN(9).NE.999.0 ) THEN
        F1 = FIN(9)
        F2 = FIN(10)
        DEL = FIN(11)*RAD
        LAM = FIN(12)*RAD
        BR = F2 * COS(LAM) * COS(DEL)
        BT = F2 * SIN(LAM) * COS(DEL)
        BN = F2 * SIN(DEL)
       ELSE
        F1 = 999.0
        F2 = 999.0
        BR = 999.0
        BT = 999.0
        BN = 999.0
       END IF
C
       WRITE 
     &  (51,'(4(1X,I3),1X,F8.4,5(1X,F7.3))')  
     &  (IN(I),I=1,4),(FIN(I),I=8,10),BR,BT,BN
       IWRITE = IWRITE + 1
      GOTO 10
  100 CONTINUE
C
      CLOSE(50)
      CLOSE(51)
      WRITE(6,*) IREAD,' RECORDS READ'
      WRITE(6,*) IWRITE,' RECORDS WRITTEN'
      STOP
  800 FORMAT(1X,I1,1X,I2,1X,I3,1X,I2)
      END
