source: trunk/initocemeshmask.pro @ 48

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

fix thanks to coding rules

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