1 | ;+ |
---|
2 | ; |
---|
3 | ; @file_comments |
---|
4 | ; Provide caption |
---|
5 | ; |
---|
6 | ; @categories |
---|
7 | ; Graphics |
---|
8 | ; |
---|
9 | ; @param MI {in}{required} |
---|
10 | ; The min of the drawing |
---|
11 | ; |
---|
12 | ; @param MA {in}{required} |
---|
13 | ; The max of the plot |
---|
14 | ; |
---|
15 | ; @param COUPE {type=string} |
---|
16 | ; Character containing two letters giving the type of the cut (for example: 'xz'). |
---|
17 | ; |
---|
18 | ; @keyword CONTOUR |
---|
19 | ; If we want to trace contours of a different field than the one |
---|
20 | ; whose we have the colored drawing (by example E-P in color and QSR in contours). |
---|
21 | ; It must be a field respecting same characteristics than the argument number one of plt. |
---|
22 | ; |
---|
23 | ; @keyword ENDPOINTS |
---|
24 | ; Used when we do vertical cuts in diagonal. |
---|
25 | ; |
---|
26 | ; @keyword _EXTRA |
---|
27 | ; Used to pass keywords |
---|
28 | ; |
---|
29 | ; @uses |
---|
30 | ; common.pro |
---|
31 | ; |
---|
32 | ; @restrictions |
---|
33 | ; The use of the global variable language allows to change the language and the caption easily. |
---|
34 | ; |
---|
35 | ; @history |
---|
36 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
37 | ; 14/8/98 |
---|
38 | ; Eric Guilyardi (ericg\@lodyc.jussieu.fr) GB version |
---|
39 | ; 11/6/99 |
---|
40 | ; |
---|
41 | ; @version |
---|
42 | ; $Id$ |
---|
43 | ; |
---|
44 | ;- |
---|
45 | ; |
---|
46 | PRO legende, mi, ma, coupe, CONTOUR = contour, ENDPOINTS = endpoints, DIREC = direc $ |
---|
47 | , VECTLEGENDE = vectlegende $ |
---|
48 | , INTERVALLE = intervalle, TYPE_YZ = type_yz, VARNAME2 = varname2 $ |
---|
49 | , NPTS = npts, _EXTRA = ex |
---|
50 | ; |
---|
51 | compile_opt idl2, strictarrsubs |
---|
52 | ; |
---|
53 | @common |
---|
54 | tempsun = systime(1) ; pour key_performance |
---|
55 | ;------------------------------------------------------------ |
---|
56 | grille, -1, -1, -1, gdep, nx, ny, nz |
---|
57 | ; |
---|
58 | ; English legends |
---|
59 | ; |
---|
60 | fmt_mm = '(f12.2)' |
---|
61 | fmt_bt = '(f7.1)' |
---|
62 | colorf = '' |
---|
63 | contourf = 'Contour plot,' |
---|
64 | vecteurf = 'Vector norm ' |
---|
65 | expf = '' |
---|
66 | datef = ' ' |
---|
67 | fieldf = ' ' |
---|
68 | depthf = ' ' |
---|
69 | endpointsf = 'Diag. Section' |
---|
70 | zonalf = '' |
---|
71 | IF key_onearth THEN latintf = 'latitudes in ' ELSE latintf = 'j index in ' |
---|
72 | timintf = 'time in ' |
---|
73 | onf = ' - ' |
---|
74 | depthf2 = 'Depth (m)' |
---|
75 | Meridf = 'Zonal Mean ' |
---|
76 | IF key_onearth THEN lonintf = 'longitudes in ' ELSE lonintf = 'i in ' |
---|
77 | hovxt = 'XT-plot ' |
---|
78 | diaghovxt = 'Diag. XT-plot ' |
---|
79 | depintf = 'depths in ' |
---|
80 | timef = 'Time' |
---|
81 | hovyt = 'YT-plot ' |
---|
82 | diaghovyt = 'Diag. YT-plot ' |
---|
83 | hovzt = 'ZT-plot ' |
---|
84 | hovt = '' |
---|
85 | IF key_onearth THEN lontitle = 'Longitude' ELSE lontitle = 'i index' |
---|
86 | IF key_onearth THEN lattitle = 'Latitude' ELSE lattitle = 'j index' |
---|
87 | |
---|
88 | vertz = depthf2 |
---|
89 | legniv = ' m' |
---|
90 | IF keyword_set(TYPE_YZ) THEN BEGIN |
---|
91 | IF type_yz EQ 'hPa' THEN vertz = 'hPa' |
---|
92 | IF type_yz EQ 'hPa' THEN legniv = ' hPa' |
---|
93 | ENDIF |
---|
94 | ; |
---|
95 | ; Start legende |
---|
96 | ; |
---|
97 | ;------------------------------------------------------------ |
---|
98 | ; definition and possible complement of !p.subtitle |
---|
99 | ;------------------------------------------------------------ |
---|
100 | if n_elements(varunit) ne 0 then unite = '('+varunit+')' else unite = '' |
---|
101 | !p.subtitle = colorf+unite+': Min= '+strtrim(string(format = fmt_mm, mi), 2)$ |
---|
102 | +', Max= '+strtrim(string(format = fmt_mm, ma), 2) |
---|
103 | if keyword_set(intervalle) then BEGIN |
---|
104 | if intervalle NE -1 then $ |
---|
105 | !p.subtitle = !p.subtitle+', Int= '+strtrim(string(format = fmt_mm, intervalle), 2) |
---|
106 | endif |
---|
107 | if size(contour, /type) EQ 8 then BEGIN ; it is a structure |
---|
108 | unite = '('+contour.(1)+')' |
---|
109 | !p.subtitle = !p.subtitle+'!C '+contourf+unite $ |
---|
110 | +': Min= '+strtrim(string(format = fmt_mm, contour.(0)[0]), 2)$ |
---|
111 | +', Max= '+strtrim(string(format = fmt_mm, contour.(0)[1]), 2) |
---|
112 | if contour.inter NE -1 then $ |
---|
113 | !p.subtitle = !p.subtitle+', Int= '+strtrim(string(format = fmt_mm, contour.inter), 2) |
---|
114 | ENDIF |
---|
115 | if size(vectlegende, /type) EQ 8 then begin |
---|
116 | unite = '('+vectlegende.(1)+')' |
---|
117 | !p.subtitle = !p.subtitle+'!C '+vecteurf+unite $ |
---|
118 | +': Min= '+strtrim(string(format = fmt_mm, vectlegende.(0)[0]), 2)$ |
---|
119 | +', Max= '+strtrim(string(format = fmt_mm, vectlegende.(0)[1]), 2) |
---|
120 | endif |
---|
121 | ;------------------------------------------------------------ |
---|
122 | ; Shapping of subdomain 's dimensions |
---|
123 | ;------------------------------------------------------------ |
---|
124 | la1 = strtrim(string(format = fmt_bt, lat1), 2) |
---|
125 | la2 = strtrim(string(format = fmt_bt, lat2), 2) |
---|
126 | lo1 = strtrim(string(format = fmt_bt, lon1), 2) |
---|
127 | lo2 = strtrim(string(format = fmt_bt, lon2), 2) |
---|
128 | pr1 = strtrim(string(format = fmt_bt, vert1), 2) |
---|
129 | pr2 = strtrim(string(format = fmt_bt, vert2), 2) |
---|
130 | ;------------------------------------------------------------ |
---|
131 | ; Management of the date |
---|
132 | ;------------------------------------------------------------ |
---|
133 | if n_elements(vardate) EQ 0 then vardate = '' |
---|
134 | if NOT keyword_set(direc) then direc = '' |
---|
135 | if strpos(direc, 't') NE -1 then begin |
---|
136 | svardate = strtrim(vairdate(time[0]), 1)+' - '+strtrim(vairdate(time[jpt-1]), 1) |
---|
137 | ENDIF ELSE svardate = vardate |
---|
138 | ;------------------------------------------------------------ |
---|
139 | ; case on the caes where the caption is applied |
---|
140 | ;------------------------------------------------------------ |
---|
141 | case coupe of |
---|
142 | 'xy':begin |
---|
143 | if strupcase(vargrid) EQ 'W' then firstz = firstzw $ |
---|
144 | ELSE firstz = firstzt |
---|
145 | if(strpos(direc, 'z') EQ -1 AND firstz NE 0) then BEGIN |
---|
146 | prof = strtrim(round(gdep[0]), 1) |
---|
147 | !p.title = expf+varexp+datef+svardate+fieldf+varname+depthf+prof+legniv |
---|
148 | ENDIF ELSE !p.title = expf+varexp+datef+svardate+fieldf+varname |
---|
149 | !x.title = lontitle |
---|
150 | !y.title = lattitle |
---|
151 | end |
---|
152 | |
---|
153 | 'xz':begin |
---|
154 | IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n = strtrim(ny, 1) |
---|
155 | IF long(n) LE 3 THEN zonalf = 'Section ' |
---|
156 | if keyword_set(endpoints) AND lat1 NE lat2 then $ |
---|
157 | !p.title = endpointsf+varexp+datef+svardate+fieldf+varname ELSE $ |
---|
158 | !p.title = zonalf+varexp+datef+svardate+fieldf+varname |
---|
159 | !x.title = lontitle |
---|
160 | if keyword_set(endpoints) AND lat1 EQ lat2 then BEGIN |
---|
161 | IF key_onearth THEN !x.title = !x.title+' at '+strtrim(lataxe(0, 0, lat1), 1) ELSE !x.title = !x.title+' at j index '+strtrim(lat1, 1) |
---|
162 | ENDIF |
---|
163 | !y.title = depthf2 |
---|
164 | end |
---|
165 | |
---|
166 | 'yz':begin |
---|
167 | IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n = strtrim(nx, 1) |
---|
168 | IF long(n) LE 3 THEN meridf = '' |
---|
169 | if keyword_set(endpoints) AND lon1 NE lon2 then $ |
---|
170 | !p.title = endpointsf+varexp+datef+svardate+fieldf+varname ELSE $ |
---|
171 | !p.title = meridf+varexp+datef+svardate+fieldf+varname |
---|
172 | !y.title = vertz |
---|
173 | !x.title = lattitle |
---|
174 | if keyword_set(endpoints) AND lon1 EQ lon2 then BEGIN |
---|
175 | IF key_onearth THEN !x.title = !x.title+' at '+strtrim(lonaxe(0, 0, lon1), 1) ELSE !x.title = !x.title+' at i index '+strtrim(lon1, 1) |
---|
176 | ENDIF |
---|
177 | end |
---|
178 | |
---|
179 | 'xt':begin |
---|
180 | ; IF keyword_set(npts) THEN n = strtrim(npts, 1) |
---|
181 | if keyword_set(endpoints) AND lat1 NE lat2 then $ |
---|
182 | !p.title = diaghovxt+varexp+fieldf+varname ELSE $ |
---|
183 | !p.title = hovxt+varexp+fieldf+varname |
---|
184 | IF (time[(size(time))[0]-1] - time[0]) GE 10 THEN !y.title = timef |
---|
185 | !x.title = lontitle |
---|
186 | if keyword_set(endpoints) AND lat1 EQ lat2 then BEGIN |
---|
187 | IF key_onearth THEN !x.title = !x.title+' at '+strtrim(lataxe(0, 0, lat1), 1) ELSE !x.title = !x.title+' at j index '+strtrim(lat1, 1) |
---|
188 | ENDIF |
---|
189 | end |
---|
190 | |
---|
191 | 'yt':begin |
---|
192 | ; IF keyword_set(npts) THEN n = strtrim(npts, 1) |
---|
193 | if keyword_set(endpoints) AND lon1 NE lon2 then $ |
---|
194 | !p.title = diaghovyt+varexp+fieldf+varname ELSE $ |
---|
195 | !p.title = hovyt+varexp+fieldf+varname |
---|
196 | IF (time[(size(time))[0]-1] - time[0]) GE 10 THEN !x.title = timef |
---|
197 | !y.title = lattitle |
---|
198 | if keyword_set(endpoints) AND lon1 EQ lon2 then BEGIN |
---|
199 | IF key_onearth THEN !x.title = !x.title+' at '+strtrim(lonaxe(0, 0, lon1), 1) ELSE !x.title = !x.title+' at i index '+strtrim(lon1, 1) |
---|
200 | ENDIF |
---|
201 | end |
---|
202 | |
---|
203 | 'zt':begin |
---|
204 | ; IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(nx*ny, 1) |
---|
205 | !p.title = hovzt+varexp+fieldf+varname |
---|
206 | !y.title = depthf2 |
---|
207 | IF (time[(size(time))[0]-1] - time[0]) GE 10 THEN !x.title = timef |
---|
208 | end |
---|
209 | 't':begin |
---|
210 | ; IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE BEGIN |
---|
211 | ; if keyword_set(integration3d) then n=strtrim(nx*ny*nz, 1) ELSE n=strtrim(nx*ny, 1) |
---|
212 | ; ENDELSE |
---|
213 | !p.title = hovt+varexp+fieldf+varname |
---|
214 | !y.title = varname |
---|
215 | IF (time[(size(time))[0]-1] - time[0]) GE 10 THEN !x.title = timef |
---|
216 | end |
---|
217 | 'x':begin |
---|
218 | ; IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(ny*nz, 1) |
---|
219 | if keyword_set(endpoints) AND lat1 NE lat2 then $ |
---|
220 | !p.title = endpointsf+varexp+datef+svardate+fieldf+varname ELSE $ |
---|
221 | !p.title = varexp+datef+svardate+fieldf+varname |
---|
222 | !x.title = lontitle |
---|
223 | if keyword_set(endpoints) AND lat1 EQ lat2 then BEGIN |
---|
224 | IF key_onearth THEN !x.title = !x.title+' at '+strtrim(lataxe(0, 0, lat1), 1) ELSE !x.title = !x.title+' at j index '+strtrim(lat1, 1) |
---|
225 | ENDIF |
---|
226 | !y.title = varname |
---|
227 | end |
---|
228 | 'y':begin |
---|
229 | ; IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(nx*nz, 1) |
---|
230 | if keyword_set(endpoints) AND lon1 NE lon2 then $ |
---|
231 | !p.title = endpointsf+varexp+datef+svardate+fieldf+varname ELSE $ |
---|
232 | !p.title = varexp+datef+svardate+fieldf+varname |
---|
233 | !x.title = lattitle |
---|
234 | if keyword_set(endpoints) AND lon1 EQ lon2 then BEGIN |
---|
235 | IF key_onearth THEN !x.title = !x.title+' at '+strtrim(lonaxe(0, 0, lon1), 1) ELSE !x.title = !x.title+' at i index '+strtrim(lon1, 1) |
---|
236 | ENDIF |
---|
237 | !y.title = varname |
---|
238 | end |
---|
239 | 'z':begin |
---|
240 | IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n = strtrim(nx*ny, 1) |
---|
241 | !p.title = varexp+datef+svardate+fieldf+varname |
---|
242 | !y.title = depthf2 |
---|
243 | !x.title = varname |
---|
244 | end |
---|
245 | 'yfx': BEGIN |
---|
246 | IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n = strtrim(nx*ny*nz, 1) |
---|
247 | !p.title = varexp+datef+svardate+varunit |
---|
248 | !x.title = varname2 |
---|
249 | !y.title = varname |
---|
250 | END |
---|
251 | else: |
---|
252 | ENDCASE |
---|
253 | if keyword_set(direc) then BEGIN |
---|
254 | if strpos(direc, 'x') NE -1 then $ |
---|
255 | !p.subtitle = lonintf+'['+lo1+', '+lo2+']'+onf+'('+strtrim(nx, 1)+' points) !C' +!p.subtitle |
---|
256 | if strpos(direc, 'y') NE -1 then BEGIN |
---|
257 | if strpos(!p.subtitle, '[') EQ -1 then $ |
---|
258 | !p.subtitle = latintf+'['+la1+', '+la2+']'+onf+'('+strtrim(ny, 1)+' points) !C'+!p.subtitle $ |
---|
259 | ELSE !p.subtitle = latintf+'['+la1+', '+la2+']'+onf+'('+strtrim(ny, 1)+' points) '+!p.subtitle |
---|
260 | ENDIF |
---|
261 | if strpos(direc, 'z') NE -1 AND (nz NE 1 OR coupe NE 'xy') then BEGIN |
---|
262 | if strpos(!p.subtitle, '[') EQ -1 then $ |
---|
263 | !p.subtitle = depintf+'['+pr1+', '+pr2+']'+onf+'('+strtrim(nz, 1)+' points) !C'+!p.subtitle $ |
---|
264 | ELSE !p.subtitle = depintf+'['+pr1+', '+pr2+']'+onf+'('+strtrim(nz, 1)+' points) '+!p.subtitle |
---|
265 | ENDIF |
---|
266 | ENDIF |
---|
267 | if keyword_set(endpoints) AND coupe NE 'yt' AND lat1 NE lat2 then !p.title = !p.title+'!C!C' |
---|
268 | |
---|
269 | if keyword_set(key_performance) THEN print, 'temps legende', systime(1)-tempsun |
---|
270 | return |
---|
271 | end |
---|