;+ ; ; @file_comments ; Provide caption ; ; @categories ; Graphics ; ; @param MI {in}{required} ; The min of the drawing ; ; @param MA {in}{required} ; The max of the plot ; ; @param COUPE {type=string} ; Character containing two letters giving the type of the cut (for example: 'xz'). ; ; @keyword CONTOUR ; If we want to trace contours of a different field than the one ; whose we have the colored drawing (by example E-P in color and QSR in contours). ; It must be a field respecting same characteristics than the argument number one of plt. ; ; @keyword ENDPOINTS ; Used when we do vertical cuts in diagonal. ; ; @keyword _EXTRA ; Used to pass keywords ; ; @uses ; common ; ; @restrictions ; The use of the global variable language allows to change the language and the caption easily. ; ; @history ; Sebastien Masson (smasson\@lodyc.jussieu.fr) ; 14/8/98 ; Eric Guilyardi (ericg\@lodyc.jussieu.fr) GB version ; 11/6/99 ; ; @version ; $Id$ ; ;- PRO legende, mi, ma, coupe, CONTOUR=contour, ENDPOINTS=endpoints, DIREC=direc $ , VECTLEGENDE=vectlegende $ , INTERVALLE=intervalle, TYPE_YZ=type_yz, VARNAME2=varname2 $ , NPTS=npts, _EXTRA=ex ; compile_opt idl2, strictarrsubs ; @common tempsun = systime(1) ; pour key_performance ;------------------------------------------------------------ grille, -1, -1, -1, gdep, nx, ny, nz ; ; English legends ; fmt_mm = '(f12.2)' fmt_bt = '(f7.1)' colorf = '' contourf = 'Contour plot,' vecteurf = 'Vector norm ' expf = '' datef = ' ' fieldf = ' ' depthf = ' ' endpointsf = 'Diag. Section' zonalf = '' IF key_onearth THEN latintf = 'latitudes in ' ELSE latintf = 'j index in ' timintf = 'time in ' onf = ' - ' depthf2 = 'Depth (m)' Meridf = 'Zonal Mean ' IF key_onearth THEN lonintf = 'longitudes in ' ELSE lonintf = 'i in ' hovxt = 'XT-plot ' diaghovxt = 'Diag. XT-plot ' depintf = 'depths in ' timef = 'Time' hovyt = 'YT-plot ' diaghovyt = 'Diag. YT-plot ' hovzt = 'ZT-plot ' hovt = '' IF key_onearth THEN lontitle = 'Longitude' ELSE lontitle = 'i index' IF key_onearth THEN lattitle = 'Latitude' ELSE lattitle = 'j index' IF keyword_set(TYPE_YZ) THEN BEGIN vertz = type_yz legniv = ' '+type_yz ENDIF ELSE BEGIN vertz = depthf2 legniv = ' m' ENDELSE ; ; Start legende ; ;------------------------------------------------------------ ; definition and possible complement of !p.subtitle ;------------------------------------------------------------ if n_elements(varunit) ne 0 then unite = '('+varunit+')' else unite = '' !p.subtitle = colorf+unite+': Min= '+strtrim(string(format = fmt_mm, mi), 2)$ +', Max= '+strtrim(string(format = fmt_mm, ma), 2) if keyword_set(intervalle) then BEGIN if intervalle NE -1 then $ !p.subtitle = !p.subtitle+', Int= '+strtrim(string(format = fmt_mm, intervalle), 2) endif if size(contour, /type) EQ 8 then BEGIN ; it is a structure unite = '('+contour.(1)+')' !p.subtitle = !p.subtitle+'!C '+contourf+unite $ +': Min= '+strtrim(string(format = fmt_mm, contour.(0)[0]), 2)$ +', Max= '+strtrim(string(format = fmt_mm, contour.(0)[1]), 2) if contour.inter NE -1 then $ !p.subtitle = !p.subtitle+', Int= '+strtrim(string(format = fmt_mm, contour.inter), 2) ENDIF if size(vectlegende, /type) EQ 8 then begin unite = '('+vectlegende.(1)+')' !p.subtitle = !p.subtitle+'!C '+vecteurf+unite $ +': Min= '+strtrim(string(format = fmt_mm, vectlegende.(0)[0]), 2)$ +', Max= '+strtrim(string(format = fmt_mm, vectlegende.(0)[1]), 2) endif ;------------------------------------------------------------ ; Shapping of subdomain 's dimensions ;------------------------------------------------------------ la1 = strtrim(string(format = fmt_bt, lat1), 2) la2 = strtrim(string(format = fmt_bt, lat2), 2) lo1 = strtrim(string(format = fmt_bt, lon1), 2) lo2 = strtrim(string(format = fmt_bt, lon2), 2) pr1 = strtrim(string(format = fmt_bt, vert1), 2) pr2 = strtrim(string(format = fmt_bt, vert2), 2) ;------------------------------------------------------------ ; Management of the date ;------------------------------------------------------------ if n_elements(vardate) EQ 0 then vardate = '' if NOT keyword_set(direc) then direc = '' if strpos(direc, 't') NE -1 then begin svardate = strtrim(vairdate(time[0]), 1)+' - '+strtrim(vairdate(time[jpt-1]), 1) ENDIF ELSE svardate = vardate ;------------------------------------------------------------ ; case on the caes where the caption is applied ;------------------------------------------------------------ case coupe of 'xy':begin if strupcase(vargrid) EQ 'W' then firstz = firstzw $ ELSE firstz = firstzt if(strpos(direc, 'z') EQ -1 AND firstz NE 0) then BEGIN prof = strtrim(round(gdep[0]), 1) !p.title = expf+varexp+datef+svardate+fieldf+varname+depthf+prof+legniv ENDIF ELSE !p.title = expf+varexp+datef+svardate+fieldf+varname !x.title = lontitle !y.title = lattitle end 'xz':begin IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n = strtrim(ny, 1) IF long(n) LE 3 THEN zonalf = 'Section ' if keyword_set(endpoints) AND lat1 NE lat2 then $ !p.title = endpointsf+varexp+datef+svardate+fieldf+varname ELSE $ !p.title = zonalf+varexp+datef+svardate+fieldf+varname !x.title = lontitle if keyword_set(endpoints) AND lat1 EQ lat2 then BEGIN 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) ENDIF !y.title = vertz end 'yz':begin IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n = strtrim(nx, 1) IF long(n) LE 3 THEN meridf = '' if keyword_set(endpoints) AND lon1 NE lon2 then $ !p.title = endpointsf+varexp+datef+svardate+fieldf+varname ELSE $ !p.title = meridf+varexp+datef+svardate+fieldf+varname !y.title = vertz !x.title = lattitle if keyword_set(endpoints) AND lon1 EQ lon2 then BEGIN 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) ENDIF end 'xt':begin ; IF keyword_set(npts) THEN n = strtrim(npts, 1) if keyword_set(endpoints) AND lat1 NE lat2 then $ !p.title = diaghovxt+varexp+fieldf+varname ELSE $ !p.title = hovxt+varexp+fieldf+varname IF (time[(size(time))[0]-1] - time[0]) GE 10 THEN !y.title = timef !x.title = lontitle if keyword_set(endpoints) AND lat1 EQ lat2 then BEGIN 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) ENDIF end 'yt':begin ; IF keyword_set(npts) THEN n = strtrim(npts, 1) if keyword_set(endpoints) AND lon1 NE lon2 then $ !p.title = diaghovyt+varexp+fieldf+varname ELSE $ !p.title = hovyt+varexp+fieldf+varname IF (time[(size(time))[0]-1] - time[0]) GE 10 THEN !x.title = timef !y.title = lattitle if keyword_set(endpoints) AND lon1 EQ lon2 then BEGIN 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) ENDIF end 'zt':begin ; IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(nx*ny, 1) !p.title = hovzt+varexp+fieldf+varname !y.title = vertz IF (time[(size(time))[0]-1] - time[0]) GE 10 THEN !x.title = timef end 't':begin ; IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE BEGIN ; if keyword_set(integration3d) then n=strtrim(nx*ny*nz, 1) ELSE n=strtrim(nx*ny, 1) ; ENDELSE !p.title = hovt+varexp+fieldf+varname !y.title = varname IF (time[(size(time))[0]-1] - time[0]) GE 10 THEN !x.title = timef end 'x':begin ; IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(ny*nz, 1) if keyword_set(endpoints) AND lat1 NE lat2 then $ !p.title = endpointsf+varexp+datef+svardate+fieldf+varname ELSE $ !p.title = varexp+datef+svardate+fieldf+varname !x.title = lontitle if keyword_set(endpoints) AND lat1 EQ lat2 then BEGIN 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) ENDIF !y.title = varname end 'y':begin ; IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(nx*nz, 1) if keyword_set(endpoints) AND lon1 NE lon2 then $ !p.title = endpointsf+varexp+datef+svardate+fieldf+varname ELSE $ !p.title = varexp+datef+svardate+fieldf+varname !x.title = lattitle if keyword_set(endpoints) AND lon1 EQ lon2 then BEGIN 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) ENDIF !y.title = varname end 'z':begin IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n = strtrim(nx*ny, 1) !p.title = varexp+datef+svardate+fieldf+varname !y.title = vertz !x.title = varname end 'yfx': BEGIN IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n = strtrim(nx*ny*nz, 1) !p.title = varexp+datef+svardate+varunit !x.title = varname2 !y.title = varname END else: ENDCASE if keyword_set(direc) then BEGIN if strpos(direc, 'x') NE -1 then $ !p.subtitle = lonintf+'['+lo1+', '+lo2+']'+onf+'('+strtrim(nx, 1)+' points) !C' +!p.subtitle if strpos(direc, 'y') NE -1 then BEGIN if strpos(!p.subtitle, '[') EQ -1 then $ !p.subtitle = latintf+'['+la1+', '+la2+']'+onf+'('+strtrim(ny, 1)+' points) !C'+!p.subtitle $ ELSE !p.subtitle = latintf+'['+la1+', '+la2+']'+onf+'('+strtrim(ny, 1)+' points) '+!p.subtitle ENDIF if strpos(direc, 'z') NE -1 AND (nz NE 1 OR coupe NE 'xy') then BEGIN if strpos(!p.subtitle, '[') EQ -1 then $ !p.subtitle = depintf+'['+pr1+', '+pr2+']'+onf+'('+strtrim(nz, 1)+' points) !C'+!p.subtitle $ ELSE !p.subtitle = depintf+'['+pr1+', '+pr2+']'+onf+'('+strtrim(nz, 1)+' points) '+!p.subtitle ENDIF ENDIF if keyword_set(endpoints) AND coupe NE 'yt' AND lat1 NE lat2 then !p.title = !p.title+'!C!C' if keyword_set(key_performance) THEN print, 'temps legende', systime(1)-tempsun return end