[2] | 1 | ;------------------------------------------------------------ |
---|
| 2 | ;------------------------------------------------------------ |
---|
| 3 | ;------------------------------------------------------------ |
---|
| 4 | ;+ |
---|
| 5 | ; NAME:legende.pro |
---|
| 6 | ; |
---|
| 7 | ; PURPOSE:fournit les legendes |
---|
| 8 | ; |
---|
| 9 | ; CATEGORY:graph annexe |
---|
| 10 | ; |
---|
| 11 | ; CALLING SEQUENCE:legende, mi,ma,coupe,title,subtitle,xtitle,ytitle |
---|
| 12 | ; |
---|
| 13 | ; INPUTS:mi et ma: le max et le min du dessin (cf plt.pro et pltz.pro) |
---|
| 14 | ; coupe=caractere de 2 lettres donnant le type de coupe (par ex:'xz') |
---|
| 15 | ; |
---|
| 16 | ; KEYWORD PARAMETERS: |
---|
| 17 | ; |
---|
| 18 | ; TITRE: chaine de caracteres qui doit etre le titre du dessin. Par |
---|
| 19 | ; defaut le titre est le nom vairmer du champ |
---|
| 20 | ; |
---|
| 21 | ; ENDPOINTS:utilise qd on fait des coupes veticales en diagonale |
---|
| 22 | ; |
---|
| 23 | ; OUTPUTS:le titre, sous-titre,titre de x et titre de y |
---|
| 24 | ; |
---|
| 25 | ; COMMON BLOCKS: |
---|
| 26 | ; common.pro |
---|
| 27 | ; |
---|
| 28 | ; SIDE EFFECTS: l''utilisation de la variable globale langage permet |
---|
| 29 | ; de changer de langue ou de facon de legender facilement. On peut |
---|
| 30 | ; facilement personnaliser la chose en rajoutant un cas au case sur la |
---|
| 31 | ; valeur de langage. |
---|
| 32 | ; |
---|
| 33 | ; RESTRICTIONS: |
---|
| 34 | ; |
---|
| 35 | ; EXAMPLE: |
---|
| 36 | ; |
---|
| 37 | ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr) |
---|
| 38 | ; 14/8/98 |
---|
| 39 | ; Eric Guilyardi (ericg@lodyc.jussieu.fr) GB version |
---|
| 40 | ; 11/6/99 |
---|
| 41 | ;- |
---|
| 42 | ;------------------------------------------------------------ |
---|
| 43 | ;------------------------------------------------------------ |
---|
| 44 | ;------------------------------------------------------------ |
---|
| 45 | pro legende,mi,ma,coupe,CONTOUR = contour,ENDPOINTS = endpoints, DIREC = direc $ |
---|
| 46 | , VECTLEGENDE = vectlegende $ |
---|
| 47 | , INTERVALLE = intervalle, YZ_TYPE = yz_type, VARNAME2 = varname2 $ |
---|
| 48 | , NPTS = npts, _EXTRA = ex |
---|
| 49 | @common |
---|
| 50 | tempsun = systime(1) ; pour key_performance |
---|
| 51 | ;------------------------------------------------------------ |
---|
| 52 | grille, mask, glam, gphi, gdep, nx, ny, nz & mask = 1 |
---|
| 53 | ; |
---|
| 54 | ; choose langage |
---|
| 55 | ; |
---|
| 56 | if n_elements(langage) EQ 0 then langage = 'non definit' |
---|
| 57 | CASE langage OF |
---|
| 58 | 'gb': BEGIN |
---|
| 59 | ; |
---|
| 60 | ; English legends |
---|
| 61 | ; |
---|
| 62 | fmt_mm = '(f12.2)' |
---|
| 63 | fmt_bt = '(f7.1)' |
---|
| 64 | colorf = '' |
---|
| 65 | contourf = 'Contour plot,' |
---|
| 66 | vecteurf = 'Vector norm ' |
---|
| 67 | expf = '' |
---|
| 68 | datef = ' ' |
---|
| 69 | fieldf = ' ' |
---|
| 70 | depthf = ' ' |
---|
| 71 | endpointsf = 'Diag. Section' |
---|
| 72 | zonalf = '' |
---|
| 73 | latintf = 'latitudes in ' |
---|
| 74 | timintf = 'time in ' |
---|
| 75 | onf = ' - ' |
---|
| 76 | depthf2 = 'Depth (m)' |
---|
| 77 | Meridf = 'Zonal Mean ' |
---|
| 78 | lonintf = 'longitudes in ' |
---|
| 79 | hovxt = 'XT-plot ' |
---|
| 80 | diaghovxt = 'Diag. XT-plot ' |
---|
| 81 | depintf = 'depths in ' |
---|
| 82 | timef = 'Time' |
---|
| 83 | hovyt = 'YT-plot ' |
---|
| 84 | diaghovyt = 'Diag. YT-plot ' |
---|
| 85 | hovzt = 'ZT-plot ' |
---|
| 86 | hovt = '' |
---|
| 87 | END |
---|
| 88 | ; |
---|
| 89 | ; Legendes en francais |
---|
| 90 | ; |
---|
| 91 | ELSE: BEGIN |
---|
| 92 | fmt_mm = '(f12.2)' |
---|
| 93 | fmt_bt = '(f7.1)' |
---|
| 94 | colorf = 'Champ en couleur ' |
---|
| 95 | contourf = 'Champ en trace noir ' |
---|
| 96 | vecteurf = 'Norme vecteur ' |
---|
| 97 | expf = 'exp: ' |
---|
| 98 | datef = ', date: ' |
---|
| 99 | fieldf = ', champ: ' |
---|
| 100 | depthf = ', profondeur: ' |
---|
| 101 | endpointsf = 'Diag. Section, exp: ' |
---|
| 102 | zonalf = 'Coupe Zonale, exp: ' |
---|
| 103 | latintf = 'latitude in ' |
---|
| 104 | timintf = 'time in ' |
---|
| 105 | onf = ' - ' |
---|
| 106 | depthf2 = 'Profondeur (m)' |
---|
| 107 | meridf = 'Coupe Meridienne, exp: ' |
---|
| 108 | lonintf = 'longitude in ' |
---|
| 109 | hovxt = 'Trace Longitude-Temps, exp: ' |
---|
| 110 | diaghovxt = 'Trace Diag. Longitude-Temps, exp: ' |
---|
| 111 | depintf = 'profondeur in ' |
---|
| 112 | timef = 'Temps' |
---|
| 113 | hovyt = 'Trace Latitude-Temps, exp: ' |
---|
| 114 | diaghovyt = 'Trace Diag. Latitude-Temps, exp: ' |
---|
| 115 | hovzt = 'Trace Profondeur-Temps, exp: ' |
---|
| 116 | hovt = 'Evolution Temporelle, exp: ' |
---|
| 117 | END |
---|
| 118 | |
---|
| 119 | ENDCASE |
---|
| 120 | vertz = depthf2 |
---|
| 121 | legniv = ' m' |
---|
| 122 | IF keyword_set(YZ_TYPE) THEN BEGIN |
---|
| 123 | IF yz_type EQ 'hPa' THEN vertz = 'hPa' |
---|
| 124 | IF yz_type EQ 'hPa' THEN legniv = ' hPa' |
---|
| 125 | ENDIF |
---|
| 126 | ; |
---|
| 127 | ; Start legende |
---|
| 128 | ; |
---|
| 129 | ;------------------------------------------------------------ |
---|
| 130 | ; definition et complement eventuelle de !p.subtitle |
---|
| 131 | ;------------------------------------------------------------ |
---|
| 132 | if n_elements(varunit) ne 0 then unite='('+varunit+')' else unite='' |
---|
| 133 | !p.subtitle=colorf+unite+': Min= '+strtrim(string(format=fmt_mm,mi), 2)$ |
---|
| 134 | +', Max= '+strtrim(string(format=fmt_mm,ma), 2) |
---|
| 135 | if keyword_set(intervalle) then BEGIN |
---|
| 136 | if intervalle NE -1 then $ |
---|
| 137 | !p.subtitle=!p.subtitle+', Int= '+strtrim(string(format=fmt_mm,intervalle), 2) |
---|
| 138 | endif |
---|
| 139 | if size(contour, /type) EQ 8 then BEGIN ; c''est une structure |
---|
| 140 | unite='('+contour.(1)+')' |
---|
| 141 | !p.subtitle=!p.subtitle+'!C '+contourf+unite $ |
---|
| 142 | +': Min= '+strtrim(string(format=fmt_mm,contour.(0)[0]), 2)$ |
---|
| 143 | +', Max= '+strtrim(string(format=fmt_mm,contour.(0)[1]), 2) |
---|
| 144 | if contour.inter NE -1 then $ |
---|
| 145 | !p.subtitle=!p.subtitle+', Int= '+strtrim(string(format=fmt_mm,contour.inter), 2) |
---|
| 146 | ENDIF |
---|
| 147 | if size(vectlegende, /type) EQ 8 then begin |
---|
| 148 | unite='('+vectlegende.(1)+')' |
---|
| 149 | !p.subtitle=!p.subtitle+'!C '+vecteurf+unite $ |
---|
| 150 | +': Min= '+strtrim(string(format=fmt_mm,vectlegende.(0)[0]), 2)$ |
---|
| 151 | +', Max= '+strtrim(string(format=fmt_mm,vectlegende.(0)[1]), 2) |
---|
| 152 | endif |
---|
| 153 | ;------------------------------------------------------------ |
---|
| 154 | ; mise en forme des dimensions du sous domaine |
---|
| 155 | ;------------------------------------------------------------ |
---|
| 156 | la1=strtrim(string(format=fmt_bt, lat1), 2) |
---|
| 157 | la2=strtrim(string(format=fmt_bt, lat2), 2) |
---|
| 158 | lo1=strtrim(string(format=fmt_bt, lon1), 2) |
---|
| 159 | lo2=strtrim(string(format=fmt_bt, lon2), 2) |
---|
| 160 | pr1=strtrim(string(format=fmt_bt, prof1), 2) |
---|
| 161 | pr2=strtrim(string(format=fmt_bt, prof2), 2) |
---|
| 162 | ;------------------------------------------------------------ |
---|
| 163 | ; gestion de la date |
---|
| 164 | ;------------------------------------------------------------ |
---|
| 165 | if n_elements(vardate) EQ 0 then vardate = '' |
---|
| 166 | if NOT keyword_set(direc) then direc = '' |
---|
| 167 | if strpos(direc, 't') NE -1 then begin |
---|
| 168 | svardate = strtrim(vairdate(time[0]), 1)+' - '+strtrim(vairdate(time[jpt-1]), 1) |
---|
| 169 | ENDIF ELSE svardate = vardate |
---|
| 170 | ;------------------------------------------------------------ |
---|
| 171 | ; case sur le cas auquel s''applique la legende |
---|
| 172 | ;------------------------------------------------------------ |
---|
| 173 | case coupe of |
---|
| 174 | 'xy':begin |
---|
| 175 | if strupcase(vargrid) EQ 'W' then gdep = gdepw ELSE gdep = gdept |
---|
| 176 | if n_elements(gdep) GE 2 then begin |
---|
| 177 | IF gdep[0] LT gdep[1] THEN niveautest = 1 ELSE niveautest = jpk |
---|
| 178 | ENDIF ELSE niveautest = 1 |
---|
| 179 | if niveau NE niveautest AND (strpos(direc, 'z') EQ -1 OR nz EQ 1) then BEGIN |
---|
| 180 | prof=strtrim(round(gdep[niveau-1]), 1) |
---|
| 181 | !p.title = expf+varexp+datef+svardate+fieldf+varname+depthf+prof+legniv |
---|
| 182 | ENDIF ELSE !p.title = expf+varexp+datef+svardate+fieldf+varname |
---|
| 183 | !x.title = 'Longitude' |
---|
| 184 | !y.title = 'Latitude' |
---|
| 185 | end |
---|
| 186 | |
---|
| 187 | 'xz':begin |
---|
| 188 | IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(ny, 1) |
---|
| 189 | IF long(n) LE 3 THEN zonalf = 'Section ' |
---|
| 190 | if keyword_set(endpoints) AND lat1 NE lat2 then $ |
---|
| 191 | !p.title = endpointsf+varexp+datef+svardate+fieldf+varname ELSE $ |
---|
| 192 | !p.title = zonalf+varexp+datef+svardate+fieldf+varname |
---|
| 193 | !x.title = 'Longitude' |
---|
| 194 | if keyword_set(endpoints) AND lat1 EQ lat2 then !x.title = !x.title+' at '+strtrim(lataxe(0, 0, lat1), 1) |
---|
| 195 | !y.title = depthf2 |
---|
| 196 | end |
---|
| 197 | |
---|
| 198 | 'yz':begin |
---|
| 199 | IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(nx, 1) |
---|
| 200 | IF long(n) LE 3 THEN meridf = '' |
---|
| 201 | if keyword_set(endpoints) AND lon1 NE lon2 then $ |
---|
| 202 | !p.title = endpointsf+varexp+datef+svardate+fieldf+varname ELSE $ |
---|
| 203 | !p.title = meridf+varexp+datef+svardate+fieldf+varname |
---|
| 204 | !y.title = vertz |
---|
| 205 | !x.title = 'Latitude' |
---|
| 206 | if keyword_set(endpoints) AND lon1 EQ lon2 then !x.title = !x.title+' at '+strtrim(lonaxe(0, 0, lon1), 1) |
---|
| 207 | end |
---|
| 208 | |
---|
| 209 | 'xt':begin |
---|
| 210 | ; IF keyword_set(npts) THEN n = strtrim(npts, 1) |
---|
| 211 | if keyword_set(endpoints) AND lat1 NE lat2 then $ |
---|
| 212 | !p.title = diaghovxt+varexp+fieldf+varname ELSE $ |
---|
| 213 | !p.title = hovxt+varexp+fieldf+varname |
---|
| 214 | IF (time[(size(time))[0]-1] - time[0]) GE 10 THEN !y.title = timef |
---|
| 215 | !x.title = 'Longitude' |
---|
| 216 | if keyword_set(endpoints) AND lat1 EQ lat2 then !x.title = !x.title+' at '+strtrim(lataxe(0, 0, lat1), 1) |
---|
| 217 | end |
---|
| 218 | |
---|
| 219 | 'yt':begin |
---|
| 220 | ; IF keyword_set(npts) THEN n = strtrim(npts, 1) |
---|
| 221 | if keyword_set(endpoints) AND lon1 NE lon2 then $ |
---|
| 222 | !p.title = diaghovyt+varexp+fieldf+varname ELSE $ |
---|
| 223 | !p.title = hovyt+varexp+fieldf+varname |
---|
| 224 | IF (time[(size(time))[0]-1] - time[0]) GE 10 THEN !x.title = timef |
---|
| 225 | !y.title = 'Latitude' |
---|
| 226 | if keyword_set(endpoints) AND lon1 EQ lon2 then !x.title = !x.title+' at '+strtrim(lonaxe(0, 0, lon1), 1) |
---|
| 227 | end |
---|
| 228 | |
---|
| 229 | 'zt':begin |
---|
| 230 | ; IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(nx*ny, 1) |
---|
| 231 | !p.title = hovzt+varexp+fieldf+varname |
---|
| 232 | !y.title = depthf2 |
---|
| 233 | IF (time[(size(time))[0]-1] - time[0]) GE 10 THEN !x.title = timef |
---|
| 234 | end |
---|
| 235 | 't':begin |
---|
| 236 | ; IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE BEGIN |
---|
| 237 | ; if keyword_set(integration3d) then n=strtrim(nx*ny*nz, 1) ELSE n=strtrim(nx*ny, 1) |
---|
| 238 | ; ENDELSE |
---|
| 239 | !p.title = hovt+varexp+fieldf+varname |
---|
| 240 | !y.title = varname |
---|
| 241 | IF (time[(size(time))[0]-1] - time[0]) GE 10 THEN !x.title = timef |
---|
| 242 | end |
---|
| 243 | 'x':begin |
---|
| 244 | ; IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(ny*nz, 1) |
---|
| 245 | if keyword_set(endpoints) AND lat1 NE lat2 then $ |
---|
| 246 | !p.title = endpointsf+varexp+datef+svardate+fieldf+varname ELSE $ |
---|
| 247 | !p.title = varexp+datef+svardate+fieldf+varname |
---|
| 248 | !x.title = 'Longitude' |
---|
| 249 | if keyword_set(endpoints) AND lat1 EQ lat2 then !x.title = !x.title+' at '+strtrim(lataxe(0, 0, lat1), 1) |
---|
| 250 | !y.title = varname |
---|
| 251 | end |
---|
| 252 | 'y':begin |
---|
| 253 | ; IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(nx*nz, 1) |
---|
| 254 | if keyword_set(endpoints) AND lon1 NE lon2 then $ |
---|
| 255 | !p.title = endpointsf+varexp+datef+svardate+fieldf+varname ELSE $ |
---|
| 256 | !p.title = varexp+datef+svardate+fieldf+varname |
---|
| 257 | !x.title = 'Latitude' |
---|
| 258 | if keyword_set(endpoints) AND lon1 EQ lon2 then !x.title = !x.title+' at '+strtrim(lonaxe(0, 0, lon1), 1) |
---|
| 259 | !y.title = varname |
---|
| 260 | end |
---|
| 261 | 'z':begin |
---|
| 262 | IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(nx*ny, 1) |
---|
| 263 | !p.title = varexp+datef+svardate+fieldf+varname |
---|
| 264 | !y.title = depthf2 |
---|
| 265 | !x.title = varname |
---|
| 266 | end |
---|
| 267 | 'yfx': BEGIN |
---|
| 268 | IF keyword_set(npts) THEN n = strtrim(npts, 1) ELSE n=strtrim(nx*ny*nz, 1) |
---|
| 269 | !p.title = varexp+datef+svardate+varunit |
---|
| 270 | !x.title = varname2 |
---|
| 271 | !y.title = varname |
---|
| 272 | END |
---|
| 273 | else: |
---|
| 274 | ENDCASE |
---|
| 275 | if keyword_set(direc) then BEGIN |
---|
| 276 | if strpos(direc, 'x') NE -1 then $ |
---|
| 277 | !p.subtitle = lonintf+'['+lo1+', '+lo2+']'+onf+'('+strtrim(nx, 1)+' points) !C' +!p.subtitle |
---|
| 278 | if strpos(direc, 'y') NE -1 then BEGIN |
---|
| 279 | if strpos(!p.subtitle, '[') EQ -1 then $ |
---|
| 280 | !p.subtitle = latintf+'['+la1+', '+la2+']'+onf+'('+strtrim(ny, 1)+' points) !C'+!p.subtitle $ |
---|
| 281 | ELSE !p.subtitle = latintf+'['+la1+', '+la2+']'+onf+'('+strtrim(ny, 1)+' points) '+!p.subtitle |
---|
| 282 | ENDIF |
---|
| 283 | if strpos(direc, 'z') NE -1 AND (nz NE 1 OR coupe NE 'xy') then BEGIN |
---|
| 284 | if strpos(!p.subtitle, '[') EQ -1 then $ |
---|
| 285 | !p.subtitle = depintf+'['+pr1+', '+pr2+']'+onf+'('+strtrim(nz, 1)+' points) !C'+!p.subtitle $ |
---|
| 286 | ELSE !p.subtitle = depintf+'['+pr1+', '+pr2+']'+onf+'('+strtrim(nz, 1)+' points) '+!p.subtitle |
---|
| 287 | ENDIF |
---|
| 288 | ENDIF |
---|
| 289 | if keyword_set(endpoints) AND coupe NE 'yt' AND lat1 NE lat2 then !p.title = !p.title+'!C!C' |
---|
| 290 | |
---|
| 291 | if keyword_set(key_performance) THEN print, 'temps legende', systime(1)-tempsun |
---|
| 292 | return |
---|
| 293 | end |
---|