function Q = pressure2depth(P,LAT)

% pressure2depth
%
%   Q = pressure2depth(P,LAT)
%
% converts pressure P[cm] to depth D[m] using pressure P and latitude LAT.

% INPUT: 
%   P = Pressure [cm]
%   LAT = Latitude [decimal degrees]

% From:
%Saunders, 1981, "Practical conversion of pressure to depth"
% Journal of Physical Oceanography, April 1981, V11, p573-574.

P = P(:)./100;
DEG2RAD=pi/180;
X = sin(LAT.*DEG2RAD);
c1 = (5.92 + 5.25.*X.*X)*1.e-3;
c2 = 2.21E-6;
Q = (1 - c1).*P - c2.*P.*P;