1 |
|
---|
2 |
function svan = sw_svan(S,T,P) |
---|
3 |
|
---|
4 |
% SW_SVAN Specific volume anomaly |
---|
5 |
%========================================================================= |
---|
6 |
% SW_SVAN $Id: sw_svan.m,v 1.1 2003/12/12 04:23:22 pen078 Exp $ |
---|
7 |
% Copyright (C) CSIRO, Phil Morgan 1992. |
---|
8 |
% |
---|
9 |
% USAGE: svan = sw_svan(S,T,P) |
---|
10 |
% |
---|
11 |
% DESCRIPTION: |
---|
12 |
% Specific Volume Anomaly calculated as |
---|
13 |
% svan = 1/sw_dens(s,t,p) - 1/sw_dens(35,0,p) |
---|
14 |
% Note that it is often quoted in literature as 1e8*units |
---|
15 |
% |
---|
16 |
% INPUT: (all must have same dimensions) |
---|
17 |
% S = salinity [psu (PSS-78) ] |
---|
18 |
% T = temperature [degree C (ITS-90)] |
---|
19 |
% P = Pressure [db] |
---|
20 |
% (alternatively, may have dimensions 1*1 or 1*n where n is columns in S) |
---|
21 |
% |
---|
22 |
% OUTPUT: |
---|
23 |
% svan = Specific Volume Anomaly [m^3 kg^-1] |
---|
24 |
% |
---|
25 |
% AUTHOR: Phil Morgan 92-11-05, Lindsay Pender (Lindsay.Pender@csiro.au) |
---|
26 |
% |
---|
27 |
% DISCLAIMER: |
---|
28 |
% This software is provided "as is" without warranty of any kind. |
---|
29 |
% See the file sw_copy.m for conditions of use and licence. |
---|
30 |
% |
---|
31 |
% REFERENCE: |
---|
32 |
% Fofonoff, N.P. and Millard, R.C. Jr |
---|
33 |
% Unesco 1983. Algorithms for computation of fundamental properties of |
---|
34 |
% seawater, 1983. _Unesco Tech. Pap. in Mar. Sci._, No. 44, 53 pp. |
---|
35 |
% Eqn (9) p.15. |
---|
36 |
% |
---|
37 |
% S. Pond & G.Pickard 2nd Edition 1986 |
---|
38 |
% Introductory Dynamical Oceanogrpahy |
---|
39 |
% Pergamon Press Sydney. ISBN 0-08-028728-X |
---|
40 |
%========================================================================= |
---|
41 |
|
---|
42 |
% Modifications |
---|
43 |
% 99-06-25. Lindsay Pender, Fixed transpose of row vectors. |
---|
44 |
% 03-12-12. Lindsay Pender, Converted to ITS-90. |
---|
45 |
|
---|
46 |
% CALLER: general purpose |
---|
47 |
% CALLEE: sw_dens.m |
---|
48 |
|
---|
49 |
%---------------------- |
---|
50 |
% CHECK INPUT ARGUMENTS |
---|
51 |
%---------------------- |
---|
52 |
if nargin ~=3 |
---|
53 |
error('sw_svan.m: Must pass 3 parameters') |
---|
54 |
end %if |
---|
55 |
|
---|
56 |
% CHECK S,T,P dimensions and verify consistent |
---|
57 |
[ms,ns] = size(S); |
---|
58 |
[mt,nt] = size(T); |
---|
59 |
[mp,np] = size(P); |
---|
60 |
|
---|
61 |
|
---|
62 |
% CHECK THAT S & T HAVE SAME SHAPE |
---|
63 |
if (ms~=mt) | (ns~=nt) |
---|
64 |
error('check_stp: S & T must have same dimensions') |
---|
65 |
end %if |
---|
66 |
|
---|
67 |
% CHECK OPTIONAL SHAPES FOR P |
---|
68 |
if mp==1 & np==1 % P is a scalar. Fill to size of S |
---|
69 |
P = P(1)*ones(ms,ns); |
---|
70 |
elseif np==ns & mp==1 % P is row vector with same cols as S |
---|
71 |
P = P( ones(1,ms), : ); % Copy down each column. |
---|
72 |
elseif mp==ms & np==1 % P is column vector |
---|
73 |
P = P( :, ones(1,ns) ); % Copy across each row |
---|
74 |
elseif mp==ms & np==ns % PR is a matrix size(S) |
---|
75 |
% shape ok |
---|
76 |
else |
---|
77 |
error('check_stp: P has wrong dimensions') |
---|
78 |
end %if |
---|
79 |
|
---|
80 |
%***check_stp |
---|
81 |
|
---|
82 |
|
---|
83 |
% ----- |
---|
84 |
% BEGIN |
---|
85 |
% ----- |
---|
86 |
svan = ( ones(size(S)) ./ sw_dens(S,T,P)) - ... |
---|
87 |
(ones(size(S)) ./ sw_dens(35*ones(size(S)),zeros(size(S)),P) ); |
---|
88 |
|
---|