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

Last change on this file since 344 was 344, checked in by smasson, 16 years ago

small improvements

  • 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  IF keyword_set(TYPE_YZ) THEN BEGIN
[344]88    vertz = type_yz
89    legniv = ' '+type_yz
90  ENDIF ELSE BEGIN
91    vertz = depthf2
92    legniv = ' m'
93  ENDELSE
[2]94;
95; Start legende
96;
97;------------------------------------------------------------
[142]98; definition and possible complement of !p.subtitle
[2]99;------------------------------------------------------------
[152]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
[231]107  if size(contour, /type) EQ 8 then BEGIN ; it is a structure
[152]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
[2]121;------------------------------------------------------------
[142]122; Shapping of subdomain 's dimensions
[231]123;------------------------------------------------------------
[152]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)
[2]130;------------------------------------------------------------
[142]131; Management of the date
[231]132;------------------------------------------------------------
[152]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
[2]138;------------------------------------------------------------
[142]139; case on the caes where the caption is applied
[231]140;------------------------------------------------------------
[152]141  case coupe of
[231]142    'xy':begin
[152]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
[2]152
[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
[231]160      if keyword_set(endpoints) AND lat1 EQ lat2 then BEGIN
[152]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
[344]163      !y.title = vertz
[152]164    end
[2]165
[152]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
[231]174      if keyword_set(endpoints) AND lon1 EQ lon2 then BEGIN
[152]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
[2]178
[152]179    'xt':begin
[2]180;         IF keyword_set(npts) THEN n = strtrim(npts, 1)
[152]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
[231]186      if keyword_set(endpoints) AND lat1 EQ lat2 then BEGIN
[152]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
[2]190
[152]191    'yt':begin
[231]192;         IF keyword_set(npts) THEN n = strtrim(npts, 1)
[152]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
[231]198      if keyword_set(endpoints) AND lon1 EQ lon2 then BEGIN
[152]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
[2]202
[152]203    'zt':begin
[2]204;         IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(nx*ny, 1)
[152]205      !p.title = hovzt+varexp+fieldf+varname
[344]206      !y.title = vertz
[152]207      IF (time[(size(time))[0]-1] - time[0]) GE 10 THEN !x.title = timef
208    end
209    't':begin
[231]210;         IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE BEGIN
[2]211;            if keyword_set(integration3d) then n=strtrim(nx*ny*nz, 1) ELSE n=strtrim(nx*ny, 1)
[231]212;         ENDELSE
[152]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
[231]217    'x':begin
[2]218;         IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(ny*nz, 1)
[152]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
[231]223      if keyword_set(endpoints) AND lat1 EQ lat2 then BEGIN
[152]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
[231]228    'y':begin
[2]229;         IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(nx*nz, 1)
[152]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
[231]234      if keyword_set(endpoints) AND lon1 EQ lon2 then BEGIN
[152]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
[344]242      !y.title = vertz
[152]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
[231]250    END
[152]251    else:
252  ENDCASE
253  if keyword_set(direc) then BEGIN
254    if strpos(direc, 'x') NE -1 then $
[2]255       !p.subtitle = lonintf+'['+lo1+', '+lo2+']'+onf+'('+strtrim(nx, 1)+' points)  !C' +!p.subtitle
[152]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
[231]261    if strpos(direc, 'z') NE -1 AND (nz NE 1 OR coupe NE 'xy') then BEGIN
[152]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'
[231]268
269  if keyword_set(key_performance) THEN print, 'temps legende', systime(1)-tempsun
[152]270  return
[2]271end
Note: See TracBrowser for help on using the repository browser.