      SUBROUTINE CR2FLD(GAMMA,GAMMA2,SCF,AMBIENT,TIME,BAD)
C
C USING 48 SECOND CR-2 EDR RECORD, COMPUTE SPACECRAFT AND AMBIENT FIELDS.  
C
C WRITTEN BY SANDY KRAMER  03/22/96
C
      INTEGER*2 TIME(6)
C
      REAL*4 GAMMA(3,400),GAMMA2(3,200),SCF(3,400),AMBIENT(3,400)
C
C     IMPLEMENT SPACECRAFT FIELD COUPLING COEFFICIENT, ALPHA, 
C     IN COMPUTATION OF S/C FIELD
C
C     COEF = ALPHA/(1.0-ALPHA)  WHERE ALPHA = .1846
C          = 0.230921
C
      DATA ALPHA/0.1876/,COEF/0.230921/
C
      INCLUDE 'UNPACK.INC'
C
      DO I=1,400
       ISEC = (I-1)/2 + 1
       ISTAT = (I-1)/80 + 1
       DO J = 1,3
C
C COMPUTER DIFFERENCE BETWEEN PRIMARY AND SECONDARY MAGNETOMETERS
C AND THEN COMPUTE AMBIENT FIELD FOR RETURN AT PRIMARY MAG RATE.
C
        IF ( GAMMA(J,I).NE.BAD .AND.
     &       GAMMA2(J,ISEC).NE.BAD ) THEN
         SCF(J,I) = (GAMMA2(J,ISEC)-GAMMA(J,I))*COEF
         IF ( PRIME(ISTAT) ) THEN                     ! INBOARD PRIME
          SCF(J,I) = -SCF(J,I)
          AMBIENT(J,I) = GAMMA2(J,ISEC) - SCF(J,I)
         ELSE                                         ! OUTBOARD PRIME
          AMBIENT(J,I) = GAMMA(J,I) - SCF(J,I)
         END IF
        ELSE
         SCF(J,I) = BAD
         AMBIENT(J,I) = BAD
        END IF
C
       END DO
      END DO
C
      RETURN
      END
