;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ ;+ ; NAME:legende.pro ; ; PURPOSE:fournit les legendes ; ; CATEGORY:graph annexe ; ; CALLING SEQUENCE:legende, mi,ma,coupe,title,subtitle,xtitle,ytitle ; ; INPUTS:mi et ma: le max et le min du dessin (cf plt.pro et pltz.pro) ; coupe=caractere de 2 lettres donnant le type de coupe (par ex:'xz') ; ; KEYWORD PARAMETERS: ; ; TITRE: chaine de caracteres qui doit etre le titre du dessin. Par ; defaut le titre est le nom vairmer du champ ; ; ENDPOINTS:utilise qd on fait des coupes veticales en diagonale ; ; OUTPUTS:le titre, sous-titre,titre de x et titre de y ; ; COMMON BLOCKS: ; common.pro ; ; SIDE EFFECTS: l''utilisation de la variable globale langage permet ; de changer de langue ou de facon de legender facilement. On peut ; facilement personnaliser la chose en rajoutant un cas au case sur la ; valeur de langage. ; ; RESTRICTIONS: ; ; EXAMPLE: ; ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr) ; 14/8/98 ; Eric Guilyardi (ericg@lodyc.jussieu.fr) GB version ; 11/6/99 ;- ;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ pro legende,mi,ma,coupe,CONTOUR = contour,ENDPOINTS = endpoints, DIREC = direc $ , VECTLEGENDE = vectlegende $ , INTERVALLE = intervalle, YZ_TYPE = yz_type, VARNAME2 = varname2 $ , NPTS = npts, _EXTRA = ex @common tempsun = systime(1) ; pour key_performance ;------------------------------------------------------------ grille, mask, glam, gphi, gdep, nx, ny, nz & mask = 1 ; ; choose langage ; if n_elements(langage) EQ 0 then langage = 'non definit' CASE langage OF 'gb': BEGIN ; ; 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 = '' latintf = 'latitudes in ' timintf = 'time in ' onf = ' - ' depthf2 = 'Depth (m)' Meridf = 'Zonal Mean ' lonintf = 'longitudes in ' hovxt = 'XT-plot ' diaghovxt = 'Diag. XT-plot ' depintf = 'depths in ' timef = 'Time' hovyt = 'YT-plot ' diaghovyt = 'Diag. YT-plot ' hovzt = 'ZT-plot ' hovt = '' END ; ; Legendes en francais ; ELSE: BEGIN fmt_mm = '(f12.2)' fmt_bt = '(f7.1)' colorf = 'Champ en couleur ' contourf = 'Champ en trace noir ' vecteurf = 'Norme vecteur ' expf = 'exp: ' datef = ', date: ' fieldf = ', champ: ' depthf = ', profondeur: ' endpointsf = 'Diag. Section, exp: ' zonalf = 'Coupe Zonale, exp: ' latintf = 'latitude in ' timintf = 'time in ' onf = ' - ' depthf2 = 'Profondeur (m)' meridf = 'Coupe Meridienne, exp: ' lonintf = 'longitude in ' hovxt = 'Trace Longitude-Temps, exp: ' diaghovxt = 'Trace Diag. Longitude-Temps, exp: ' depintf = 'profondeur in ' timef = 'Temps' hovyt = 'Trace Latitude-Temps, exp: ' diaghovyt = 'Trace Diag. Latitude-Temps, exp: ' hovzt = 'Trace Profondeur-Temps, exp: ' hovt = 'Evolution Temporelle, exp: ' END ENDCASE vertz = depthf2 legniv = ' m' IF keyword_set(YZ_TYPE) THEN BEGIN IF yz_type EQ 'hPa' THEN vertz = 'hPa' IF yz_type EQ 'hPa' THEN legniv = ' hPa' ENDIF ; ; Start legende ; ;------------------------------------------------------------ ; definition et complement eventuelle de !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 ; c''est une 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 ;------------------------------------------------------------ ; mise en forme des dimensions du sous domaine ;------------------------------------------------------------ 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, prof1), 2) pr2=strtrim(string(format=fmt_bt, prof2), 2) ;------------------------------------------------------------ ; gestion de la 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 sur le cas auquel s''applique la legende ;------------------------------------------------------------ case coupe of 'xy':begin if strupcase(vargrid) EQ 'W' then gdep = gdepw ELSE gdep = gdept if n_elements(gdep) GE 2 then begin IF gdep[0] LT gdep[1] THEN niveautest = 1 ELSE niveautest = jpk ENDIF ELSE niveautest = 1 if niveau NE niveautest AND (strpos(direc, 'z') EQ -1 OR nz EQ 1) then BEGIN prof=strtrim(round(gdep[niveau-1]), 1) !p.title = expf+varexp+datef+svardate+fieldf+varname+depthf+prof+legniv ENDIF ELSE !p.title = expf+varexp+datef+svardate+fieldf+varname !x.title = 'Longitude' !y.title = 'Latitude' 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 = 'Longitude' if keyword_set(endpoints) AND lat1 EQ lat2 then !x.title = !x.title+' at '+strtrim(lataxe(0, 0, lat1), 1) !y.title = depthf2 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 = 'Latitude' if keyword_set(endpoints) AND lon1 EQ lon2 then !x.title = !x.title+' at '+strtrim(lonaxe(0, 0, lon1), 1) 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 = 'Longitude' if keyword_set(endpoints) AND lat1 EQ lat2 then !x.title = !x.title+' at '+strtrim(lataxe(0, 0, lat1), 1) 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 = 'Latitude' if keyword_set(endpoints) AND lon1 EQ lon2 then !x.title = !x.title+' at '+strtrim(lonaxe(0, 0, lon1), 1) 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 = depthf2 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 = 'Longitude' if keyword_set(endpoints) AND lat1 EQ lat2 then !x.title = !x.title+' at '+strtrim(lataxe(0, 0, lat1), 1) !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 = 'Latitude' if keyword_set(endpoints) AND lon1 EQ lon2 then !x.title = !x.title+' at '+strtrim(lonaxe(0, 0, lon1), 1) !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 = depthf2 !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