Function DEPTH(P,LAT)
'Fofonoff and Millard (1982). UNESCO Tech Paper #44.
'This algorithm was endorsed by SCOR Working Group 51.
'The equations were originally developed by Saunders and Fofonoff (1976). DSR 23: 109-111.
'The parameters were re-fit for the 1980 equation of state for seawater (EOS80).
'CALCULATON ASSUMES STD OCEAN: T = 0 DEG C; S = 35 (IPSS-78)
'CHECKVALUE: D = 9712.653 M FOR P=10000 DECIBARS, LAT=30 DEG
X = Sin(LAT / 57.29578)
X = X * X
'GR= GRAVITY VARIATION WITH LAT: ANON (1970) BULLETIN GEODESIQUE
GR = 9.780318 * (1.0 + (0.0052788 + 0.0000236 * X) * X) + 0.000001092 * P
dep = (((-1.82E-15 * P + 0.0000000002279) * P - 0.000022512) * P + 9.72659) * P
DEPTH = dep / GR
End Function