      SUBROUTINE DYNHT(PRSDB,PRVPRS,DELTA,PRVDEL,PRVDHT,DYHT)
C
C     TITLE:
C     *****
C
C       DYNHT  -- CALCULATE DYNAMIC HEIGHT
C
C     SYSTEM:
C     ******
C
C       PACODF HYDROGRAPHIC DATA LIBRARY
C
C     PURPOSE:
C     *******
C
C       TO CALCULATE DYNAMIC HEIGHT
C
C     METHOD:
C     ******
C
C       DYNAMIC HEIGHT IS CALCULATED BY INTEGRATION OF SPECIFIC
C       VOLUME ANOMALY WITH RESPECT TO PRESSURE,
C
C     USAGE:
C     *****
C
C       PREVIOUS DYNAMIC HEIGHT (PRVDHT) SHOULD BE SET TO THE
C       NULL VALUE nan TO INITIALIZE DYNHT.
C
C     PARAMETERS:
C     **********
C
C       PRSDB   -> PRESSURE   (DECIBARS)
C       PRVPRS  -> PREVIOUS PRESSURE
C       DELTA   -> SPECIFIC VOLUME ANOMALY (L/Kg)
C       PRVDEL  -> PREVIOUS SPECIFIC VOLUME ANOMALY
C       PRVDHT  -> PREVIOUS DYNAMIC HEIGHT
C       DYHT    <- DYNAMIC HEIGHT (DYNAMIC METERS or JOULES/(10*Kg) or
C                                  M**2/(10*SEC**2))
C
        REAL PRSDB,PRVPRS,DELTA,PRVDEL,PRVDHT,DYHT
C
C     VARIABLES:
C     *********
C
        REAL DP
C
C     CONSTANTS:
C     *********
C
        integer isnan
C
C     CODE:
C     ****
C
      DP = PRSDB-PRVPRS
C       /* CHANGE IN PRESSURE */
C
C     SELECT
C       (NO PREVIOUS DYNAMIC HEIGHT):
          IF(isnan(PRVDHT).eq.0) GO TO 10
          PRVDHT = 0.0
          PRVDEL = DELTA
C         SELECT
C           (PRESSURE <= 15 DB):
              IF(PRSDB.LT.15.0) GO TO 20
              DYHT  = 0.0
              GO TO 30
C           (OTHERWISE):  /* CALCULATE FROM SURFACE */
C         END SELECT
C       (DP < 0.5 DB):
   10     CONTINUE
          IF(ABS(DP).GT.0.5) GO TO 20
          DYHT  = PRVDHT
C         /* INSIGNIFICANT PRESSURE CHANGE */
          GO TO 30
C       (OTHERWISE):
   20     CONTINUE
          DYHT  = PRVDHT + (PRVDEL+DELTA)*500.*DP
C           /* DYNAMIC HEIGHT IN DYNAMIC METERS */
   30   CONTINUE
C     END SELECT
C
C     /* RETURN */
C
      RETURN
C
C     END DYNHT
C
      END
