source: trunk/SRC/ToBeReviewed/PLOTS/legende.pro @ 327

Last change on this file since 327 was 327, checked in by pinsard, 16 years ago

modification of headers : mainly blanks around = sign for keywords in declaration of function and pro

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.5 KB
Line 
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;-
45PRO legende, mi, ma, coupe, CONTOUR=contour, ENDPOINTS=endpoints, DIREC=direc $
46           , VECTLEGENDE=vectlegende $
47           , INTERVALLE=intervalle, TYPE_YZ=type_yz, VARNAME2=varname2 $
48           , NPTS=npts, _EXTRA=ex
49;
50  compile_opt idl2, strictarrsubs
51;
52@common
53  tempsun = systime(1)          ; pour key_performance
54;------------------------------------------------------------
55  grille, -1, -1, -1, gdep, nx, ny, nz
56;
57; English legends
58;
59  fmt_mm = '(f12.2)'
60  fmt_bt = '(f7.1)'
61  colorf = ''
62  contourf = 'Contour plot,'
63  vecteurf = 'Vector norm  '
64  expf = ''
65  datef = '   '
66  fieldf = '   '
67  depthf = '   '
68  endpointsf = 'Diag. Section'
69  zonalf = ''
70  IF key_onearth THEN latintf = 'latitudes in ' ELSE latintf = 'j index in '
71  timintf = 'time in '
72  onf = ' - '
73  depthf2 = 'Depth (m)'
74  Meridf = 'Zonal Mean  '
75  IF key_onearth THEN lonintf = 'longitudes in ' ELSE lonintf = 'i in '
76  hovxt = 'XT-plot   '
77  diaghovxt = 'Diag. XT-plot   '
78  depintf = 'depths in '
79  timef = 'Time'
80  hovyt = 'YT-plot   '
81  diaghovyt = 'Diag. YT-plot   '
82  hovzt = 'ZT-plot   '
83  hovt = ''
84  IF key_onearth THEN lontitle = 'Longitude' ELSE lontitle = 'i index'
85  IF key_onearth THEN lattitle = 'Latitude' ELSE lattitle = 'j index'
86
87  vertz = depthf2
88  legniv = ' m'
89  IF keyword_set(TYPE_YZ) THEN BEGIN
90    IF type_yz EQ 'hPa' THEN vertz = 'hPa'
91    IF type_yz EQ 'hPa' THEN legniv = ' hPa'
92  ENDIF
93;
94; Start legende
95;
96;------------------------------------------------------------
97; definition and possible complement of !p.subtitle
98;------------------------------------------------------------
99  if n_elements(varunit) ne 0 then unite = '('+varunit+')' else unite = ''
100  !p.subtitle = colorf+unite+': Min= '+strtrim(string(format = fmt_mm, mi), 2)$
101                +', Max= '+strtrim(string(format = fmt_mm, ma), 2)
102  if keyword_set(intervalle) then BEGIN
103    if intervalle NE -1 then $
104       !p.subtitle = !p.subtitle+', Int= '+strtrim(string(format = fmt_mm, intervalle), 2)
105  endif
106  if size(contour, /type) EQ 8 then BEGIN ; it is a structure
107    unite = '('+contour.(1)+')'
108    !p.subtitle = !p.subtitle+'!C '+contourf+unite $
109                  +': Min= '+strtrim(string(format = fmt_mm, contour.(0)[0]), 2)$
110                  +', Max= '+strtrim(string(format = fmt_mm, contour.(0)[1]), 2)
111    if contour.inter NE -1  then $
112       !p.subtitle = !p.subtitle+', Int= '+strtrim(string(format = fmt_mm, contour.inter), 2)
113  ENDIF
114  if size(vectlegende, /type) EQ 8  then begin
115    unite = '('+vectlegende.(1)+')'
116    !p.subtitle = !p.subtitle+'!C '+vecteurf+unite $
117                  +': Min= '+strtrim(string(format = fmt_mm, vectlegende.(0)[0]), 2)$
118                  +', Max= '+strtrim(string(format = fmt_mm, vectlegende.(0)[1]), 2)
119  endif
120;------------------------------------------------------------
121; Shapping of subdomain 's dimensions
122;------------------------------------------------------------
123  la1 = strtrim(string(format = fmt_bt, lat1), 2)
124  la2 = strtrim(string(format = fmt_bt, lat2), 2)
125  lo1 = strtrim(string(format = fmt_bt, lon1), 2)
126  lo2 = strtrim(string(format = fmt_bt, lon2), 2)
127  pr1 = strtrim(string(format = fmt_bt, vert1), 2)
128  pr2 = strtrim(string(format = fmt_bt, vert2), 2)
129;------------------------------------------------------------
130; Management of the date
131;------------------------------------------------------------
132  if n_elements(vardate) EQ 0 then vardate = ''
133  if NOT keyword_set(direc) then direc = ''
134  if strpos(direc, 't') NE -1 then begin
135    svardate = strtrim(vairdate(time[0]), 1)+' - '+strtrim(vairdate(time[jpt-1]), 1)
136  ENDIF ELSE svardate = vardate
137;------------------------------------------------------------
138; case on the caes where the caption is applied
139;------------------------------------------------------------
140  case coupe of
141    'xy':begin
142      if strupcase(vargrid) EQ 'W' then firstz = firstzw $
143      ELSE firstz = firstzt
144      if(strpos(direc, 'z') EQ -1 AND firstz NE 0) then BEGIN
145        prof = strtrim(round(gdep[0]), 1)
146        !p.title = expf+varexp+datef+svardate+fieldf+varname+depthf+prof+legniv
147      ENDIF ELSE !p.title = expf+varexp+datef+svardate+fieldf+varname
148      !x.title = lontitle
149      !y.title = lattitle
150    end
151
152    'xz':begin
153      IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n = strtrim(ny, 1)
154      IF long(n) LE 3 THEN zonalf = 'Section   '
155      if keyword_set(endpoints) AND lat1 NE lat2 then $
156         !p.title = endpointsf+varexp+datef+svardate+fieldf+varname ELSE $
157            !p.title = zonalf+varexp+datef+svardate+fieldf+varname
158      !x.title = lontitle
159      if keyword_set(endpoints) AND lat1 EQ lat2 then BEGIN
160        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)
161      ENDIF
162      !y.title = depthf2
163    end
164
165    'yz':begin
166      IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n = strtrim(nx, 1)
167      IF long(n) LE 3 THEN meridf = ''
168      if keyword_set(endpoints) AND lon1 NE lon2 then $
169         !p.title = endpointsf+varexp+datef+svardate+fieldf+varname ELSE $
170            !p.title = meridf+varexp+datef+svardate+fieldf+varname
171      !y.title = vertz
172      !x.title = lattitle
173      if keyword_set(endpoints) AND lon1 EQ lon2 then BEGIN
174        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)
175      ENDIF
176    end
177
178    'xt':begin
179;         IF keyword_set(npts) THEN n = strtrim(npts, 1)
180      if keyword_set(endpoints) AND lat1 NE lat2 then $
181         !p.title = diaghovxt+varexp+fieldf+varname ELSE $
182            !p.title  =     hovxt+varexp+fieldf+varname
183      IF (time[(size(time))[0]-1] - time[0]) GE 10 THEN !y.title = timef
184      !x.title = lontitle
185      if keyword_set(endpoints) AND lat1 EQ lat2 then BEGIN
186        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)
187      ENDIF
188    end
189
190    'yt':begin
191;         IF keyword_set(npts) THEN n = strtrim(npts, 1)
192      if keyword_set(endpoints) AND lon1 NE lon2 then $
193         !p.title = diaghovyt+varexp+fieldf+varname ELSE $
194            !p.title  =     hovyt+varexp+fieldf+varname
195      IF (time[(size(time))[0]-1] - time[0]) GE 10 THEN !x.title = timef
196      !y.title = lattitle
197      if keyword_set(endpoints) AND lon1 EQ lon2 then BEGIN
198        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)
199      ENDIF
200    end
201
202    'zt':begin
203;         IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(nx*ny, 1)
204      !p.title = hovzt+varexp+fieldf+varname
205      !y.title = depthf2
206      IF (time[(size(time))[0]-1] - time[0]) GE 10 THEN !x.title = timef
207    end
208    't':begin
209;         IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE BEGIN
210;            if keyword_set(integration3d) then n=strtrim(nx*ny*nz, 1) ELSE n=strtrim(nx*ny, 1)
211;         ENDELSE
212      !p.title = hovt+varexp+fieldf+varname
213      !y.title = varname
214      IF (time[(size(time))[0]-1] - time[0]) GE 10 THEN !x.title = timef
215    end
216    'x':begin
217;         IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(ny*nz, 1)
218      if keyword_set(endpoints) AND lat1 NE lat2 then $
219         !p.title = endpointsf+varexp+datef+svardate+fieldf+varname ELSE $
220            !p.title  =            varexp+datef+svardate+fieldf+varname
221      !x.title = lontitle
222      if keyword_set(endpoints) AND lat1 EQ lat2 then BEGIN
223        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)
224      ENDIF
225      !y.title = varname
226    end
227    'y':begin
228;         IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(nx*nz, 1)
229      if keyword_set(endpoints) AND lon1 NE lon2 then $
230         !p.title = endpointsf+varexp+datef+svardate+fieldf+varname ELSE $
231            !p.title  =            varexp+datef+svardate+fieldf+varname
232      !x.title = lattitle
233      if keyword_set(endpoints) AND lon1 EQ lon2 then BEGIN
234        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)
235      ENDIF
236      !y.title = varname
237    end
238    'z':begin
239      IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n = strtrim(nx*ny, 1)
240      !p.title = varexp+datef+svardate+fieldf+varname
241      !y.title = depthf2
242      !x.title = varname
243    end
244    'yfx': BEGIN
245      IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n = strtrim(nx*ny*nz, 1)
246      !p.title = varexp+datef+svardate+varunit
247      !x.title = varname2
248      !y.title = varname
249    END
250    else:
251  ENDCASE
252  if keyword_set(direc) then BEGIN
253    if strpos(direc, 'x') NE -1 then $
254       !p.subtitle = lonintf+'['+lo1+', '+lo2+']'+onf+'('+strtrim(nx, 1)+' points)  !C' +!p.subtitle
255    if strpos(direc, 'y') NE -1 then BEGIN
256      if strpos(!p.subtitle, '[') EQ -1 then $
257         !p.subtitle = latintf+'['+la1+', '+la2+']'+onf+'('+strtrim(ny, 1)+' points)  !C'+!p.subtitle $
258      ELSE !p.subtitle = latintf+'['+la1+', '+la2+']'+onf+'('+strtrim(ny, 1)+' points)  '+!p.subtitle
259    ENDIF
260    if strpos(direc, 'z') NE -1 AND (nz NE 1 OR coupe NE 'xy') then BEGIN
261      if strpos(!p.subtitle, '[') EQ -1 then $
262         !p.subtitle = depintf+'['+pr1+', '+pr2+']'+onf+'('+strtrim(nz, 1)+' points)  !C'+!p.subtitle $
263      ELSE !p.subtitle = depintf+'['+pr1+', '+pr2+']'+onf+'('+strtrim(nz, 1)+' points)  '+!p.subtitle
264    ENDIF
265  ENDIF
266  if keyword_set(endpoints) AND coupe NE 'yt' AND lat1 NE lat2 then !p.title = !p.title+'!C!C'
267
268  if keyword_set(key_performance) THEN print, 'temps legende', systime(1)-tempsun
269  return
270end
Note: See TracBrowser for help on using the repository browser.