      SUBROUTINE CR4PRI(GAMMA,SCF,TIME,BAD)
C
C USING 192 SECOND CR-4 EDR RECORD, PRODUCE 48 SECOND BLOCK OF 1.92 SEC
C AVERAGES FROM PRIMARY MAG DETAIL (0.30 SEC) DATA POINTS.
C
C ORIGINAL SOURCE WRITTEN BY SANDY KRAMER, HUGHES STX, CODE 692  03/26/96
C
      CHARACTER RECTYPE*4,TELFMT*4,FLTID*4
C
      INTEGER*2 TIME(6),DELTA(6),EDRTIME(6),LAUNCH(6),
     &          WORD13(2),WORD30(2),WORD31(2),WORD32(2)
C
      INTEGER*4 IB192(25)
C
      REAL*4 SCF(3,640),GAMMA(3,640),FMOD(640),DEL(640),LAM(640),
     &       B192(3,25),DEL192(25),LAM192(25),FMOD192(25),
     &       FMAG192(25),RMS192(3,25),X192(25),Y192(25),Z192(25)
C
      REAL*4 HDR(32),DATA(341)
C
      INCLUDE 'UNPACK.INC'
C
      EQUIVALENCE (SUMOUT(1),HDR(1)),    (SUMOUT(33),DATA(1)),
     &            (HDR(13),WORD13(1)),   (HDR(30),WORD30(1)),
     &            (HDR(31),WORD31(1))
C
      EQUIVALENCE (DATA(67),FMAG192(1)), (DATA(92),FMOD192(1)),
     &            (DATA(117),DEL192(1)), (DATA(142),LAM192(1)),
     &            (DATA(242),RMS192(1,1)),(DATA(317),IB192(1))
C
C 48 SECOND TIME TAG INCREMENT ARRAY
C
      DELTA(1) = 0
      DELTA(2) = 0
      DELTA(3) = 0
      DELTA(4) = 0
      DELTA(5) = 48
      DELTA(6) = 0
C
C CREATE FOUR 48 SECOND SUMMARY BLOCKS FROM 192 SECOND CR-4 RECORD
C
      DO K = 1,4     ! 48 SECOND BLOCK COUNTER (4*48=192 SEC)
C
C COMPUTE DETAIL FIELD MODULUS AND ANGLES FOR ONE 48 SECOND PERIOD
C
       I = (K-1)*160 + 1
       CALL ANGLES(GAMMA(1,I),160,FMOD(I),DEL(I),LAM(I),BAD)
C
C COMPUTE 25 1.92 SECOND AVERAGES FOR ONE 48 SECOND PERIOD
C
       ISTART = I
       DO J = 1,25    
C
C 160 PRIMARY GAMMAS PER 48 SECOND PERIOD THEREFORE
C 32 PRIMARY GAMMAS PER 9.6 SECOND AVERAGE. INTERPOLATE 
C 1.92 SECOND AVERAGES USING OLD MVS SOURCE METHOD
C
        L = MOD(J-1,5) + 1  ! COUNTER, RANGE = 1-5
        INCR = 6 + MOD(L+1,2)  ! NUMBER OF DETAIL POINTS PER 1.92 SEC AVG (6,7)
C
C COMPUTE 1.92 SECOND FIELD COMPONENTS, MAGNITUDE AND COMPONENT RMS
C
        CALL STATS(GAMMA(1,ISTART),FMOD(ISTART),INCR,B192(1,J),
     &             FMAG192(J),RMS192(1,J),IB192(J),BAD)
        ISTART = ISTART + INCR
C
       END DO
C
       WORD30(1) = 160
       WORD30(2) = 20
       WORD31(1) = 10
       WORD31(2) = 5
C 
C COMPUTE 48 SECOND AVERAGE OF THE SPACECRAFT FIELD
C
       KREC = (K-1)*160 + 1
       CALL CR4SCF(SCF(1,KREC),TIME,BAD)
C
C COMPUTE 9.6 SECOND AVERAGES AND 48 SECOND AVERAGES
C
       CALL BIGAVE(B192,TIME,BAD)
C
C INCREMENT CR-4 RECORD BLOCK TIME BY 48 SECONDS
C
       CALL INC_TIME(TIME,DELTA)
C
C INCREMENT 48 SECOND COUNTER
C
       WORD13(2) = WORD13(2) + 1
C
      END DO
C
      RETURN
      END
