Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
function pres = sw_pres(DEPTH,LAT)
% SW_PRES Pressure from depth
%===========================================================================
% SW_PRES $Revision: 1.5 $ $Date: 1994/10/11 01:23:32 $
% Copyright (C) CSIRO, Phil Morgan 1993.
%
% USAGE: pres = sw_pres(depth,lat)
%
% DESCRIPTION:
% Calculates pressure in dbars from depth in meters.
%
% INPUT: (all must have same dimensions)
% depth = depth [metres]
% lat = Latitude in decimal degress north [-90..+90]
% (LAT may have dimensions 1x1 or 1xn where depth(mxn) )
%
% OUTPUT:
% pres = Pressure [db]
%
% AUTHOR: Phil Morgan 93-06-25 (morgan@ml.csiro.au)
%
% DISCLAIMER:
% This software is provided "as is" without warranty of any kind.
% See the file sw_copy.m for conditions of use and licence.
%
% REFERENCES:
% Saunders, P.M. 1981
% "Practical conversion of Pressure to Depth"
% Journal of Physical Oceanography, 11, 573-574
%
% CHECK VALUE:
% P=7500.00 db for LAT=30 deg, depth=7321.45 meters
%=========================================================================
% CALLER: general purpose
% CALLEE: none
%-------------
% CHECK INPUTS
%-------------
[mD,nD] = size(DEPTH);
[mL,nL] = size(LAT);
if mL==1 & nL==1
LAT = LAT*ones(size(DEPTH));
[mL,nL] = size(LAT);
end %if
if (mD~=mL) | (nD~=nL) % DEPTH & LAT are not the same shape
if (nD==nL) & (mL==1) % LAT for each column of DEPTH
LAT = LAT( ones(1,mD), : ); % copy LATS down each column
% s.t. dim(DEPTH)==dim(LAT)
else
error('sw_pres.m: Inputs arguments have wrong dimensions')
end %if
end %if
Transpose = 0;
if mD == 1 % row vector
DEPTH = DEPTH(:);
LAT = LAT(:);
Transpose = 1;
end %if
%-------------
% BEGIN
%-------------
DEG2RAD = pi/180;
X = sin(abs(LAT)*DEG2RAD); % convert to radians
C1 = 5.92E-3+X.^2*5.25E-3;
pres = ((1-C1)-sqrt(((1-C1).^2)-(8.84E-6*DEPTH)))/4.42E-6;
if Transpose
pres = pres';
end %if
return
%===========================================================================