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

Last change on this file since 327 was 327, checked in by pinsard, 17 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
RevLine 
[2]1;+
2;
[142]3; @file_comments
4; Provide caption
[2]5;
[142]6; @categories
[157]7; Graphics
[2]8;
[142]9; @param MI {in}{required}
10; The min of the drawing
[231]11;
[142]12; @param MA {in}{required}
13; The max of the plot
[2]14;
[163]15; @param COUPE {type=string}
16; Character containing two letters giving the type of the cut  (for example: 'xz').
[2]17;
[231]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).
[163]21; It must be a field respecting same characteristics than the argument number one of plt.
[2]22;
[142]23; @keyword ENDPOINTS
24; Used when we do vertical cuts in diagonal.
[2]25;
[142]26; @keyword _EXTRA
[231]27; Used to pass keywords
28;
[142]29; @uses
30; common.pro
[2]31;
[142]32; @restrictions
[163]33; The use of the global variable language allows to change the language and the caption easily.
[2]34;
[142]35; @history
[157]36;  Sebastien Masson (smasson\@lodyc.jussieu.fr)
[2]37;                       14/8/98
[157]38;                       Eric Guilyardi (ericg\@lodyc.jussieu.fr) GB version
[2]39;                       11/6/99
[142]40;
41; @version
42; $Id$
43;
[2]44;-
[327]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
[114]49;
50  compile_opt idl2, strictarrsubs
51;
[2]52@common
[152]53  tempsun = systime(1)          ; pour key_performance
[2]54;------------------------------------------------------------
[152]55  grille, -1, -1, -1, gdep, nx, ny, nz
[2]56;
57; English legends
58;
[152]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'
[231]86
[152]87  vertz = depthf2
88  legniv = ' m'
89  IF keyword_set(TYPE_YZ) THEN BEGIN
[231]90    IF type_yz EQ 'hPa' THEN vertz = 'hPa'
91    IF type_yz EQ 'hPa' THEN legniv = ' hPa'
92  ENDIF
[2]93;
94; Start legende
95;
96;------------------------------------------------------------
[142]97; definition and possible complement of !p.subtitle
[2]98;------------------------------------------------------------
[152]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
[231]106  if size(contour, /type) EQ 8 then BEGIN ; it is a structure
[152]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
[2]120;------------------------------------------------------------
[142]121; Shapping of subdomain 's dimensions
[231]122;------------------------------------------------------------
[152]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)
[2]129;------------------------------------------------------------
[142]130; Management of the date
[231]131;------------------------------------------------------------
[152]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
[2]137;------------------------------------------------------------
[142]138; case on the caes where the caption is applied
[231]139;------------------------------------------------------------
[152]140  case coupe of
[231]141    'xy':begin
[152]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
[2]151
[152]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
[231]159      if keyword_set(endpoints) AND lat1 EQ lat2 then BEGIN
[152]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
[2]164
[152]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
[231]173      if keyword_set(endpoints) AND lon1 EQ lon2 then BEGIN
[152]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
[2]177
[152]178    'xt':begin
[2]179;         IF keyword_set(npts) THEN n = strtrim(npts, 1)
[152]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
[231]185      if keyword_set(endpoints) AND lat1 EQ lat2 then BEGIN
[152]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
[2]189
[152]190    'yt':begin
[231]191;         IF keyword_set(npts) THEN n = strtrim(npts, 1)
[152]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
[231]197      if keyword_set(endpoints) AND lon1 EQ lon2 then BEGIN
[152]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
[2]201
[152]202    'zt':begin
[2]203;         IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(nx*ny, 1)
[152]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
[231]209;         IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE BEGIN
[2]210;            if keyword_set(integration3d) then n=strtrim(nx*ny*nz, 1) ELSE n=strtrim(nx*ny, 1)
[231]211;         ENDELSE
[152]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
[231]216    'x':begin
[2]217;         IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(ny*nz, 1)
[152]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
[231]222      if keyword_set(endpoints) AND lat1 EQ lat2 then BEGIN
[152]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
[231]227    'y':begin
[2]228;         IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(nx*nz, 1)
[152]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
[231]233      if keyword_set(endpoints) AND lon1 EQ lon2 then BEGIN
[152]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
[231]249    END
[152]250    else:
251  ENDCASE
252  if keyword_set(direc) then BEGIN
253    if strpos(direc, 'x') NE -1 then $
[2]254       !p.subtitle = lonintf+'['+lo1+', '+lo2+']'+onf+'('+strtrim(nx, 1)+' points)  !C' +!p.subtitle
[152]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
[231]260    if strpos(direc, 'z') NE -1 AND (nz NE 1 OR coupe NE 'xy') then BEGIN
[152]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'
[231]267
268  if keyword_set(key_performance) THEN print, 'temps legende', systime(1)-tempsun
[152]269  return
[2]270end
Note: See TracBrowser for help on using the repository browser.