      FUNCTION CONT(R,NC,SCALE) 
C 
C     ALGORITHM TO OBTAIN CONTOUR INTERVAL GIVEN THE RANGE, R.
C     GIVES APPROXIMATELY NC CONTOUR INTERVALS OVER THE  RANGE. 
C     RETURNS CONT=1,2 OR 5 *10**N, WHERE N IS AN INTEGER (POS. OR NEG.)
C     SCALE IS A SCALING FACTOR.
C     PROGRAMMED BY J.L. WALMSLEY, JANUARY 1977 
C     MODIFIED APRIL 1978 
C 
      IMPLICIT REAL (A-H,O-Z),
     +INTEGER (I-N)
      CONT=1.E0 
      IF(R.EQ.0.E0)RETURN 
      S=LOG10(R/NC)
      N=INT(S) 
      L=N 
      IF(S.LT.0.E0)L=N-1
      P=S-L 
      M=INT(10.E0**P)
      IF(M.GE.8)THEN
         M=10 
      ELSE
         IF(M.GE.4)THEN 
            M=5 
         ELSE 
            IF(M.EQ.3)M=2 
         ENDIF
      ENDIF 
      RM=M
      CONT=10.E0**(LOG10(RM)+L)*SCALE
      RETURN
      END
