        SUBROUTINE SMOOTH( TLRAW, TL, NROWS, NTHETA, NR, DR, DR3DB )

C       Smooth out T.L. curve using Gaussian averaging ---
C          2*J3DB is the number of points averaged in
C          SIG    is the 'sharpness' coefficient

        PARAMETER ( MXNP = 500, LG3DB = .345388 )
        REAL TLRAW(NROWS, NR), TL(NROWS, NR), NORM, GCOEF(0:MXNP)

        J3DB = INT( DR3DB / ( 2.0 * DR ) )
        NJ = 2 * J3DB
        IF ( NJ .GT. MXNP ) THEN
           WRITE( *, * )
     &          'FATAL ERROR: Too many points in smoothing window'
           WRITE( *, * ) ' NP = ', NJ, ' MXNP = ', MXNP
           STOP 'FATAL ERROR: Too many points in smoothing window'
        ENDIF

C       *** If no smoothing then do a simple copy ***

        IF ( NJ .EQ. 0 ) THEN
           DO 700 JTH = 1, NTHETA
              DO 500 IR = 1, NR
                 TL( JTH, IR ) = TLRAW( JTH, IR )
  500         CONTINUE
  700      CONTINUE
           RETURN
        END IF

C       *** Compute the filter coefficients ***

        SHRPCF = LG3DB / FLOAT( J3DB **2 )
        DO 1000 JR = 0, NJ
           JSQ = ( J3DB - JR ) **2
           GCOEF( JR ) = EXP( -SHRPCF * FLOAT( JSQ ) )
 1000   CONTINUE

C       *** Apply the filter ***

        DO 4000 JTH = 1, NTHETA
           DO 3000 IR = 1, NR
              TLSUM = 0.0
              NORM  = 0.0
              DO 2000 JR = -J3DB, J3DB
                 K1 = IR + JR
                 IF ( K1 .GT. 0 .AND. K1 .LE. NR ) THEN
                    TLSUM = TLSUM + TLRAW( JTH, K1 ) * GCOEF( J3DB + JR)
                    NORM = NORM + GCOEF( J3DB + JR )
                 ENDIF
 2000         CONTINUE
              TL( JTH, IR ) = TLSUM / NORM
 3000      CONTINUE
 4000     CONTINUE

        RETURN
        END
