source: trunk/initorca2_bab.pro @ 20

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

initorca2_bab.pro can now be used in xxx call

File size: 6.4 KB
Line 
1; +
2;
3; @file_comments
4; initialisation on ORCA grid
5;
6; @param orcares {in}{required}{type=string}
7; code of ORCA grid to use for output results
8; must be 'ORCA2' or 'ORCA025'
9;
10; @keyword DRAKKAR_EXP {type=string}
11; code for Drakkar experiment
12; only used when orcares = ORCA025
13; must be G42 ++ G70
14;
15; @keyword EXTRA
16; must exist in order to be able to use this procedure as an argument
17;
18; @examples
19; appel classique
20; IDL> initocemesh,'ORCA2'
21;
22; to plot ${GEOMAG_OD}/cond_sed_ORCA2.nc :
23; IDL> myfile=getenv('GEOMAG_OD') + 'cond_sed_ORCA2.nc'
24; IDL> xxx, myfile, 'initocemesh', '''ORCA2''',format='(i5)',
25;
26; @history
27; F. Vivier 2003
28; F. Pinsard adaptation to new SAXO
29; according to SAXO ./SRC/Tests/tst_initorca2.pro
30; fplod 2007-05-15T13:43:21Z aedon.locean-ipsl.upmc.fr (Darwin)
31; transformation in procedure with parameter orcares
32; fplod 2007-06-05T12:22:38Z aedon.locean-ipsl.upmc.fr (Darwin)
33; (following Sebastien Masson advices)
34; . add EXTRA keyword in order to be able to use this procedure as an argument
35; of <pro>xxx</pro>.
36; . add  EXTRA to the call of ncdf_meshlec
37; replace initorca2_bab by initocemesh in filename and procedure name
38;
39; @todo
40;
41; zminmesh and izmaxmesh may be set to 0,0 because we only work with
42; surface problem (no z) whatever the resolution of ORCA. this will safe lot
43; of memory
44;
45; use <pro>ncdf_getaxis</pro> to recover meshmask dimension
46; on x, retrieve -1 and -1 (bande de recouvrement haut et bas)
47; on y, for ORCA2, retrieve -2 (bande de recouvrement ++ et ++)
48;
49; reminder : ORCA2 = 182 x 149 and ORCA025 1442 x 1021
50;
51; for ORCA025, use /keepcont in <pro>triangule</pro> call.
52;
53; @version
54; $Id$
55;
56;-
57;
58PRO initocemesh, orcares, DRAKKAR_EXP = drakkar_exp, _EXTRA = ex
59;
60  compile_opt idl2, strictarrsubs
61;
62@cm_4mesh
63@cm_4cal
64@cm_4data
65;
66; check input parameters
67CASE orcares OF
68   'ORCA2': BEGIN
69               msg = 'iii : valid orcares parameter = ' + orcares
70               ras = report(msg)
71               filename_oce = 'meshmask_bab.nc'
72               IF keyword_set(DRAKKAR_EXP) THEN BEGIN
73                  msg = 'www : unused DRAKKAR_EXP keyword = ' + drakkar_exp
74                  ras = report(msg)
75               END
76            END
77     'ORCA025': BEGIN
78                 msg = 'iii : valid orcares parameter = ' + orcares
79                 ras = report(msg)
80                 IF keyword_set(DRAKKAR_EXP) THEN BEGIN
81                    msg = 'iii : DRAKKAR_EXP keyword set'
82                    ras = report(msg)
83                    msg = 'iii : DRAKKAR_EXP = ' + drakkar_exp
84                    ras = report(msg)
85                    CASE drakkar_exp OF
86                       'G42' : BEGIN
87                                  msg = 'iii : valid DRAKKAR_EXP keyword = ' + drakkar_exp
88                                  ras = report(msg)
89                               END
90                       'G70' : BEGIN
91                                  msg = 'iii : valid DRAKKAR_EXP keyword = ' + drakkar_exp
92                                  ras = report(msg)
93                               END
94                       ELSE : BEGIN
95                                  msg = 'eee : invalid DRAKKAR_EXP keyword = ' + drakkar_exp
96                                  ras = report(msg)
97                                  RETURN
98                              END
99                    ENDCASE
100                    filename_oce = orcares + '-' + drakkar_exp + '_mesh_hgr.nc'
101                 END
102              END
103    ELSE  : BEGIN
104               msg = 'eee : invalid orcares parameter = ' + orcares
105               ras = report(msg)
106               msg = 'eee : orcares must be ORCA2 or ORCA025'
107               ras = report(msg)
108               RETURN
109            END
110  ENDCASE
111;
112; check for input files
113;
114; test if ${GEOMAG_ID} defined
115  geomag_id_env=GETENV('GEOMAG_ID')
116  CASE geomag_id_env OF
117     ''  :  BEGIN
118              msg = 'eee : ${GEOMAG_ID} is not defined'
119              ras = report(msg)
120              RETURN
121            END
122     ELSE: BEGIN
123             msg = 'iii : ${GEOMAG_ID} is ' + geomag_id_env
124             ras = report(msg)
125           END
126  ENDCASE
127iodirin = isadirectory(geomag_id_env)
128;
129; existence and protection of ${GEOMAG_ID}
130  IF (FILE_TEST(iodirin, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN
131     msg = 'eee : the directory' + iodirin  + ' is not accessible.'
132     ras = report(msg)
133     RETURN
134  ENDIF
135;
136; check if this file exists
137fullfilename_oce = isafile(iodirin + filename_oce, NEW=0, /MUST_EXIST, $
138                     RECURSIVE=0)
139  IF fullfilename_oce[0] EQ '' THEN BEGIN
140     msg = 'eee : the file ' + fullfilename_oce + ' was not found.'
141     ras = report(msg)
142     RETURN
143  ENDIF
144;
145; protection
146  IF (FILE_TEST(fullfilename_oce[0], /READ) EQ 0) THEN BEGIN
147     msg = 'eee : the file ' + fullfilename_oce[0] + ' is not readable.'
148     ras = report(msg)
149     RETURN
150  ENDIF
151;
152;--------------------------------------------------------
153; boundaries of the read grid regarding to the original grid
154;----------------------------------------------------------
155;
156CASE orcares OF
157   'ORCA2': BEGIN
158ixminmesh  =1
159ixmaxmesh  =180
160;
161iyminmesh  =0
162iymaxmesh  =147
163;
164izminmesh  =-1
165izmaxmesh  =-1
166;
167              END
168   'ORCA025': BEGIN
169ixminmesh  =1
170ixmaxmesh  =1440
171;
172iyminmesh  =0
173iymaxmesh  =1019
174;
175izminmesh  =-1
176izmaxmesh  =-1
177;
178              END
179      ELSE  : BEGIN
180                 msg = 'eee : invalid orcares parameter = ' + orcares
181                 ras = report(msg)
182                 msg = 'eee : orcares must be ORCA2 or ORCA025'
183                 ras = report(msg)
184                 RETURN
185              END
186  ENDCASE
187jpt = 1
188time = 0
189;------------------------------------------------------
190; read the grid
191;------------------------------------------------------
192;
193key_stride = [1, 1, 1]
194ncdf_meshlec, fullfilename_oce[0], glamboundary = [20, 380], _extra = ex
195;-------------------------------------------------------------
196domdef
197;
198CASE orcares OF
199  'ORCA2'  : BEGIN
200                triangles_list = triangule()
201             END
202  'ORCA025': BEGIN
203                triangles_list = triangule(/keepcont)
204             END
205      ELSE : BEGIN
206                msg = 'eee : invalid orcares parameter = ' + orcares
207                ras = report(msg)
208                msg = 'eee : orcares must be ORCA2 or ORCA025'
209                ras = report(msg)
210                RETURN
211             END
212ENDCASE
213;
214; boundaries of the data regarding to the original grid
215jpidta = jpiglo
216jpjdta = jpjglo
217jpkdta = jpkglo
218ixmindta = 0
219ixmaxdta = jpidta-1
220iymindta = 0
221iymaxdta = jpjdta-1
222izmindta = 0
223izmaxdta = jpkdta-1
224;
225@updateold
226;
227END
Note: See TracBrowser for help on using the repository browser.