      FUNCTION FDENSE(T,S,P0)

C     FDENSE CALCULATES DENSITY
C      T - TEMPERATURE DEG CELSIUS
C      S - SALINITY PSU
C      P - PRESSURE DECIBARS (CHANGED TO BARS FOR CALCULATIONS)

      REAL KW,KSTO,KSTP
 
      P = P0 * .1
 
C
C
      RW =     999.842594 + 6.793952E-2*T - 9.095290E-3*T**2
     1        + 1.001685E-4*T**3 - 1.120083E-6*T**4 + 6.536332E-9*T**5
C
      RSTO =   RW + (0.824493 - 4.0899E-3*T + 7.6438E-5*T**2
     1        - 8.2467E-7*T**3 + 5.3875E-9*T**4) * S
     2       + (-5.72466E-3 + 1.0227E-4*T - 1.6546E-6*T**2) * S**1.5
     3       + 4.8314E-4 * S**2
C
      KW =     19652.21 + 148.4206*T - 2.327105*T**2 + 1.360477E-2*T**3
     1        - 5.155288E-5*T**4
C
      KSTO =   KW + (54.6746 - 0.603459*T + 1.09987E-2*T**2
     1        - 6.1670E-5*T**3) * S
     2       + (7.944E-2 + 1.6483E-2*T - 5.3009E-4*T**2) * S**1.5
C
      KSTP =   KSTO + (3.239908 + 1.43713E-3*T + 1.16092E-4*T**2
     1        - 5.77905E-7*T**3) * P
     2       + (2.2838E-3 - 1.0981E-5*T - 1.6078E-6*T**2) * P * S
     3       + 1.91075E-4 * P * S**1.5
     4       + (8.50935E-5 - 6.12293E-6*T + 5.2787E-8*T**2) * P**2
     5       + (-9.9348E-7 + 2.0816E-8*T + 9.1697E-10*T**2) * P**2 * S
C
      FDENSE =    RSTO/(1.0-P/KSTP)-1000.
C
      RETURN
      END

