      SUBROUTINE GS3FLD(GAMMA,GAMMA2,SCF,AMBIENT,TIME,BAD)
C
C USING 48 SECOND GS-3 EDR RECORD, INTERPOLATE SECONDARY MAG 
C DETAIL (0.12 SEC) DATA POINTS TO PRIMARY MAG DETAIL RATE (0.06 SEC) 
C TO COMPUTE SPACECRAFT AND AMBIENT FIELDS.  
C SBK 01/07/94
C
      INTEGER*2 TIME(6)
C
      REAL*4 GAMMA(3,800),GAMMA2(3,400),SCF(3,800),AMBIENT(3,800)
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,800
C
C STEP INTERPOLATE 0.12 SECOND GS-3 SECONDARY MAG DATA
C TO 0.06 SECOND PRIMARY MODE 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
