source: trunk/angle.pro

Last change on this file was 48, checked in by pinsard, 10 years ago

fix thanks to coding rules

File size: 2.9 KB
Line 
1PRO angle, glamu, gphiu, glamv, gphiv, glamf, gphif, gsinu, gsinv, gcosu, gcosv
2;;;---------------------------------------------------------------------
3;;;
4;;;                       ROUTINE angle
5;;;                     *******************
6;;;
7;;;  Purpose :
8;;;  --------
9;;;     Compute angles between grid lines and direction of the North
10;;;
11;;   Method :
12;;   -------
13;;
14;;   Input :
15;;   ------
16;;      common
17;;            /comcoh/ glamf,   : longitudes and latitudes at F-points
18;;                     gphif
19;;
20;;   Output :
21;;   -------
22;;      common
23;;            /comcoh/ gsinu,gcosu : sinus and cosinus of the angle
24;;                     gsinv,gcosv   between north-south direction
25;;                                   and the j-direction of the mesh
26;;
27;;   Modifications:
28;;   --------------
29;;       Original :  96-07 (O. Marti)
30;;                   98-06 (G. Madec)
31;;                   99-11 (A. Jouzeau) : Adaptation to IDL
32;;----------------------------------------------------------------------
33;;----------------------------------------------------------------------
34;
35;;;---------------------------------------------------------------------
36;;;  OPA8, LODYC (1997)
37;;;---------------------------------------------------------------------
38;
39; I. Compute the cosinus and sinus
40; ================================
41;
42;     ... north pole direction & modulous (at u-point)
43      zxnpu = 0. - fsxspp( glamu, gphiu )
44      zynpu = 0. - fsyspp( glamu, gphiu )
45      znnpu = zxnpu*zxnpu + zynpu*zynpu
46;
47;     ... north pole direction & modulous (at v-point)
48      zxnpv = 0. - fsxspp( glamv, gphiv )
49      zynpv = 0. - fsyspp( glamv, gphiv )
50      znnpv = zxnpv*zxnpv + zynpv*zynpv
51;
52;     ... j-direction: f-point segment direction (u-point)
53      zxffu=  fsxspp( glamf, gphif ) - fsxspp( shift(glamf, 0, 1), shift(gphif, 0, 1) )
54      zyffu=  fsyspp( glamf, gphif ) - fsyspp( shift(glamf, 0, 1), shift(gphif, 0, 1) )
55      zmnpfu= sqrt ( znnpu * ( zxffu*zxffu + zyffu*zyffu )  )
56
57
58;
59;     ... i-direction: f-point segment direction (v-point)
60      zxffv=  fsxspp( glamf, gphif ) - fsxspp( shift(glamf, 1, 0), shift(gphif, 1, 0) )
61      zyffv=  fsyspp( glamf, gphif ) - fsyspp( shift(glamf, 1, 0), shift(gphif, 1, 0) )
62      zmnpfv= sqrt ( znnpv * ( zxffv*zxffv + zyffv*zyffv )  )
63
64;
65;     ... cosinus and sinus using scalar and vectorial products
66      gsinu = ( zxnpu*zyffu - zynpu*zxffu ) / zmnpfu
67      gcosu = ( zxnpu*zxffu + zynpu*zyffu ) / zmnpfu
68
69
70;
71;     ... cosinus and sinus using scalar and vectorial products
72;     (caution, rotation of 90 degres)
73      gsinv = ( zxnpv*zxffv + zynpv*zyffv ) / zmnpfv
74      gcosv =-( zxnpv*zyffv - zynpv*zxffv ) / zmnpfv
75
76
77;
78;
79;     II. Geographic mesh
80;     ===================
81;
82;
83      ind = where(abs(glamf-shift(glamf, 0, 1)) LT 1.e-8)
84      gsinu(ind) = 0.d
85      gcosu(ind) = 1.d
86;
87      ind = where(abs(gphif-shift(gphif, 1, 0)) LT 1.e-8)
88      gsinv(ind) = 0.d
89      gcosv(ind) = 1.d
90;
91return
92END
Note: See TracBrowser for help on using the repository browser.