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

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

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

Initial import of Stark code.

Line 
1
2 function vel = sw_gvel(ga,lat,lon)
3
4 % SW_GVEL    Geostrophic velocity
5 %===================================================================
6 % GEOVEL   $Id: sw_gvel.m,v 1.1 2003/12/12 04:23:22 pen078 Exp $
7 %          Copyright (C) CSIRO, Phil Morgan 1992
8 %
9 % USAGE:  vel = sw_gvel(ga,lat,lon)
10 %
11 % DESCRIPTION:
12 %    Calculates geostrophic velocity given the geopotential anomaly
13 %    and position of each station.
14 %
15 % INPUT:
16 %    ga   = geopotential anomoly relative to the sea surface.
17 %           dim(mxnstations)
18 %    lat  = latitude  of each station (+ve = N, -ve = S) [ -90.. +90]
19 %    lon  = longitude of each station (+ve = E, -ve = W) [-180..+180]
20 %
21 % OUTPUT:
22 %    vel  = geostrophic velocity RELATIVE to the sea surface.
23 %           dim(m,nstations-1)
24 %
25 % AUTHOR:   Phil Morgan   1992/03/26  (morgan@ml.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: S. Pond & G.Pickard  2nd Edition 1986
32 %            Introductory Dynamical Oceanogrpahy
33 %            Pergamon Press Sydney.  ISBN 0-08-028728-X
34 %            Equation 8.9A p73  Pond & Pickard
35 %
36 % NOTE: This calls sw_dist.m.  You can replace the call to this
37 %       routine if you have a more appropraite distance routine.
38 %==================================================================
39
40 % CALLER:   general purpose
41 % CALLEE:   sw_dist.m
42 %
43
44
45 DEG2RAD = pi/180;
46 RAD2DEG = 180/pi;
47 OMEGA   = 7.292e-5;  % Angular velocity of Earth  [radians/sec]
48
49 % You may replace the call to sw_dist if you have
50 % a more appropriate distance routine.
51 distm = 1000*sw_dist(lat,lon,'km');
52 [m,n] = size(ga);
53 f     = 2*OMEGA*sin( (lat(1:n-1)+lat(2:n))*DEG2RAD/2 );
54 lf    = f.*distm;
55
56 LF = lf(ones(m,1),:);
57
58 vel   = -( ga(:,2:n)-ga(:,1:n-1) ) ./ LF;
59
60 return
61 %--------------------------------------------------------------------
62
63
Note: See TracBrowser for help on using the browser.