      SUBROUTINE MCONNECT(FILL,XVAL,YVAL,PTS,DELTA)
C
C ROUTINE TO CONNECT ADJACENT ARRAY POINTS WITH INDEPENDENT DELTAS
C LESS THAN <DELTA> WHILE REMOVING FILL VALUES.
C
      INTEGER*4 PTS
      LOGICAL*1 PRIME
      REAL*4 X(2),Y(2),XVAL(1),YVAL(1)
C
C FILL  FILL DATA VALUE
C XVAL  INDEPENDENT AXIS ARRAY
C YVAL  DEPENDENT AXIS ARRAY
C PTS   NUMBER OF ELEMENTS IN PARALLEL ARRAYS XVAL & VAL
C DELTA MAXIMUM GAP BETWEEN TWO ADJACENT POINTS TO BE CONNECTED
C
      PRIME = .FALSE.
      IPT = 0
      N = PTS - 1
      DO I = 1,N
       IF ( YVAL(I).NE.FILL ) THEN
        X(1) = XVAL(I)
        Y(1) = YVAL(I)
        PRIME = .TRUE.
       END IF
       IF ( YVAL(I+1).NE.FILL .AND. PRIME ) THEN
        X(2) = XVAL(I+1)
        Y(2) = YVAL(I+1)
        DIFF = X(2) - X(1)
        IF ( DIFF.LT.DELTA ) THEN
         CALL MGOCONNECT(X,Y,2)
        ELSE
         CALL MGORELOCATE(XVAL(I+1),YVAL(I+1))
         CALL MGOPOINT(10,3)
        END IF
        IPT = IPT + 1
        X(1) = X(2)
        Y(1) = Y(2)
       END IF
      END DO
C
      RETURN
      END
 
