1 | ;------------------------------------------------------------ |
---|
2 | ;------------------------------------------------------------ |
---|
3 | ;------------------------------------------------------------ |
---|
4 | ;+ |
---|
5 | ; NAME:tracegrille |
---|
6 | ; |
---|
7 | ; PURPOSE:dessine la grille |
---|
8 | ; |
---|
9 | ; CATEGORY: |
---|
10 | ; |
---|
11 | ; CALLING SEQUENCE:tracegrille |
---|
12 | ; |
---|
13 | ; INPUTS:none |
---|
14 | ; |
---|
15 | ; KEYWORD PARAMETERS: |
---|
16 | ; |
---|
17 | ; XSTRIDE un entier pour specifier qu''on ne veut tracer |
---|
18 | ; qu''une ligne de i constant tout les xstride points |
---|
19 | ; |
---|
20 | ; YSTRIDE un entier pour specifier qu''on ne veut tracer |
---|
21 | ; qu''une ligne de j constant tout les ystride points |
---|
22 | ; |
---|
23 | ; OCEAN: pour ne tracer la grille que sur les points oceans |
---|
24 | ; |
---|
25 | ; EARTH: pour ne tracer la grille que sur les points terre |
---|
26 | ; |
---|
27 | ; + tous les mots clefs de la procedure PLOTS |
---|
28 | ; |
---|
29 | ; OUTPUTS:none |
---|
30 | ; |
---|
31 | ; COMMON BLOCKS:common.pro |
---|
32 | ; |
---|
33 | ; SIDE EFFECTS:trace la grille specifiee par vargrid, sur le domaine |
---|
34 | ; definit par le dernier domdef. |
---|
35 | ; |
---|
36 | ; RESTRICTIONS: |
---|
37 | ; |
---|
38 | ; EXAMPLE: |
---|
39 | ; |
---|
40 | ; IDL> plt,indgen(jpi,jpj),/nocontour,/nocouleur |
---|
41 | ; IDL> tracegrille,/ocean,color=20 |
---|
42 | ; IDL> tracegrille,/earth,color=80 |
---|
43 | ; |
---|
44 | ; |
---|
45 | ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) |
---|
46 | ; |
---|
47 | ;- |
---|
48 | ;------------------------------------------------------------ |
---|
49 | ;------------------------------------------------------------ |
---|
50 | ;------------------------------------------------------------ |
---|
51 | PRO tracegrille, OCEAN = ocean, EARTH = earth, XSTRIDE = xstride, YSTRIDE = ystride, _extra = extra |
---|
52 | @common |
---|
53 | tempsun = systime(1) ; pour key_performance |
---|
54 | if n_elements(key_gridtype) EQ 0 then key_gridtype = 'c' |
---|
55 | |
---|
56 | grille, mask, glam, gphi, gdep, nx, ny |
---|
57 | if (size(mask))[0] EQ 3 then mask = mask[*, *, 0] |
---|
58 | case 1 of |
---|
59 | keyword_set(ocean):BEGIN |
---|
60 | earth = where(mask EQ 0) |
---|
61 | if earth[0] NE -1 then begin |
---|
62 | glam[earth] = !values.f_nan |
---|
63 | gphi[earth] = !values.f_nan |
---|
64 | endif |
---|
65 | END |
---|
66 | keyword_set(earth):BEGIN |
---|
67 | ocean = where(mask EQ 1) |
---|
68 | if ocean[0] NE -1 then begin |
---|
69 | glam[ocean] = !values.f_nan |
---|
70 | gphi[ocean] = !values.f_nan |
---|
71 | endif |
---|
72 | END |
---|
73 | ELSE: |
---|
74 | endcase |
---|
75 | if NOT keyword_set(xstride) then xstride = 1 |
---|
76 | if NOT keyword_set(ystride) then ystride = 1 |
---|
77 | case key_gridtype of |
---|
78 | 'c':BEGIN |
---|
79 | for i = 0, ny-1, ystride do begin |
---|
80 | plots, glam[*, i], gphi[*, i], color = c_cote, _extra = extra |
---|
81 | endfor |
---|
82 | for i = 0, nx-1, xstride do begin |
---|
83 | plots, glam[i, *], gphi[i, *], color = c_cote, _extra = extra |
---|
84 | endfor |
---|
85 | END |
---|
86 | 'e':BEGIN |
---|
87 | shifted = glam[0, 0] LT glam[0, 1] |
---|
88 | glam2 = glam+(glam[1]-glam[0])/2. |
---|
89 | if shifted then begin |
---|
90 | for i = 0, ny-2 do BEGIN |
---|
91 | xx = (transpose([[glam[*, i]], [glam2[*, i]]]))[*] |
---|
92 | yy = (transpose([[gphi[*, i]], [gphi[*, i+1]]]))[*] |
---|
93 | plots, xx[0:2*nx-2], yy[0:2*nx-2], color = c_cote, _extra = extra |
---|
94 | ENDFOR |
---|
95 | ENDIF ELSE BEGIN |
---|
96 | for i = 1, ny-1 do BEGIN |
---|
97 | xx = (transpose([[glam[*, i]], [glam2[*, i]]]))[*] |
---|
98 | yy = (transpose([[gphi[*, i]], [gphi[*, i-1]]]))[*] |
---|
99 | plots, xx[0:2*nx-2], yy[0:2*nx-2], color = c_cote, _extra = extra |
---|
100 | ENDFOR |
---|
101 | ENDELSE |
---|
102 | for i = 1, (ny-1)/2 do $ |
---|
103 | plots, [glam[0, 2*i-1], glam[0, 2*i]] $ |
---|
104 | , [gphi[0, 2*i-1], gphi[0, 2*i]], color = c_cote, _extra = extra |
---|
105 | for i = 0, (ny-2)/2 do $ |
---|
106 | plots, [glam[nx-1, 2*i], glam[nx-1, 2*i+1]] $ |
---|
107 | , [gphi[nx-1, 2*i], gphi[nx-1, 2*i+1]], color = c_cote, _extra = extra |
---|
108 | END |
---|
109 | endcase |
---|
110 | |
---|
111 | if keyword_set(key_performance) THEN print, 'temps trace grille', systime(1)-tempsun |
---|
112 | return |
---|
113 | end |
---|