Ignore:
Timestamp:
05/29/07 10:58:52 (17 years ago)
Author:
smasson
Message:

add functionalities

Location:
trunk/SRC/Interpolation
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SRC/Interpolation/angle.pro

    r242 r247  
     1 
    12;+ 
    23; 
     
    5051; @param fileocemesh {in}{required}{type=scalar string} 
    5152; a netcdf file that contains (at least) the following variables: 
     53;        glamt, gphit: longitudes and latitudes at T-points 
    5254;        glamu, gphiu: longitudes and latitudes at U-points 
    5355;        glamv, gphiv: longitudes and latitudes at V-points 
     
    7274; sinus of the angle between grid lines at T points and direction of the North pole 
    7375; 
     76; @param gcosf {out}{type=2d array} 
     77; cosinus of the angle between grid lines at F points and direction of the North pole 
     78; 
     79; @param gsinf {out}{type=2d array} 
     80; sinus of the angle between grid lines at F points and direction of the North pole 
     81; 
    7482; @keyword IODIRECTORY {type=scalar string}{default=''} 
    7583; the directory path where is located fileocemesh 
    7684; 
    77 ; @keyword DOUBLE {type=1 ou 2}{default=0} 
     85; @keyword DOUBLE {type=1 or 0}{default=0} 
    7886; put 1 to use double precision (default is float) 
    7987; 
     
    8391;       =>    gcosu[*, 0] = gcosu[*, 1] 
    8492;       =>    gsinu[*, 0] = gsinu[*, 1] 
    85 ;     (2) the grid follows OPA x periodicity rule, first column is 
    86 ;     equal to the next to last column 
    87 ;       =>    gcosv[0, *] = gcosv[jpj-2, *] 
    88 ;       =>    gsinv[0, *] = gsinv[jpj-2, *] 
     93;     (2) the grid follows OPA x and north pole periodicity rule (see <pro>lbcorca.pro</pro>) 
    8994; 
    9095; @history 
     
    9297;                   98-06 (G. Madec) 
    9398;       Feb 2005: IDL adaptation S. Masson 
     99;       May 2007: F points + call to <pro>lbcorca.pro</pro> 
    94100; 
    95101; @version 
     
    98104;- 
    99105; 
    100 PRO angle, fileocemesh, gcosu, gsinu, gcosv, gsinv, gcost, gsint $ 
     106PRO angle, fileocemesh, gcosu, gsinu, gcosv, gsinv, gcost, gsint, gcosf, gsinf $ 
    101107           , IODIRECTORY = iodirectory, DOUBLE = double 
    102108; 
     
    137143  gphiv = reform(gphiv, /over) 
    138144  gphif = reform(gphif, /over) 
    139   jpj = (size(glamf, /dimension))[1] 
     145; 
     146  sz = size(glamf, /dimension) 
     147  jpi = sz[0] 
     148  jpj = sz[1] 
    140149; 
    141150; I. Compute the cosinus and sinus 
     
    151160;   ... north pole direction & modulous (at u-point) 
    152161  znpu = fsnspp( glamu, gphiu, DOUBLE = double ) 
     162  znpu00 = znpu 
     163  znpu0i = fsnspp( shift(glamu, 0, -1), shift(gphiu, 0, -1), DOUBLE = double ) 
    153164  glamu = -1 & gphiu = -1; free memory 
    154165  znpu.x = - znpu.x 
     
    163174  znpv.y = - znpv.y 
    164175  znnpv = znpv.x*znpv.x + znpv.y*znpv.y 
    165 ;   ... f-point 
    166   znpf00 = fsnspp( glamf, gphif, DOUBLE = double ) 
     176;   ... north pole direction & modulous (at f-point) 
     177  znpf = fsnspp( glamf, gphif, DOUBLE = double ) 
     178  znpf00 = znpf 
    167179  znpf01 = fsnspp( shift(glamf, 0, 1), shift(gphif, 0, 1), DOUBLE = double ) 
    168180  znpf10 = fsnspp( shift(glamf, 1, 0), shift(gphif, 1, 0), DOUBLE = double ) 
    169181  glamf = -1 & gphif = -1; free memory 
     182  znpf.x = - znpf.x 
     183  znpf.y = - znpf.y 
     184  znnpf = znpf.x*znpf.x + znpf.y*znpf.y 
     185; 
     186 
    170187;   ... j-direction: v-point segment direction (t-point) 
    171188  zxvvt = znpv00.x - znpv01.x 
    172189  zyvvt = znpv00.y - znpv01.y 
    173190  zmnpvt = sqrt ( temporary(znnpt) * ( zxvvt*zxvvt + zyvvt*zyvvt )  ) 
    174   znpv00 = -1; free memory 
    175   znpv01 = -1; free memory 
     191  znpv00 = -1 & znpv01 = -1; free memory 
    176192  IF keyword_set(double) THEN zmnpvt = 1.e-14 > zmnpvt $ 
    177193  ELSE zmnpvt = 1.e-6 > zmnpvt 
     
    186202  zxffv = znpf00.x - znpf10.x 
    187203  zyffv = znpf00.y - znpf10.y 
    188   znpf00 = -1 &  znpf10 = -1; free memory 
     204  znpf00 = -1 & znpf10 = -1 ; free memory 
    189205  zmnpfv = sqrt ( temporary(znnpv) * ( zxffv*zxffv + zyffv*zyffv )  ) 
    190206  IF keyword_set(double) THEN zmnpfv = 1.e-14 > zmnpfv $ 
    191207  ELSE zmnpfv = 1.e-6 > zmnpfv 
     208;   ... j-direction: u-point segment direction (f-point) 
     209  zxuuf = znpu0i.x - znpu00.x 
     210  zyuuf = znpu0i.y - znpu00.y 
     211  zmnpuf = sqrt ( temporary(znnpf) * ( zxuuf*zxuuf + zyuuf*zyuuf )  ) 
     212  znpu00 = -1 & znpu0i = -1; free memory 
     213  IF keyword_set(double) THEN zmnpuf = 1.e-14 > zmnpuf $ 
     214  ELSE zmnpuf = 1.e-6 > zmnpuf 
     215 
    192216;   ... cosinus and sinus using scalar and vectorial products 
    193217  gsint = ( znpt.x*zyvvt - znpt.y*zxvvt ) / zmnpvt 
     
    200224  gsinv =  ( znpv.x*zxffv + znpv.y*zyffv ) / zmnpfv 
    201225  gcosv = -( znpv.x*zyffv - znpv.y*zxffv ) / zmnpfv 
     226;   ... cosinus and sinus using scalar and vectorial products 
     227  gsinf = ( znpf.x*zyuuf - znpf.y*zxuuf ) / zmnpuf 
     228  gcosf = ( znpf.x*zxuuf + znpf.y*zyuuf ) / zmnpuf 
    202229; 
    203230; II. Geographic mesh 
     
    222249  gcosu[*, 0] = gcosu[*, 1] 
    223250  gsinu[*, 0] = gsinu[*, 1] 
    224   gcosv[0, *] = gcosv[jpj-2, *] 
    225   gsinv[0, *] = gsinv[jpj-2, *] 
    226 ; 
     251; 
     252  IF keyword_set(double) THEN sgn = 1.d ELSE sgn = 1. 
     253  dummy = lbcorca(gcost, 'T',  sgn, /correction) 
     254  dummy = lbcorca(gsint, 'T', -sgn, /correction) 
     255  dummy = lbcorca(gcosu, 'U',  sgn, /correction) 
     256  dummy = lbcorca(gsinu, 'U', -sgn, /correction) 
     257  dummy = lbcorca(gcosv, 'V',  sgn, /correction) 
     258  dummy = lbcorca(gsinv, 'V', -sgn, /correction) 
     259  dummy = lbcorca(gcosf, 'F',  sgn, /correction) 
     260  dummy = lbcorca(gsinf, 'F', -sgn, /correction) 
     261; 
     262 
    227263  RETURN 
    228264END 
Note: See TracChangeset for help on using the changeset viewer.