source: trunk/angle.pro @ 2

Last change on this file since 2 was 2, checked in by pinsard, 17 years ago

initial import from /usr/work/fvi/OPA/geomag/

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;
40; I. Compute the cosinus and sinus
41; ================================
42;     
43;     ... north pole direction & modulous (at u-point)
44      zxnpu = 0. - fsxspp( glamu, gphiu )
45      zynpu = 0. - fsyspp( glamu, gphiu )
46      znnpu = zxnpu*zxnpu + zynpu*zynpu
47;     
48;     ... north pole direction & modulous (at v-point)
49      zxnpv = 0. - fsxspp( glamv, gphiv )
50      zynpv = 0. - fsyspp( glamv, gphiv )
51      znnpv = zxnpv*zxnpv + zynpv*zynpv
52;     
53;     ... j-direction: f-point segment direction (u-point)
54      zxffu=  fsxspp( glamf, gphif ) - fsxspp( shift(glamf, 0, 1), shift(gphif, 0, 1) )
55      zyffu=  fsyspp( glamf, gphif ) - fsyspp( shift(glamf, 0, 1), shift(gphif, 0, 1) )
56      zmnpfu= sqrt ( znnpu * ( zxffu*zxffu + zyffu*zyffu )  )
57
58     
59;     
60;     ... i-direction: f-point segment direction (v-point)
61      zxffv=  fsxspp( glamf, gphif ) - fsxspp( shift(glamf, 1, 0), shift(gphif, 1, 0) )
62      zyffv=  fsyspp( glamf, gphif ) - fsyspp( shift(glamf, 1, 0), shift(gphif, 1, 0) )
63      zmnpfv= sqrt ( znnpv * ( zxffv*zxffv + zyffv*zyffv )  )
64     
65;     
66;     ... cosinus and sinus using scalar and vectorial products
67      gsinu = ( zxnpu*zyffu - zynpu*zxffu ) / zmnpfu
68      gcosu = ( zxnpu*zxffu + zynpu*zyffu ) / zmnpfu
69
70
71;     
72;     ... cosinus and sinus using scalar and vectorial products
73;     (caution, rotation of 90 degres)
74      gsinv = ( zxnpv*zxffv + zynpv*zyffv ) / zmnpfv
75      gcosv =-( zxnpv*zyffv - zynpv*zxffv ) / zmnpfv
76
77     
78;     
79;     
80;     II. Geographic mesh
81;     ===================
82;     
83;     
84      ind = where(abs(glamf-shift(glamf, 0, 1)) LT 1.e-8)
85      gsinu(ind) = 0.d
86      gcosu(ind) = 1.d
87;     
88      ind = where(abs(gphif-shift(gphif, 1, 0)) LT 1.e-8)
89      gsinv(ind) = 0.d
90      gcosv(ind) = 1.d
91;
92return
93END
Note: See TracBrowser for help on using the repository browser.