NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/gliderproc/trunk/MATLAB/seawater/sw_satO2.m

Revision 495 (checked in by cbc, 12 years ago)

Initial import of Stark code.

Line 
1 %$$$
2 %$$$ #undef __PR
3 %$$$ #include "VARIANT.h"
4
5 function c = sw_satO2(S,T)
6
7 % SW_SATO2   Satuaration of O2 in sea water
8 %=========================================================================
9 % sw_satO2 $Id: sw_satO2.m,v 1.1 2003/12/12 04:23:22 pen078 Exp $
10 %          Copyright (C) CSIRO, Phil Morgan 1998.
11 %
12 % USAGE:  satO2 = sw_satO2(S,T)
13 %
14 % DESCRIPTION:
15 %    Solubility (satuaration) of Oxygen (O2) in sea water
16 %
17 % INPUT:  (all must have same dimensions)
18 %   S = salinity    [psu      (PSS-78)]
19 %   T = temperature [degree C (ITS-68)]
20 %
21 % OUTPUT:
22 %   satO2 = solubility of O2  [ml/l]
23 %
24 % AUTHOR:  Phil Morgan 97-11-05, Lindsay Pender (Lindsay.Pender@csiro.au)
25 %
26 %$$$ #include "disclaimer_in_code.inc"
27 %
28 % REFERENCES:
29 %    Weiss, R. F. 1970
30 %    "The solubility of nitrogen, oxygen and argon in water and seawater."
31 %    Deap-Sea Research., 1970, Vol 17, pp721-735.
32 %=========================================================================
33
34 % Modifications
35 % 99-06-25. Lindsay Pender, Fixed transpose of row vectors.
36 % 03-12-12. Lindsay Pender, Converted to ITS-90.
37
38 % CALLER: general purpose
39 % CALLEE:
40
41 %$$$ #ifdef VARIANT_PRIVATE
42 %$$$ %***********************************************************
43 %$$$ %$Id: sw_satO2.m,v 1.1 2003/12/12 04:23:22 pen078 Exp $
44 %$$$ %
45 %$$$ %$Log: sw_satO2.m,v $
46 %$$$ %Revision 1.1  2003/12/12 04:23:22  pen078
47 %$$$ %*** empty log message ***
48 %$$$ %
49
50 %$$$ %
51 %$$$ %***********************************************************
52 %$$$ #endif
53
54 %----------------------
55 % CHECK INPUT ARGUMENTS
56 %----------------------
57 if nargin ~=2
58    error('sw_satO2.m: Must pass 2 parameters')
59 end %if
60
61 % CHECK S,T dimensions and verify consistent
62 [ms,ns] = size(S);
63 [mt,nt] = size(T);
64
65
66 % CHECK THAT S & T HAVE SAME SHAPE
67 if (ms~=mt) | (ns~=nt)
68    error('sw_satO2: S & T must have same dimensions')
69 end %if
70
71 %------
72 % BEGIN
73 %------
74
75 % convert T to Kelvin
76 T = 273.15 + T * 1.00024;
77
78 % constants for Eqn (4) of Weiss 1970
79 a1 = -173.4292;
80 a2 =  249.6339;
81 a3 =  143.3483;
82 a4 =  -21.8492;
83 b1 =   -0.033096;
84 b2 =    0.014259;
85 b3 =   -0.0017000;
86
87 % Eqn (4) of Weiss 1970
88 lnC = a1 + a2.*(100./T) + a3.*log(T./100) + a4.*(T./100) + ...
89       S.*( b1 + b2.*(T./100) + b3.*((T./100).^2) );
90
91 c = exp(lnC);
92
Note: See TracBrowser for help on using the browser.