      SUBROUTINE DERIVDX(FIELD,ID,DD,ILON,ILAT,BETAS,BETA,DFIELD)
C     
C     * APR 22/02 - BM  - MODIFIED FOR NEW DATA DESCRIPTION FORMAT
C     * JUN 08/01 - B. MIVILLE
C
C     * CALCULATE THE DERIVATIVE IN THE DX FIELD
C
C     * INPUT PARAMETERS...
C
C     * FIELD = INPUT FIELD TO BE DERIVED
C     * ID    = DETERMINE IF WE ARE DERIVING TRACERS OR NOT
C     * DD    = VALUES OF DX
C     * ILON  = NUMBER OF LONGITUDES INCLUDING CYCLIC
C     * ILAT  = NUMBER OF LATITUDES 
C     * BETAS = SHAVED HEAVISIDE FUNCTION
C     * BETA  = FULL HEAVISIDE FUNCTION
C
C     * OUTPUT PARAMETERS...
C
C     * DFIELD = DERIVED FIELD
C
C------------------------------------------------------------------
C
      IMPLICIT REAL (A-H,O-Z),
     +INTEGER (I-N)
      INTEGER ILON,ILAT
      REAL FIELD(ILON,ILAT),DD(ILON,ILAT),DFIELD(ILON,ILAT)
      REAL BETAS(ILON,ILAT),BETA(ILON,ILAT),ID
C-----------------------------------------------------------------------
C
      DO 200 J=1,ILAT
         DO 100 I=2,ILON-1
            DFIELD(I,J)=BETAS(I,J)*(BETA(I+1,J)*FIELD(I+1,J)+ID*
     1           (BETA(I+1,J)-BETA(I-1,J))*FIELD(I,J)-BETA(I-1,J)
     2           *FIELD(I-1,J))/(2.E0*DD(I,J))
 100     CONTINUE
         I=1
         DFIELD(I,J)=BETAS(I,J)*(BETA(I+1,J)*FIELD(I+1,J)+ID*
     1        (BETA(I+1,J)-BETA(ILON-1,J))*FIELD(I,J)
     2        -BETA(ILON-1,J)*FIELD(ILON-1,J))/(2.E0*DD(I,J))
         DFIELD(ILON,J)=DFIELD(1,J)
 200  CONTINUE
C
      RETURN
      END
