      SUBROUTINE CR6FLD(GAMMA,GAMMA2,SCF,AMBIENT,TIME,BAD)
C
C USING 1440 SECOND CR-6 EDR RECORD, INTERPOLATE SECONDARY MAG
C DATA (3.84 SEC) POINTS TO PRIMARY MAG DATA RATE (1.92 SEC) 
C TO COMPUTE SPACECRAFT AND AMBIENT FIELDS.  
C
C ORIGINAL SOURCE WRITTEN BY SANDY KRAMER, HUGHES STX, CODE 692 - 03/21/96
C
      INTEGER*2 TIME(6)
      REAL*4 GAMMA(3,750),GAMMA2(3,375),SCF(3,750),AMBIENT(3,750)
C
C     IMPLEMENT SPACECRAFT FIELD COUPLING COEFFICIENT, ALPHA, 
C     IN COMPUTATION OF S/C FIELD
C
C     COEF = ALPHA/(1.0-ALPHA)  WHERE ALPHA = .1876
C          = 0.230921
C
      DATA ALPHA/0.1876/,COEF/0.230921/
C
      INCLUDE 'UNPACK.INC'
C
      DO I=1,750
C
C STEP INTERPOLATE 3.84 SECOND CR-6 SECONDARY MAG DATA TO 1.92 SECOND 
C PRIMARY MAG RATE
C
       ISEC = (I-1)/2 + 1
       DO J = 1,3
C
C COMPUTER DIFFERENCE BETWEEN PRIMARY AND SECONDARY MAGNETOMETERS
C
        IF (GAMMA(J,I).NE.BAD.AND.
     &      GAMMA2(J,ISEC).NE.BAD) THEN
         SCF(J,I) = (GAMMA2(J,ISEC)-GAMMA(J,I))*COEF
        ELSE
         SCF(J,I) = BAD
        END IF
C
C COMPUTE AMBIENT FIELD FOR RETURN AT PRIMARY MODE RATE
C
        IF (GAMMA(J,I).NE.BAD.AND.SCF(J,I).NE.BAD) THEN
         AMBIENT(J,I) = GAMMA(J,I) - SCF(J,I)
        ELSE
         AMBIENT(J,I) = BAD
        END IF
C
       END DO
C
      END DO
C
      RETURN
      END
