source: trunk/procs/saxo_mods/ncdf_meshmicom.pro @ 103

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

Initial import from ~/POST_IT/

File size: 4.9 KB
Line 
1PRO ncdf_meshmicom, filename, GLAMBOUNDARY = glamboundary, _extra = ex
2;---------------------------------------------------------
3;
4   compile_opt idl2, strictarrsubs
5;
6@common
7;
8;---------------------------------------------------------
9; set default glamboundary
10;---------------------------------------------------------
11   IF n_elements(glamboundary) NE 2 THEN glamboundary = [20, 380]
12
13;---------------------------------------------------------
14; default grid definition
15;---------------------------------------------------------
16; Get the lon, lat, mask for T-points and compute some scale factors
17; for an hypothetic regular grid. But it transforms the grid from a
18; ubase grid to a tbase grid
19
20   initncdf, filename, xaxisname = 'plon', yaxisname = 'plat', zaxisname = 'sigma', /zindex $
21    , maskname = 'pmask', /ubase2tbase, GLAMBOUNDARY = glamboundary, _extra = ex
22
23;---------------------------------------------------------
24; apply real glam[uvf]
25;---------------------------------------------------------
26; Pay attention : the longitudes in the file are considered as
27; latitudes in SAXO and vice versa for U and V.
28 
29   glamu = read_ncdf('vlon', 0, 0, /timestep, file = filename, /nostruct, /cont_nofill, grid = 'U')
30   glamv = read_ncdf('ulon', 0, 0, /timestep, file = filename, /nostruct, /cont_nofill, grid = 'V')
31   glamf = read_ncdf('qlon', 0, 0, /timestep, file = filename, /nostruct, /cont_nofill, grid = 'F')
32;
33   glamu = temporary(glamu) MOD 360
34   smaller = where(glamu LT glamboundary[0])
35   if smaller[0] NE -1 then glamu[smaller] = glamu[smaller]+360
36   bigger = where(glamu GE glamboundary[1])
37   if bigger[0] NE -1 then glamu[bigger] = glamu[bigger]-360
38   glamv = temporary(glamv) MOD 360
39   smaller = where(glamv LT glamboundary[0])
40   if smaller[0] NE -1 then glamv[smaller] = glamv[smaller]+360
41   bigger = where(glamv GE glamboundary[1])
42   if bigger[0] NE -1 then glamv[bigger] = glamv[bigger]-360
43   glamf = temporary(glamf) MOD 360
44   smaller = where(glamf LT glamboundary[0])
45   if smaller[0] NE -1 then glamf[smaller] = glamf[smaller]+360
46   bigger = where(glamf GE glamboundary[1])
47   if bigger[0] NE -1 then glamf[bigger] = glamf[bigger]-360
48   toosmall = where(glamu EQ glamboundary[0])
49   IF toosmall[0] NE -1 THEN glamu[toosmall] = glamu[toosmall] + 360
50   toosmall = where(glamf EQ glamboundary[0])
51   IF toosmall[0] NE -1 THEN glamf[toosmall] = glamf[toosmall] + 360
52
53;---------------------------------------------------------
54; apply real gphi[uvf]
55;---------------------------------------------------------
56   gphiu = read_ncdf('vlat', 0, 0, /timestep, file = filename, /nostruct, /cont_nofill, grid = 'U')
57   gphiv = read_ncdf('ulat', 0, 0, /timestep, file = filename, /nostruct, /cont_nofill, grid = 'V')
58   gphif = read_ncdf('qlat', 0, 0, /timestep, file = filename, /nostruct, /cont_nofill, grid = 'F')
59
60;---------------------------------------------------------   
61; apply real masks
62;---------------------------------------------------------
63; same feinte for the masks as for the lon/lat ????
64;   umask = read_ncdf('vmask', 0, 0, /timestep, file = filename, /nostruct, /cont_nofill, grid = 'U')
65;   vmask = read_ncdf('umask', 0, 0, /timestep, file = filename, /nostruct, /cont_nofill, grid = 'V')
66;   fmask = read_ncdf('qmask', 0, 0, /timestep, file = filename, /nostruct, /cont_nofill, grid = 'F')
67
68;---------------------------------------------------------
69; apply real e1[uvf]
70;---------------------------------------------------------
71; Read the real scale factors and scratch the old ones.
72; same feinte for the masks as for the lon/lat ????
73   e1u = read_ncdf('vscaley', 0, 0, /timestep, file = filename, /nostruct, /cont_nofill, grid = 'U')
74   e1v = read_ncdf('uscaley', 0, 0, /timestep, file = filename, /nostruct, /cont_nofill, grid = 'V')
75   e1f = read_ncdf('qscalex', 0, 0, /timestep, file = filename, /nostruct, /cont_nofill, grid = 'F')
76
77;---------------------------------------------------------
78; apply real e2[uvf]
79;---------------------------------------------------------   
80   e2u = read_ncdf('vscalex', 0, 0, /timestep, file = filename, /nostruct, /cont_nofill, grid = 'U')
81   e2v = read_ncdf('uscalex', 0, 0, /timestep, file = filename, /nostruct, /cont_nofill, grid = 'V')
82   e2f = read_ncdf('qscaley', 0, 0, /timestep, file = filename, /nostruct, /cont_nofill, grid = 'F')
83   
84;---------------------------------------------------------
85; set default values pour the third dimension
86;---------------------------------------------------------
87   gdept = findgen(jpk)
88   gdepw = findgen(jpk)
89   e3t = replicate(1., jpk)
90   e3w = replicate(1., jpk)
91;---------------------------------------------------------
92; set default vargrid
93;---------------------------------------------------------
94  vargrid = 'T'
95
96;---------------------------------------------------------
97; key_yerverse
98;---------------------------------------------------------
99  key_yreverse =  1
100  print,  'key_yreverse : ',  key_yreverse
101
102  return
103end
Note: See TracBrowser for help on using the repository browser.