Changeset 67
- Timestamp:
- 05/09/06 17:04:13 (18 years ago)
- Location:
- trunk
- Files:
-
- 60 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ToBeReviewed/PLOTS/DESSINE/plt.pro
r35 r67 18 18 ; champ: le champ dont on veut faire la carte horizontale champ 19 19 ; peut etre de 2 types: 20 ; 1) un tableau 2d ou 3d. Si le champ est un tableau 3d on en 21 ; extrait un tableau 2d au niveau stipule par l''utilisateur 22 ; qui repond a une question. 20 ; 1) an array. if needed, its mean along the z and t direction 21 ; will be automatically performed. 23 22 ; 2) une structure repondant aux critaire specifies par 24 23 ; litchamp.pro. cf. IDL> xhelp,'litchamp' … … 34 33 ; KEYWORD PARAMETERS: 35 34 ; 36 ; BO ITE:vecteur indiquant la zone geographique sur laquelle doit etre37 ; faite la coupe. Si BO ITEa :38 ; 1 element : l''extraction est faite sur [lon1, lon2, lat1, lat2, 0.,bo ite[0]]39 ; 2 elements: l''extraction est faite sur [lon1, lon2, lat1, lat2, bo ite[0],boite[1]]40 ; 4 elements: l''extraction est faite sur [Bo ite, 0, max([gdept, gdepw])]41 ; 5 elements: l''extraction est faite sur [Bo ite[0:3], 0, Boite[4]]42 ; 6 elements: l''extraction est faite sur Bo ite35 ; BOXZOOM:vecteur indiquant la zone geographique sur laquelle doit etre 36 ; faite la coupe. Si BOXZOOM a : 37 ; 1 element : l''extraction est faite sur [lon1, lon2, lat1, lat2, 0.,boxzoom[0]] 38 ; 2 elements: l''extraction est faite sur [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]] 39 ; 4 elements: l''extraction est faite sur [Boxzoom, 0, max([gdept, gdepw])] 40 ; 5 elements: l''extraction est faite sur [Boxzoom[0:3], 0, Boxzoom[4]] 41 ; 6 elements: l''extraction est faite sur Boxzoom 43 42 ; 44 43 ; Ou lon1, lon2,lat1,lat2 sont les variables globales 45 44 ; definies lors du dernier domdef! 46 45 ; 47 ; CARTE:Permet de dessiner les continents definits ds IDL. CARTE46 ; REALCONT:Permet de dessiner les continents definits ds IDL. REALCONT 48 47 ; peut prendre deux formes: 49 ; / CARTE: on dessine les continents a la place du mask50 ; CARTE=2 on dessine le contours des continents par48 ; /REALCONT: on dessine les continents a la place du mask 49 ; REALCONT=2 on dessine le contours des continents par 51 50 ; dessus le dessin masque (ceci permet de voir si le masque 52 51 ; correspond bien aux continents reels). … … 62 61 ; .5 et 1.5 cm 63 62 ; 63 ; COAST_COLOR: the color of the coastline. 64 ; defaut value is 0 => black 65 ; 66 ; COAST_THICK: the thickness of the coastline. 67 ; defaut value is 1 68 ; 64 69 ; /CONT_NOFILL: activer pour ne pas remplir les points masques 65 ; a la couleur c_cont mais pour les laisser en transparent! Rq 66 ; on trace qd meme le contour du mask de la couleur c_cote 70 ; pour les laisser en transparent! 71 ; Rq: on trace qd meme le contour du mask 72 ; 73 ; CONT_COLOR: the color of the continent. defaut value is 74 ; (!d.n_colors - 1) < 255 => white 67 75 ; 68 76 ; CONTINTERVALLE: lorsque CONTOUR est active, valeur d'un 69 ; intervalle entre deux isolignes traces par un trait ds la couleur70 ; c_lab. Il peut ainsi etre different de celui specifie par INTERVALLE77 ; intervalle entre deux isolignes traces par un trait. Il peut ainsi 78 ; etre different de celui specifie par INTERVALLE 71 79 ; qui, cas ce cas, ne controle que les isolignes coloriees en 72 80 ; couleurs. Si aucun min n''est specifie, on choisit un contour min qui va … … 81 89 ; CONTMAX: lorsque CONTOUR est active, valeur maximum que l''on 82 90 ; veut prendre en compte dans le trace des isolignes traces par un 83 ; trait de couleur c_lab. Par defaut on prend le max (sur les pts mer)91 ; trait. Par defaut on prend le max (sur les pts mer) 84 92 ; du tableau passe ds le mot cle CONTOUR. 85 93 ; 86 94 ; CONTMIN: lorsque CONTOUR est active, valeur minimum que l''on 87 95 ; veut prendre en compte dans le trace des isolignes traces par un 88 ; trait de couleur c_lab. Par defaut on prend le max (sur les pts mer)96 ; trait. Par defaut on prend le max (sur les pts mer) 89 97 ; du tableau passe ds le mot cle CONTOUR. 90 98 ; 91 99 ; CONTNLEVEL: lorsque CONTOUR est active, nombre de contours 92 ; trace par un trait de couleur c_laba dessiner (actif si100 ; trace par un trait a dessiner (actif si 93 101 ; CONTLABEL=0) par defaut =20. 94 102 ; … … 98 106 ; que l''argument numero 1 de plt 99 107 ; 100 ; GRI LLE:'U','T','V','W' ou 'F' pour specifer eventuellement la108 ; GRIDTYPE:'U','T','V','W' ou 'F' pour specifer eventuellement la 101 109 ; grille a laquelle est rattache le champ. Rq: il afaut mieux 102 110 ; utiliser ds ce cas une structure comme champ … … 108 116 ; INTERVALLE ne specifie que intervalle entre 2 isolignes coloriees en 109 117 ; couleur. Pour specifier l''intervalle entre 2 isolignes traces par un trait 110 ; de couleur c_labutiliser CONTINTERVALLE.118 ; utiliser CONTINTERVALLE. 111 119 ; 112 120 ; /INV: inverse le vecteur couleur utilise pour colorier le graphe … … 116 124 ; label correspondant aux cas n. cf label.pro 117 125 ; Rq: Qd CONTOUR est active, ne specifie le type de label que pour les 118 ; isolignes coloriees en couleur. Pour celles tracees par un trait de119 ; couleur c_lab utiliser CONTLABEL.126 ; isolignes coloriees en couleur. Pour celles tracees par un trait 127 ; utiliser CONTLABEL. 120 128 ; 121 129 ; /LANDSCAPE: oblige la feuille ou le fenetre a l''ecran a etre … … 142 150 ; IDL> plt, tab, /stereo,map=[-90,0,0] 143 151 ; 152 ; labmap: corresponds to label keywords of map_set. Defaut 153 ; definition is labmap=1 154 ; 155 ; 144 156 ; MAXIN: permet de specifier la valeur maximum que l''on veut 145 157 ; prendre en compte dans le trace des contours a l''aide d''un … … 162 174 ; les couleurs 163 175 ; 164 ; /NO COULEUR: activer si on veut juste les contours en noir et176 ; /NOFILL: activer si on veut juste les contours en noir et 165 177 ; blanc sur fond blanc 166 178 ; … … 222 234 ; defaut style=0. cf style.pro 223 235 ; 224 ; /TRANS: fait un postscript (active /post automatiquement) et l''imprime225 ; -si on le desire- sur un transparant226 ;227 236 ; UNLABSUR: entier n. specifant qu''on ne labelle qu''un 228 237 ; contour sur n. Par defaut unlabsur=2 … … 259 268 ; d'ouvrir plusieurs fenetres). par defaut on ouvre 'IDL0' 260 269 ; 261 ; Y SURX: rapport d'echelle entre y et x (par ex: =1 pour un repere270 ; YXASPECT: rapport d'echelle entre y et x (par ex: =1 pour un repere 262 271 ; orthonorme, =2 si l'axe des y est deux fois plus dilate que celui des x). 263 272 ; Par defaut on adapte pour occupe une grande partie de la feuille en sortie 264 273 ; postScript ou pour cree une fenetre pas trop etiree 274 ; 275 ; /ZEROMIDDLE: fo force the middle of the colorbar to be equal 276 ; to 0 (force max=max(abs([min,max])) and min=-max) 265 277 ; 266 278 ; COMMON BLOCKS: … … 281 293 ;------------------------------------------------------------ 282 294 ;------------------------------------------------------------ 283 pro plt,tab1, giventype,givenmin,givenmax,CARTE=carte,CONTOUR=contour $ 284 ,INTERVALLE=intervalle,INV=inv, GRILLE = grille, BOITE = boite $ 285 ,CONTINTERVALLE=contintervalle,LABEL=label,CONTLABEL=contlabel $ 286 ,STYLE=style,CONTMAX=contmax,CONTMIN=contmin,NLEVEL=nlevel,CONTNLEVEL=contnlevel $ 287 , VECTEUR=vecteur,MAP = map, MININ = minin, MAXIN = maxin $ 288 , CONT_NOFILL = cont_nofill, NIVEAUDESSIN = niveaudessin, NOTRI = notri $ 289 , DUPLICATE = duplicate, STRICTFILL = strictfill, OVERPLOT = overplot, _extra = ex 290 @common 291 ;-------------------------------------------------------------- 292 tempsun = systime(1) ; pour key_performance 295 pro plt, tab1, giventype, givenmin, givenmax, REALCONT = realcont, CONTOUR = contour $ 296 , INTERVALLE = intervalle, INV = inv, GRIDTYPE = gridtype, BOXZOOM = boxzoom $ 297 , CONTINTERVALLE = contintervalle, LABEL = label, CONTLABEL = contlabel $ 298 , STYLE = style, CONTMAX = contmax, CONTMIN = contmin, NLEVEL = nlevel, CONTNLEVEL = contnlevel $ 299 , VECTEUR = vecteur, MAP = map, MININ = minin, MAXIN = maxin $ 300 , CONT_NOFILL = cont_nofill $ 301 , USETRI = usetri, NOTRI = notri, MASKFILL = maskfill $ 302 , DUPLICATE = duplicate, STRICTFILL = strictfill, OVERPLOT = overplot $ 303 , DECIMATETRI = decimatetri, LABMAP = labmap, _extra = ex 304 ;--------------------------------------------------------- 305 ; include common 306 @cm_4mesh 307 @cm_4data 308 IF NOT keyword_set(key_forgetold) THEN BEGIN 309 @updatenew 310 @updatekwd 311 ENDIF 312 ;-------------------------------------------------------------- 313 tempsun = systime(1) ; pour key_performance 293 314 ;-------------------------------------------------------------- 294 315 ;-------------------------------------------------------------- … … 298 319 ; I1) verification du type de grille associe a tab1 299 320 ;-------------------------------------------------------------- 300 if keyword_set(grille) then vargrid = grille301 if keyword_set(vecteur) AND (NOT keyword_set(grille)) then BEGIN302 303 304 vargrid = xquestion('Quelle est la grille a laquelle le champ a tracer se rapporte?', 'T', /chkwidget)305 306 307 321 if keyword_set(gridtype) then vargrid = gridtype 322 if keyword_set(vecteur) AND (NOT keyword_set(gridtype)) then BEGIN 323 vargrid = litchamp(tab1, /grid) 324 if vargrid eq '' then BEGIN 325 vargrid = xquestion('What is the grid associated to the data to contour?', 'T', /chkwidget) 326 vargrid = strupcase(vargrid) 327 endif 328 ENDIF 308 329 ;-------------------------------------------------------------- 309 330 ; I2) lecture du champ et checkup. 310 331 ;-------------------------------------------------------------- 311 if keyword_set(boite) then oldboite = [lon1, lon2, lat1, lat2, prof1, prof2] 312 if n_elements(giventype) NE 0 then type = giventype 313 if n_elements(givenmin) NE 0 then min = givenmin 314 if n_elements(givenmax) NE 0 then max = givenmax 315 if n_elements(minin) NE 0 then min = minin 316 if n_elements(maxin) NE 0 then max = maxin 317 checktypeminmax, 'plt', TYPE = type, MIN = min, MAX = max 318 z2d = checkfield(tab1, 'plt', TYPE = type, BOITE = boite, DIREC = direc, VECTEUR = vecteur, _extra = ex) 319 if z2d[0] EQ -1 then BEGIN 320 if keyword_set(boite) then domdef, oldboite,GRILLE=vargrid 321 return 322 endif 332 if keyword_set(boxzoom) AND n_elements(contour) ne 4 then BEGIN 333 savedbox = 1b 334 saveboxparam, 'boxparam4plt.dat' 335 END 336 if n_elements(giventype) NE 0 then type = giventype 337 if n_elements(givenmin) NE 0 then min = givenmin 338 if n_elements(givenmax) NE 0 then max = givenmax 339 if n_elements(minin) NE 0 then min = minin 340 if n_elements(maxin) NE 0 then max = maxin 341 checktypeminmax, 'plt', TYPE = type, MIN = min, MAX = max, _extra = ex 342 z2d = checkfield(tab1, 'plt', TYPE = type, BOXZOOM = boxzoom, DIREC = direc, VECTEUR = vecteur, _extra = ex) 343 if z2d[0] EQ -1 then BEGIN 344 IF keyword_set(savedbox) THEN restoreboxparam, 'boxparam4plt.dat' 345 return 346 ENDIF 347 IF n_elements(usetri) EQ 0 THEN BEGIN 348 ; do we have holes in the triangulation? 349 holeintri = n_elements(triangles_list)/3 LT (jpi-1+keyword_set(key_periodic))*(jpj-1)*2 ; -> the triangulation must be used to draw the data 350 ; do we have a triangulation? 351 wehavetri = triangles_list[0] NE -1 ; -> the triangulation must be used to draw the continents 352 ; if we make a map, are we periodic and nx=jpi ? 353 CASE strupcase(vargrid) OF 354 'T':nx = nxt 355 'W':nx = nxt 356 'U':nx = nxu 357 'V':nx = nxv 358 'F':nx = nxf 359 ENDCASE 360 mapperio = keyword_set(map)*keyword_set(key_periodic)*(nx eq jpi) 361 usetri = (wehavetri*(wehavetri+holeintri+mapperio+keyword_set(key_irregular))) < 2 362 IF n_elements(notri) NE 0 THEN usetri = 0 > (2-notri) 363 ENDIF 323 364 ;-------------------------------------------------------------- 324 365 ; I3) reinitialisation. !p.,!x.,!y. 325 366 ; Rq: on ne reinitialise pas qd on rapelle plt en boucle pour utiliser contour 326 367 ;-------------------------------------------------------------- 327 if n_elements(contour) ne 4 AND NOT keyword_set(overplot) then reinitplt, /z,/invert368 if n_elements(contour) ne 4 AND NOT keyword_set(overplot) then reinitplt, /z, /invert 328 369 ;--------------------------------------------------------------- 329 370 ; I4) attribution du mask et des tableaux de longitude et latitude 330 371 ;--------------------------------------------------------------- 331 if keyword_set(niveaudessin) then niveau = niveaudessin 332 if n_elements(gdept) GE 2 then begin 333 IF gdept[0] LT gdept[1] THEN profond = niveau NE 1 ELSE profond = niveau NE jpk 334 ENDIF ELSE profond = niveau NE 1 335 if keyword_set(profond) then $ 336 ; si on fait un plt en profondeur, il faudra recalculer la 337 ; triangulation, ca ne sert donc a rien de calculer tri maintenant 338 ; (surtout que c''est assez couteux!) 339 grille, mask, glam, gphi, gdep, nx, ny,nz,premierx,premiery,premierz,dernierx, derniery $ 340 , dernierz, /forplt, _extra = ex ELSE $ 341 grille, mask, glam, gphi, gdep, nx, ny,nz,premierx,premiery,premierz,dernierx, derniery $ 342 , dernierz, TRI = tri, /forplt, _extra = ex 343 if keyword_set(notri) then tri = -1 344 if keyword_set(profond) AND triangles[0] EQ -1 then tri = -1 372 IF strupcase(vargrid) EQ 'W' THEN profond = firstzw NE 0 $ 373 ELSE profond = firstzt NE 0 374 ; do we need to extract now the triangulation that will be use for 375 ; contouring the data? 376 if keyword_set(profond) $ 377 OR (usetri EQ 0 AND (vargrid EQ 'T' OR vargrid EQ 'W')) $ 378 OR (usetri NE 2 AND (vargrid NE 'T' AND vargrid NE 'W')) THEN BEGIN 379 grille, mask, glam, gphi, gdep, nx, ny, nz $ 380 , firstx, firsty, firstz, lastx $ 381 , lasty, lastz, /forplt, _extra = ex 382 ENDIF ELSE BEGIN 383 grille, mask, glam, gphi, gdep, nx, ny, nz $ 384 , firstx, firsty, firstz, lastx, lasty $ 385 , lastz, TRI = trifield, /forplt, _extra = ex 386 ENDELSE 345 387 ;---------------------------------------------------------------------------- 346 388 ; I5 determination du mi:min et du ma:max de z2d ainsi que de max: max et 347 389 ; min: min pour le dessin. 348 390 ;----------------------------------------------------------------------------- 349 nan = total(finite(z2d,/nan)) < 1 391 masknan = finite(z2d) 392 nan = total(masknan) NE n_elements(z2d) 350 393 ; faudra-t-il faire un autoscale ??? 351 autoscale = testvar(var = min) EQ testvar(var = max) AND NOT keyword_set(intervalle) 352 determineminmax, z2d, mask, mi, ma, glam, gphi, MININ = min, MAXIN = max, nan = nan,INTERVALLE=intervalle 353 if z2d[0] EQ -1 THEN GOTO, sortie 394 autoscale = testvar(var = min) EQ testvar(var = max) AND NOT keyword_set(intervalle) 395 determineminmax, z2d, mask, mi, ma, glam, gphi, MININ = min, MAXIN = max $ 396 , nan = nan, INTERVALLE = intervalle, usetri = usetri, _extra = ex 397 if z2d[0] EQ -1 THEN GOTO, sortie 354 398 ; on fait un autoscale si besoin 355 399 if autoscale then autoscale, min, max, intervalle 356 400 ;-------------------------------------------------------------- 357 401 ;-------------------------------------------------------------- … … 359 403 ; eventuelle de la fenetre et de la page 360 404 ;-------------------------------------------------------------- 361 362 placedessin, 'plt', posfenetre, posbar $405 if n_elements(contour) NE 4 AND NOT keyword_set(overplot) THEN $ 406 placedessin, 'plt', posfenetre, posbar $ 363 407 , CONTOUR = contour, VECTEUR = vecteur, MAP = map, DIREC = direc, _extra = ex 364 408 ;-------------------------------------------------------------- … … 371 415 ; III1) choix des labels 372 416 ;----------------------------------------------------------- 373 if keyword_set(intervalle) AND NOT keyword_set(label) then label=1 374 if keyword_set(label) eq 0 then cas=0 else cas=label 375 label,cas,min,max,ncontour,level_z2d,NLEVEL=nlevel,INTERVALLE=intervalle, strictfill = strictfill 417 if keyword_set(intervalle) AND NOT keyword_set(label) then label = 1 418 if keyword_set(label) eq 0 then cas = 0 else cas = label 419 label, cas, min, max, ncontour, level_z2d, colnumb, NLEVEL = nlevel $ 420 , INTERVALLE = intervalle, strictfill = strictfill 376 421 ;-------------------------------------------------------------- 377 422 ; III2)choix de style 378 423 ;----------------------------------------------------------- 379 if not keyword_set(style) then style=0380 style,style,level_z2d,linestyle,thick381 if keyword_set(inv) then couleur=reverse(couleur)424 if not keyword_set(style) then style = 0 425 style, style, level_z2d, linestyle, thick 426 if keyword_set(inv) then colnumb = reverse(colnumb) 382 427 ;----------------------------------------------------------- 383 428 ; III3) definition des axes 384 429 ;---------------------------------------------------------- 385 if NOT keyword_set(overplot) THEN axe, 'xy', _EXTRA = ex 386 ; IF NOT(keyword_set(map)) then axe, 'xy' 430 if NOT keyword_set(overplot) THEN axe, 'xy', _EXTRA = ex 387 431 ;-------------------------------------------------------------- 388 432 ;-------------------------------------------------------------- … … 391 435 ;-------------------------------------------------------------- 392 436 ;-------------------------------------------------------------- 393 mask = mask[*, *,niveau-1-premierz] 394 if keyword_set(nan) then begin 395 notanumber = where(finite(z2d, /nan) EQ 1) 396 z2d[notanumber] = max 397 masknan = replicate(1, nx, ny) 398 masknan[notanumber] = 0 399 ENDIF ELSE masknan = 1 400 z2d = remplit(z2d,nite=(1+(vargrid NE 'T' AND vargrid NE 'W')+keyword_set(nan)) $ 401 *(1-keyword_set(cont_nofill)) $ 402 , mask = mask*masknan, _extra=ex) 403 if NOT keyword_set(strictfill) then z2d = min > z2d < max 404 ; 405 if vargrid EQ 'T' OR vargrid EQ 'W' then BEGIN 406 ; ds ce cas, le masque utilise pour le champ est le meme que celui 407 ; utilise pour la terre. 408 ; si on fait un dessin en profondeur ou qu''il y a des pts a nan on 409 ; redefinit une triangulation sur le zoom 410 if keyword_set(profond) OR keyword_set(nan) then BEGIN 411 if ( (testvar(var = tri))[0] NE -1 OR keyword_set(nan) ) $ 412 AND NOT keyword_set(notri) then BEGIN 413 IF keyword_set(cont_nofill) then BEGIN 414 if keyword_set(nan) then begin 415 tri = triangule(masknan, coinmonte = coinmontemask, coindescend = coindescendmask $ 416 , periodique = keyword_set(key_periodique)*(nx EQ jpi)) 417 ENDIF ELSE BEGIN 418 tri = definetri(nx, ny) 419 coinmontemask = -1 420 coindescendmask = -1 421 ENDELSE 422 ENDIF ELSE BEGIN 423 mask = temporary(masknan*mask) 424 tri = triangule(mask, coinmonte = coinmontemask, coindescend = coindescendmask $ 425 , periodique = keyword_set(key_periodique)*(nx EQ jpi)) 426 ENDELSE 427 ENDIF 428 indicezoommask = (lindgen(jpi, jpj))[premierx:dernierx, premiery:derniery] 429 ENDIF ELSE BEGIN 430 if keyword_set(cont_nofill) AND (testvar(var = tri))[0] NE -1 then BEGIN 431 tri = definetri(nx, ny) 432 coinmontemask = -1 433 coindescendmask = -1 434 endif 435 ENDELSE 436 glammsk = glam 437 gphimsk = gphi 438 ENDIF ELSE BEGIN 439 ; ds ce cas, le masque utilise pour le champ n''est pas le meme que celui 440 ; utilise pour la terre (grille T); 441 ; 437 ;-------------------------------------------------------------- 438 ; extrapolation des donnees sur les terres et seuillage 439 ;-------------------------------------------------------------- 440 if keyword_set(nan) then begin 441 z2d[where(masknan EQ 0)] = max 442 ENDIF ELSE masknan = 1 443 ; filling the mask values 444 ; we fill only masknan or we fill mask*masknan? 445 IF keyword_set(nan) AND keyword_set(cont_nofill) THEN $ 446 z2d = remplit(z2d, nite = 1+(vargrid NE 'T' AND vargrid NE 'W') $ 447 , mask = masknan, _extra = ex) $ 448 ELSE z2d = remplit(z2d, nite = (1 + (vargrid NE 'T' AND vargrid NE 'W') $ 449 + keyword_set(nan)) $ 450 *(1-keyword_set(cont_nofill)) $ 451 *(1-(n_elements(maskfill) NE 0)) $ 452 , mask = mask*masknan, _extra = ex) 453 IF keyword_set(strictfill) EQ 0 AND n_elements(maskfill) EQ 0 then $ 454 z2d = min > z2d < max 455 if n_elements(maskfill) NE 0 then BEGIN 456 z2d = temporary(z2d)*mask*masknan 457 if maskfill NE 0 then z2d = temporary(z2d) + maskfill*(1-mask*masknan) 458 ENDIF 459 ;---------------------------------------------------------- 460 ; check the mask and the triangulation according to the grid type and 461 ; nan values. 462 ;---------------------------------------------------------- 442 463 ; si on fait un dessin en profondeur on redefinit une triangulation 443 464 ; sur le zoom, cette triangulation sera utilisee pour tracer le … … 446 467 ; masque et correspondent bien au trous qu''il y a a cette nouvelle 447 468 ; profondeur. 448 if keyword_set(profond) AND (testvar(var = tri))[0] NE -1 then BEGIN 449 if keyword_set(cont_nofill) then BEGIN 450 tri = definetri(nx, ny) 451 coinmontemask = -1 452 coindescendmask = -1 453 ENDIF ELSE $ 454 tri = triangule(tmask[premierx:dernierx, premiery:derniery, niveau-1] $ 455 , coinmonte = coinmontemask, coindescend = coindescendmask $ 456 , periodique = keyword_set(key_periodique)*(nx EQ jpi)) 457 ENDIF 458 ; si on a des pts a nan, comme la grille du mask est differente de 459 ; celui du mask il faudra les tracer a part. on definit donc pour cela 460 ; trinan, coinmontenan, coindescendnan, indicezoomnan, xnan et ynan 461 ; qui permettront de tracer masknan independemment du mask terre. 462 ; Rq: on utilise xnan, ynan au lieu de glam et gphi car pour ces 2 463 ; derniers tableaux calcules par grille on a active /forplt donc leur 464 ; valeur sur les points terre est celle de glamt et gphit. 465 if keyword_set(nan) AND NOT keyword_set(notri) then BEGIN 466 trinan = triangule(1-masknan $ 467 , coinmonte = coinmontenan, coindescend = coindescendnan $ 468 , periodique = keyword_set(key_periodique)*(nx EQ jpi)) 469 indicezoomnan = (lindgen(jpi, jpj))[premierx:dernierx, premiery:derniery] 470 grille, rien, xnan, ynan 471 undefine, rien 472 ENDIF 473 ; decoupe terre: pour que le tarce des cotes soient propres on essaye de 474 ; prenddre des points en + pour la terre comme ca on ne voit pas le 469 if (keyword_set(profond) OR keyword_set(cont_nofill)) $ 470 AND ((usetri GE 1 AND (vargrid EQ 'T' OR vargrid EQ 'W')) $ 471 OR (usetri EQ 2 AND (vargrid NE 'T' AND vargrid NE 'W'))) then BEGIN 472 trifield = triangule(tmask[firstx:lastx, firsty:lasty, firstz] $ 473 , coinmonte = coinmontemask $ 474 , coindescend = coindescendmask $ 475 , keep_cont = cont_nofill, _extra = ex) 476 indicezoommask = (lindgen(jpi, jpj))[firstx:lastx, firsty:lasty] 477 ENDIF 478 ; triangulation for nan mask 479 if keyword_set(nan) then BEGIN 480 trinan = triangule(masknan, /keep_cont $ 481 , coinmonte = coinmontenan $ 482 , coindescend = coindescendnan) 483 indicezoomnan = (lindgen(jpi, jpj))[firstx:lastx, firsty:lasty] 484 ENDIF 485 ; IF n_elements(twin_corners_up) EQ 0 THEN coinmontemask = -1 ELSE coinmontemask = twin_corners_up 486 ; IF n_elements(twin_corners_dn) EQ 0 THEN coindescendmask = -1 ELSE coindescendmask = twin_corners_dn 487 if vargrid EQ 'T' OR vargrid EQ 'W' then BEGIN 488 glammsk = glam 489 gphimsk = gphi 490 ENDIF ELSE begin 491 ; decoupe terre: pour que le trace des cotes soit propre on essaye de 492 ; prendre des points en + pour la terre comme ca on ne voit pas le 475 493 ; decalage des grilles. c''est ce que fait decoupeterre. au passage on 476 494 ; redefinit trimsk. 477 decoupeterre, mask, glammsk, gphimsk, TRI = trimsk, indicezoom = indicezoommask $ 478 , coinmonte = coinmontemask, coindescend = coindescendmask, _EXTRA = ex 479 ENDELSE 495 decoupeterre, mask, glammsk, gphimsk, type = 'xy'$ 496 , TRI = trimsk, usetri = usetri, indicezoom = indicezoommask $ 497 , coinmonte = coinmontemask, coindescend = coindescendmask $ 498 , _EXTRA = ex 499 ENDELSE 480 500 ;------------------------------------------------------------ 481 501 ; IV1) choix du type de dessin 482 502 ;------------------------------------------------------------ 483 484 if keyword_set(map)then BEGIN503 typetrace = 'classique' 504 if keyword_set(map) AND key_onearth then BEGIN 485 505 ; appelle de mapset qd on veut faire des projections 486 487 488 489 490 491 492 493 494 495 496 ,limit = [lat1, lon1, lat2, lon2], /noborder497 498 if n_elements(tri) GE 2 then tri = ciseauxtri(tri, glam, gphi, _EXTRA = ex)499 if n_elements(trimsk) GE 2 then trimsk = ciseauxtri(trimsk,glammsk,gphimsk,_EXTRA=ex)500 501 trinan = ciseauxtri(trinan,xnan,ynan,_EXTRA=ex)502 503 504 506 IF n_elements(map) NE 3 THEN map = [0, ((lon1+lon2)/2.) MOD 360, 0] 507 typetrace = 'projection' 508 map_lat = map[0] 509 map_lon = map[1] 510 map_rot = map[2] 511 if chkstru(ex, 'TITLE') then begin 512 maptitre = ex.title 513 ex.title = '' 514 endif 515 map_set, map_lat, map_lon, map_rot, _extra = ex, position = posfenetre, /iso $ 516 , limit = [lat1, lon1, lat2, lon2], /noborder 517 if n_elements(maptitre) ne 0 then ex.title = maptitre 518 if n_elements(trifield) GE 2 then trifield = ciseauxtri(trifield, glam, gphi, _EXTRA = ex) 519 if n_elements(trimsk) GE 2 then trimsk = ciseauxtri(trimsk, glammsk, gphimsk, _EXTRA = ex) 520 if n_elements(trinan) GE 2 then BEGIN 521 trinan = ciseauxtri(trinan, glam, gphi, _EXTRA = ex) 522 if trinan[0] EQ -1 then undefine, trinan 523 endif 524 ENDIF ELSE BEGIN 505 525 ;pour que les axes de coordonees soient pris en compte 506 507 plot, [0], [0], xstyle = 5, ystyle = 5, title = '', subtitle = '', /noerase508 if keyword_set(key_periodique) then BEGIN526 if !x.type EQ 0 AND n_elements(contour) LE 4 then $ 527 plot, [0], [0], /nodata, xstyle = 5, ystyle = 5, title = '', subtitle = '', /noerase 528 if keyword_set(key_periodic) then BEGIN 509 529 ; ds ce cas la triangulation est refermee en x et couvre toute la 510 530 ; sphere. il faut dont la couper au niveau ou l''on coupe la sphere 511 531 ; pour faire le dessin 512 if n_elements(tri) GE 2 then tri = ciseauxtri(tri, glam, gphi, _EXTRA = ex)513 if n_elements(trimsk) GE 2 then trimsk = ciseauxtri(trimsk, glammsk, gphimsk,_EXTRA=ex)514 if n_elements(trinan) GE 2 then trinan = ciseauxtri(trinan,xnan,ynan,_EXTRA=ex)515 endif516 532 if n_elements(trifield) GE 2 then trifield = ciseauxtri(trifield, glam, gphi, _EXTRA = ex) 533 if n_elements(trimsk) GE 2 then trimsk = ciseauxtri(trimsk, glammsk, gphimsk, _EXTRA = ex) 534 if n_elements(trinan) GE 2 then trinan = ciseauxtri(trinan, glam, gphi, _EXTRA = ex) 535 ENDIF 536 endelse 517 537 ;------------------------------------------------------------ 518 538 ; IV2) coutours et coloriages 519 539 ;------------------------------------------------------------ 520 540 if keyword_set(duplicate) then BEGIN 521 541 ; pour marina uniquement ATTENTION C'EST TRES MAL CODE 522 lon = glam[*, 0] 523 decalage = max(lon)-min(lon)+(lon-shift(lon, 1))[n_elements(lon)-1] 524 !x.range[1] = !x.range[1]+(duplicate-1)*decalage 525 for i = 1,duplicate-1 do BEGIN 526 z2d = [z2d, z2d] 527 gphi = [gphi, gphi] 528 mask = [mask, mask] 529 gphimsk = [gphimsk, gphimsk] 530 glam = [glam, glam+i*decalage] 531 glammsk = [glammsk, glammsk] 532 ENDFOR 533 endif 534 pltbase, z2d,glam,gphi $ 535 , mask,glammsk,gphimsk,trichamp=tri,trimsk=trimsk, /forplt $ 536 , level_z2d, couleur, contour = contour, carte = carte $ 542 lon = glam[*, 0] 543 decalage = max(lon)-min(lon)+(lon-shift(lon, 1))[n_elements(lon)-1] 544 !x.range[1] = !x.range[1]+(duplicate-1)*decalage 545 for i = 1, duplicate-1 do BEGIN 546 z2d = [z2d, z2d] 547 gphi = [gphi, gphi] 548 mask = [mask, mask] 549 gphimsk = [gphimsk, gphimsk] 550 glam = [glam, glam+i*decalage] 551 glammsk = [glammsk, glammsk] 552 ENDFOR 553 endif 554 ; save, glam, gphi, trifield, file = 'tri.dat' 555 if keyword_set(decimatetri) then BEGIN 556 tempsdeux = systime(1) ; pour key_performance 557 IF n_elements(trimsk) EQ 0 THEN trimsk = trifield 558 Verts = transpose([[(temporary(glam))[*]], [(temporary(gphi))[*]] $ 559 , [(temporary(z2d))[*]]]) 560 Conn = [replicate(3, 1, n_elements(trifield)/3), trifield] 561 Result = mesh_decimate(temporary(verts), (temporary(Conn))[*] $ 562 , Connout, vertices = Vertsout $ 563 , percent_vertices = decimatetri) 564 connout = reform(connout, 4, n_elements(connout)/4, /over) 565 trifield = (temporary(connout))[1:3, *] 566 glam = reform(Vertsout[0, *]) 567 gphi = reform(Vertsout[1, *]) 568 z2d = reform(Vertsout[2, *]) 569 undefine, Vertsout 570 print, 'temps decimatetri', systime(1)-tempsdeux 571 ENDIF 572 pltbase, z2d, glam, gphi $ 573 , mask, glammsk, gphimsk, trichamp = trifield, trimsk = trimsk, /forplt $ 574 , level_z2d, colnumb, contour = contour, usetri = usetri, realcont = realcont $ 537 575 , overplot = keyword_set(overplot)+keyword_set(map) $ 538 , c_linestyle =linestyle,c_labels=1-(indgen(n_elements(level_z2d)) MOD 2) $539 , c_thick =thick, cont_nofill = cont_nofill, nan = nan $576 , c_linestyle = linestyle, c_labels = 1-(indgen(n_elements(level_z2d)) MOD 2) $ 577 , c_thick = thick, cont_nofill = cont_nofill, nan = nan $ 540 578 , coinmontemask = coinmontemask, coindescendmask = coindescendmask $ 541 579 , coinmontenan = coinmontenan, coindescendnan = coindescendnan $ 542 580 , indicezoommask = indicezoommask, indicezoomnan = indicezoomnan $ 543 , masknan = masknan, trinan = trinan, xnan = xnan, ynan = ynan,_extra = ex581 , masknan = masknan, trinan = trinan, _extra = ex 544 582 ;------------------------------------------------------------ 545 583 ; IV3) rappelle de plt en boucle qd contour est active 546 584 ;------------------------------------------------------------ 547 if n_elements(contour) eq 4 then BEGIN ; c''est la 2eme fois que je passe ds pltt 548 contour = {mietma:[mi, ma], unit:varunit, inter:intervalle} ; je renvoie le min, le max et l''unite 549 return 550 endif 551 if keyword_set(contour) THEN BEGIN 552 pourlegende = [1, 1, 1, 1] 553 oldattributs = saveatt() 554 oldcouleur = couleur 555 plt,contour,contmin,contmax,CONTOUR=pourlegende, /noerase, NOTRI = notri $ 556 ,INTERVALLE=contintervalle,LABEL=contlabel,STYLE=style $ 557 ,NLEVEL=contnlevel, DUPLICATE = duplicate, STRICTFILL = strictfill, _extra = ex 558 restoreatt, oldattributs 559 couleur = oldcouleur 560 ENDIF 585 if n_elements(contour) eq 4 then BEGIN ; c''est la 2eme fois que je passe ds pltt 586 contour = {mietma:[mi, ma], unit:varunit, inter:intervalle} ; je renvoie le min, le max et l''unite 587 return 588 endif 589 if keyword_set(contour) THEN BEGIN 590 pourlegende = [1, 1, 1, 1] 591 oldattributs = saveatt() 592 oldcolnumb = colnumb 593 plt, contour, contmin, contmax, CONTOUR = pourlegende, /NOERASE $ 594 , USETRI = usetri $ 595 , INTERVALLE = contintervalle, LABEL = contlabel, STYLE = style $ 596 , NLEVEL = contnlevel, DUPLICATE = duplicate, STRICTFILL = strictfill $ 597 , MASKFILL = maskfill, _extra = ex 598 restoreatt, oldattributs 599 colnumb = oldcolnumb 600 ENDIF 561 601 ;------------------------------------------------------------ 562 602 ;------------------------------------------------------------ … … 568 608 ; V1) ajout eventuel de vecteurs en surimpression 569 609 ;------------------------------------------------------------ 570 571 572 ajoutvect,vecteur,vectlegende, _extra = ex573 574 575 ; 576 610 if keyword_set(vecteur) then BEGIN 611 oldattributs = saveatt() 612 ajoutvect, vecteur, vectlegende, _extra = ex 613 restoreatt, oldattributs 614 ENDIF 615 ; 616 if keyword_set(overplot) then GOTO, fini 577 617 ;------------------------------------------------------------ 578 618 ; V2) Trace de la ligne de changement de date,l'equateur et 579 619 ; le meridien de greenwich, ... 580 620 ;------------------------------------------------------------ 581 if NOT keyword_set(map)then meridienparallele, 'xy'621 if NOT keyword_set(map) AND key_onearth then meridienparallele, 'xy' 582 622 ;------------------------------------------------------------ 583 623 ; V3) pour tracer les continents d'IDL 584 624 ;------------------------------------------------------------ 585 if keyword_set(carte) then BEGIN625 if keyword_set(realcont) then BEGIN 586 626 ; si noease est passe de _extra, on s''assure qu''il est a 1 627 if chkstru(ex, 'NOERASE') then begin 628 oldnoerase = ex.noerase 629 ex.noerase = 1 630 ENDIF 631 if chkstru(ex, 'coast_thick') then mlinethick = ex.coast_thick ELSE mlinethick = 1 632 if chkstru(ex, 'coast_color') then mcolor = ex.coast_color ELSE mcolor = 0 633 IF NOT keyword_set(map) THEN $ 634 map_set, 0, ((lon1+lon2)/2.) MOD 360, 0, position = posfenetre $ 635 , limit = [lat1, lon1, lat2, lon2], /NOERASE, /noborder, color = 0 $ 636 , _extra = ex 637 if realcont NE 2 AND NOT keyword_set(cont_nofill) then BEGIN 638 if chkstru(ex, 'cont_color') then cntcol = ex.coast_color $ 639 ELSE cntcol = (!d.n_colors - 1) < 255 640 map_continents, /fill_continents, color = cntcol, _extra = ex, /noerase 641 ENDIF 642 map_continents, /continents, color = mcolor, MLINETHICK = mlinethick, /noerase, _extra = ex 643 if chkstru(ex, 'NOERASE') THEN ex.noerase = oldnoerase 644 ENDIF 645 ;------------------------------------------------------------ 646 ; V4) legendes + affichage de celles-ci 647 ;------------------------------------------------------------ 648 legende, mi, ma, 'xy', CONTOUR = pourlegende, VECTLEGENDE = vectlegende, INTERVALLE = intervalle, DIREC = direc, _EXTRA = ex 649 if n_elements(ex) NE 0 then BEGIN 650 ; pour garder les axes du cadre en noir 651 if (where(tag_names(ex) EQ 'COLOR'))[0] NE -1 then ex.COLOR = coast_color 652 endif 653 ; 654 case typetrace of 655 'classique': $ 656 plot, [0], [0], /nodata, /noerase, color = 0, xstyle = 1, ystyle = 1, _extra = ex 657 'projection': BEGIN 587 658 if chkstru(ex, 'NOERASE') then begin 588 oldnoerase = ex.noerase 589 ex.noerase = 1 590 ENDIF 591 if chkstru(ex, 'cont_thick') then mlinethick = ex.cont_thick ELSE mlinethick = 1 592 IF NOT keyword_set(map) THEN $ 593 map_set,0,((lon1+lon2)/2.) MOD 360,0, _extra = ex, position = posfenetre $ 594 , limit =[lat1, lon1, lat2, lon2], /NOERASE, /noborder, color = 0 595 if carte NE 2 AND NOT keyword_set(cont_nofill) then $ 596 map_continents, /fill_continents, color = c_cont, _extra = ex, /noerase 597 map_continents, /continents, color = c_cote, MLINETHICK = mlinethick, /noerase, _extra = ex 598 if chkstru(ex, 'NOERASE') THEN ex.noerase = oldnoerase 599 ENDIF 600 ;------------------------------------------------------------ 601 ; V4) legendes + affichage de celles-ci 602 ;------------------------------------------------------------ 603 legende,mi,ma,'xy', CONTOUR = pourlegende, VECTLEGENDE = vectlegende, INTERVALLE = intervalle, DIREC = direc, _EXTRA = ex 604 if n_elements(ex) NE 0 then BEGIN 605 ; pour garder les axes du cadre en noir 606 if (where(tag_names(ex) EQ 'COLOR'))[0] NE -1 then ex.COLOR = c_cote 607 endif 608 ; 609 case typetrace of 610 'classique': $ 611 plot, [0], [0],/noerase,color=0,xtickformat='lonaxe',ytickformat='lataxe' $ 612 , xstyle = 1, ystyle = 1, _extra = ex 613 'projection': BEGIN 614 if chkstru(ex, 'NOERASE') then begin 615 oldnoerase = ex.noerase 616 ex.noerase = 1 617 endif 618 if chkstru(ex, 'SUBTITLE') then !p.subtitle = ex.SUBTITLE 619 if n_elements(maptitre) ne 0 then ex.title = maptitre 620 map_set, map_lat, map_lon, map_rot, _extra = ex, /iso, limit = [lat1, lon1, lat2, lon2]$ 621 , /NOERASE, /noborder, title = !p.title, color = 0 659 oldnoerase = ex.noerase 660 ex.noerase = 1 661 endif 662 if chkstru(ex, 'SUBTITLE') then !p.subtitle = ex.SUBTITLE 663 if n_elements(maptitre) ne 0 then ex.title = maptitre 664 map_set, map_lat, map_lon, map_rot, _extra = ex, /iso, limit = [lat1, lon1, lat2, lon2]$ 665 , /NOERASE, /noborder, title = !p.title, color = 0 622 666 ; map_proj_info, numproj, /current 623 667 ; map_proj_info, numproj, name = nomproj … … 626 670 ; OR nomproj EQ 'TransverseMercator' OR nomproj EQ 'MillerCylindrical' $ 627 671 ; OR nomproj EQ 'LambertConicEllipsoid' then map_grid, box_axes=1,latdel=10,londel=10 $ 628 ; ELSE map_grid, charsize = 0.75, /label,latalign = 1,lonalign = 1,latdel = 10,londel = 30 629 map_grid, charsize = 0.75, /label,latalign = 1,lonalign = 1,latdel = 10,londel = 30, color = 0, _extra = ex 630 if chkstru(ex, 'NOERASE') THEN ex.noerase = oldnoerase 631 end 632 endcase 672 ; ELSE map_grid, charsize = 0.75, /label,latalign = 1,lonalign 673 ; = 1,latdel = 10,londel = 30 674 IF n_elements(labmap) EQ 0 THEN labmap = 1 675 map_grid, charsize = 0.75, label = labmap, latalign = 1, lonalign = 1, latdel = 10, londel = 30, color = 0, _extra = ex 676 if chkstru(ex, 'NOERASE') THEN ex.noerase = oldnoerase 677 end 678 endcase 633 679 ;------------------------------------------------------------ 634 680 ; V5) barre de couleur 635 681 ;------------------------------------------------------------ 636 couleur = couleur[0:ncontour-1-keyword_set(strictfill)]637 barrecouleur, position=posbar,divisions=(ncontour-keyword_set(strictfill))/2,min=min$638 , max=max,discret=couleur,_extra = ex682 colnumb = colnumb[0:ncontour-1-keyword_set(strictfill)] 683 barrecouleur, colnumb, min, max, (ncontour-keyword_set(strictfill))/2 $ 684 , position = posbar, _extra = ex 639 685 ;------------------------------------------------------------ 640 686 ;------------------------------------------------------------ … … 643 689 ;------------------------------------------------------------ 644 690 fini: 645 terminedessin, _extra = ex 646 if keyword_set(vecteur) then grillechoice = [vargrid, 'T', 'U', 'V'] ELSE grillechoice = ['T', vargrid] 647 if keyword_set(oldboite) then domdef, oldboite, GRILLE = grillechoice 691 terminedessin, _extra = ex 648 692 ;------------------------------------------------------------ 649 693 ;------------------------------------------------------------ 650 694 sortie: 651 if keyword_set(key_performance) NE 0 THEN print, 'temps plt', systime(1)-tempsun 652 ;------------------------------------------------------------ 653 ;------------------------------------------------------------ 654 return 695 if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4plt.dat' 696 if keyword_set(key_performance) NE 0 THEN print, 'temps plt', systime(1)-tempsun 697 ;------------------------------------------------------------ 698 ;------------------------------------------------------------ 699 return 655 700 end 656 701 -
trunk/ToBeReviewed/PLOTS/DESSINE/pltbase.pro
r35 r67 39 39 ; contour du mask 40 40 ; 41 ; COAST_COLOR: the color of the coastline. 42 ; defaut value is 0 => black 43 ; 44 ; COAST_THICK: the thickness of the coastline. 45 ; defaut value is 1 46 ; 47 ; COLOR_C: to draw the contour in color instead of in black 48 ; with filling in color 49 ; 41 50 ; /CONT_NOFILL: activer pour ne pas remplir les points masques 42 ; a la couleur c_cont mais pour les laisser en transparent! Rq43 ; on trace qd meme le contour du mask de la couleur c_cote44 ; 45 ; CONT_ THICK: l''epaisseur du trait pour tracer les46 ; continents. par defaut c''est 1.51 ; pour les laisser en transparent! 52 ; Rq: on trace qd meme le contour du mask 53 ; 54 ; CONT_COLOR: the color of the continent. defaut value is 55 ; (!d.n_colors - 1) < 255 => white 47 56 ; 48 57 ; /DESSTRICHAMP: pour dessiner la triangulation qui est … … 69 78 ; 70 79 ; 71 ; /NO COULEUR: pour faire juste les isolignes80 ; /NOFILL: pour faire juste les isolignes 72 81 ; 73 82 ; /NOCONTOUR: pour faire juste les couleurs … … 106 115 ;------------------------------------------------------------ 107 116 ;------------------------------------------------------------ 108 PRO pltbase, z2d, x, y, mask,xm, ym, levels, colors,UNSUR2 = unsur2, CONTOUR = contour $ 109 , NOCONTOUR = nocontour, NOCOULEUR = nocouleur, TRICHAMP = trichamp, TRIMSK = trimsk $ 110 , CARTE = carte, NAN = nan $ 117 PRO pltbase, z2d, x, y, mask, xm, ym, levels, colors, UNSUR2 = unsur2, CONTOUR = contour $ 118 , NOCONTOUR = nocontour, NOFILL = nofill $ 119 , TRICHAMP = trichamp, TRIMSK = trimsk $ 120 , REALCONT = realcont, NAN = nan, usetri = usetri $ 111 121 , COLORTRICHAMP = colortrichamp, COLORTRIMASK = colortrimask $ 112 122 , COLORTRINAN = colortrinan $ 123 , COLORPOINTS = colorpoints, DRAWPOINTS = drawpoints $ 113 124 , TH_TRICHAMP = th_trichamp, TH_TRIMASK = th_trimask $ 114 125 , DESSTRICHAMP = desstrichamp, DESSTRIMASK = desstrimask $ 115 , DESSTRINAN = desstrinan $116 , I_COLORS = i_colors $117 , CONT_ THICK = cont_thick,CONT_NOFILL = cont_nofill, UNLABSUR = unlabsur $126 , DESSTRINAN = desstrinan, COLOR_C = color_c $ 127 , I_COLORS = i_colors, CONT_COLOR = CONT_COLOR $ 128 , CONT_NOFILL = cont_nofill, UNLABSUR = unlabsur $ 118 129 , COINMONTEMASK = coinmontemask, COINDESCENDMASK = coindescendmask $ 119 130 , COINMONTENAN = coinmontenan, COINDESCENDNAN = coindescendnan $ 120 131 , INDICEZOOMMASK = indicezoommask, INDICEZOOMNAN = indicezoomnan $ 121 , MASKNAN = masknan, TRINAN = trinan, XNAN = xnan, YNAN = ynan, FORPLT = forplt $ 122 , MORE = more, _EXTRA = ex 123 @common 132 , MASKNAN = masknan, TRINAN = trinan $ 133 , FORPLT = forplt, REALSECTION = realsection $ 134 , MORE = more, EXCHANGE_XY = exchange_xy $ 135 , _EXTRA = ex 136 ;--------------------------------------------------------- 137 @cm_4mesh 138 IF NOT keyword_set(key_forgetold) THEN BEGIN 139 @updatenew 140 @updatekwd 141 ENDIF 142 ;--------------------------------------------------------- 124 143 ; 125 144 ; explication concernant contour. Ce mot cle est active qd on on trace … … 132 151 ; 133 152 ;------------------------------------------------------------ 134 tempsun = systime(1) ; pour key_performance 135 if n_elements(masknan) EQ 0 then masknan = 1 153 tempsun = systime(1) ; pour key_performance 154 if n_elements(mask) EQ 0 then mask = 1b 155 if n_elements(masknan) EQ 0 then masknan = 1b 156 IF total(mask) EQ n_elements(z2d) THEN mask = 1b 136 157 ;---------------------------------------------------------------------- 137 158 ; si les niveaux et les couleurs ne sont pas donnes 138 159 ;---------------------------------------------------------------------- 139 if n_params() EQ 4 then BEGIN 140 label,0,min(z2d*mask),max(z2d*mask),ncontour,levels 141 colors = couleur 142 endif 160 if n_params() EQ 4 then $ 161 label, 0, min(z2d*mask), max(z2d*mask), ncontour, levels, colors 143 162 ; attention bidouille inexplicable pour que tout se passe bien avec les 144 163 ; postcript ds pltz!!! 145 146 plot, [0], [0], xstyle = 5, ystyle = 5, /noerase, title = '',subtitle = ''164 if n_elements(contour) LE 4 AND !x.type EQ 0 THEN $ 165 plot, [0], [0], xstyle = 5, ystyle = 5, /nodata, /noerase, title = '', subtitle = '' 147 166 ;---------------------------------------------------------------------- 148 167 ; si cell_fill fait partit de _extra, on le desactive si il n''est pas 149 168 ; egale a 2 150 169 ;---------------------------------------------------------------------- 151 IF chkstru(ex, 'CELL_FILL') THEN BEGIN 152 cell_fill = ex.CELL_FILL 153 if ex.CELL_FILL NE 2 then ex.CELL_FILL = 0 154 ENDIF ELSE cell_fill = 0 ; 155 ; do we use the triangulation?? 156 usetri = n_elements(trichamp) NE 0 AND (testvar(var = trichamp))[0] NE -1 170 IF chkstru(ex, 'CELL_FILL') THEN BEGIN 171 cell_fill = ex.CELL_FILL 172 if ex.CELL_FILL NE 2 then ex.CELL_FILL = 0 173 ENDIF ELSE cell_fill = 0 ; 157 174 ;---------------------------------------------------------------------- 158 175 ; I) remplissage des contours en palette de couleur 159 176 ;---------------------------------------------------------------------- 160 if NOT keyword_set(more) then more = 10 161 if NOT keyword_set(nocouleur) then begin 162 if n_elements(contour) NE 4 THEN BEGIN 163 if usetri then $ 164 contour,[z2d[*], fltarr(more)],[x[*], fltarr(more)],[y[*], fltarr(more)],levels=levels,c_color=colors,/noerase,/fill,/closed $ 165 ,TRIANGULATION=trichamp, _extra = ex $ 166 else $ 167 contour,z2d,x,y,levels=levels,c_color=colors,/noerase,/fill,/closed, _extra = ex 168 endif 169 endif 170 if n_elements(contour) NE 0 AND n_elements(contour) NE 4 THEN GOTO, fini 171 IF chkstru(ex, 'C_ORIENTATION') THEN ex = extractstru(ex, 'C_ORIENTATION') 172 IF chkstru(ex, 'C_SPACING') THEN ex = extractstru(ex, 'C_SPACING') 173 ;------------------------------------------------------------ 174 ; II) trace des contours en trait de couleur c_lab 175 ;------------------------------------------------------------ 176 if n_elements(contour) EQ 4 OR n_elements(contour) EQ 0 THEN BEGIN 177 if NOT keyword_set(more) then more = 10 178 if NOT keyword_set(nofill) AND NOT keyword_set(color_c) then begin 179 if n_elements(contour) NE 4 THEN BEGIN 180 if usetri EQ 2 then BEGIN 181 IF size(x, /n_dimensions) EQ 1 THEN x = x#replicate(1, (size(z2d))[2]) 182 IF size(y, /n_dimensions) EQ 1 THEN y = replicate(1, (size(z2d))[1])#y 183 contour, [z2d[*], fltarr(more)], [x[*], fltarr(more)] $ 184 , [y[*], fltarr(more)], levels = levels, c_color = colors $ 185 , /noerase, /fill, TRIANGULATION = trichamp, _extra = ex 186 ENDIF ELSE BEGIN 187 IF size(x, /n_dimensions) EQ 2 THEN x = x[*, 0] 188 IF size(y, /n_dimensions) EQ 2 THEN y = reform(y[0, *]) 189 contour, z2d, x, y, levels = levels, c_color = colors, /noerase $ 190 , /fill, _extra = ex 191 ENDELSE 192 ENDIF 193 ENDIF 194 if n_elements(contour) NE 0 AND n_elements(contour) NE 4 THEN GOTO, fini 195 IF chkstru(ex, 'C_ORIENTATION') THEN ex = extractstru(ex, 'C_ORIENTATION') 196 IF chkstru(ex, 'C_SPACING') THEN ex = extractstru(ex, 'C_SPACING') 197 IF chkstru(ex, 'C_COLORS') THEN ex = extractstru(ex, 'C_COLORS') 198 ;------------------------------------------------------------ 199 ; II) trace des contours en trait 200 ;------------------------------------------------------------ 201 if n_elements(contour) EQ 4 OR n_elements(contour) EQ 0 THEN BEGIN 202 ; 203 ; we put the masked values to NaN 204 ; 205 IF (n_elements(mask) GT 1 OR n_elements(masknan) GT 1) $ 206 AND NOT keyword_set(cont_nofill) THEN BEGIN 207 ; tonan = where((mask*masknan) EQ 0, count) 208 tonan = where(remplit(mask*masknan, nite = 1, mask = mask*masknan $ 209 , /basique, fillval = 0 $ 210 , fillxdir = keyword_set(realsection)) EQ 0, count) 211 IF count NE 0 THEN z2d[temporary(tonan)] = !values.f_nan 212 ENDIF 213 ; 177 214 ; on ne passe pas si on doit faire des contours differents... 178 215 ; ds le cas on unsur2 est active on reduit levels 179 180 216 if NOT keyword_set(nocontour) then begin 217 IF keyword_set(unsur2) THEN levels = levels(where(zeroun(n_elements(levels) ) eq 1)) 181 218 ; unlabsur est active? C_LABEL est passe via _EXTRA? 182 183 219 if keyword_set(unlabsur) THEN IF chkstru(ex, 'C_LABELS') THEN $ 220 ex.C_LABELS = 1-((indgen(n_elements(ex.C_LABELS)) MOD unlabsur) < 1) 184 221 ; 185 222 ; pour ne pas filler qd cell_fill est impose... 186 IF chkstru(ex, 'CELL_FILL') THEN ex.CELL_FILL = 0 187 IF chkstru(ex, 'C_COLORS') THEN ex = extractstru(ex, 'C_COLORS') 188 ; 189 if usetri then $ 190 contour, [z2d[*], fltarr(more)], [x[*], fltarr(more)],[y[*], fltarr(more)],levels=levels, overplot = 1-keyword_set(nocouleur) $ 191 ,noerase = keyword_set(nocouleur), c_color=c_lab*(1-keyword_set(i_colors))+testvar(var = i_colors),TRIANGULATION=trichamp, _extra = ex $ 192 else $ 193 contour, z2d, x,y,levels=levels, overplot = 1-keyword_set(nocouleur) $ 194 ,noerase = keyword_set(nocouleur), c_color=c_lab*(1-keyword_set(i_colors))+testvar(var = i_colors), _extra = ex 195 ; 196 endif 197 ; 198 if keyword_set(carte) then if carte EQ 1 then mask = 1 199 if n_elements(mask) NE 1 then BEGIN ; si mask=1 on saute. 200 ;---------------------------------------------------------------------- 201 ; III) remplissage des continents de couleur c_cont 202 ;---------------------------------------------------------------------- 203 if NOT keyword_set(cont_nofill) then BEGIN 204 IF chkstru(ex, 'CELL_FILL') THEN ex.CELL_FILL = cell_fill < 1 205 IF chkstru(ex, 'LEVELS') THEN ex = extractstru(ex, 'LEVELS') 206 if n_elements(trimsk) eq 0 and usetri then trimsk = trichamp 207 ; 208 usetri = n_elements(trimsk) NE 0 AND (testvar(var = trimsk))[0] NE -1 209 if usetri then BEGIN 210 if keyword_set(forplt) then $ 211 contour, -1*[mask[*], fltarr(more)], [xm[*], fltarr(more)], [ym[*], fltarr(more)], levels=-0.5, /overplot, /fill ,c_color=c_cont $ 212 ,TRIANGULATION=trimsk, _extra=ex ELSE $ 213 contour, -1*[(mask*masknan)[*], fltarr(more)], [xm[*], fltarr(more)], [ym[*], fltarr(more)], levels=-0.5, /overplot, /fill $ 214 ,c_color=c_cont,TRIANGULATION=trimsk, _extra=ex ; 215 completecointerre, coinmonte=coinmontemask, coindescend=coindescendmask $ 216 , indicezoom = indicezoommask, _extra = ex 217 ENDIF ELSE BEGIN 218 if keyword_set(forplt) then $ 219 contour, -1*mask, xm, ym, levels=-0.5, /overplot, /fill ,c_color=c_cont $ 220 , _extra=ex ELSE $ 221 contour, -1*(mask*masknan), xm, ym, levels=-0.5, /overplot, /fill $ 222 ,c_color=c_cont, _extra=ex ; 223 ENDELSE 224 ; 225 226 ; si il y a des points a nan et que le champ n''est pas sur la grille T 223 IF chkstru(ex, 'CELL_FILL') THEN ex.CELL_FILL = 0 224 ; 225 CASE 1 OF 226 keyword_set(color_c):c_colors = colors 227 keyword_set(i_colors):c_colors = i_colors 228 ELSE: 229 ENDCASE 230 ; 231 IF usetri EQ 2 THEN BEGIN 232 IF size(x, /n_dimensions) EQ 1 THEN x = x#replicate(1, (size(z2d))[2]) 233 IF size(y, /n_dimensions) EQ 1 THEN y = replicate(1, (size(z2d))[1])#y 234 contour, [z2d[*], fltarr(more)], [x[*], fltarr(more)] $ 235 , [y[*], fltarr(more)], levels = levels $ 236 , overplot = 1-keyword_set(nofill), noerase = keyword_set(nofill) $ 237 , c_colors = c_colors, TRIANGULATION = trichamp, _extra = ex 238 ENDIF ELSE BEGIN 239 IF size(x, /n_dimensions) EQ 2 THEN x = x[*, 0] 240 IF size(y, /n_dimensions) EQ 2 THEN y = reform(y[0, *]) 241 contour, z2d, x, y, levels = levels $ 242 , overplot = 1-keyword_set(nofill), noerase = keyword_set(nofill) $ 243 , c_colors = c_colors, _extra = ex 244 ENDELSE 245 ENDIF 246 ;---------------------------------------------------------------------- 247 ; III) remplissage des continents de couleur 248 ;---------------------------------------------------------------------- 249 IF chkstru(ex, 'CELL_FILL') THEN ex.CELL_FILL = cell_fill < 1 250 IF chkstru(ex, 'LEVELS') THEN ex = extractstru(ex, 'LEVELS') 251 IF chkstru(ex, 'NODATA') THEN ex = extractstru(ex, 'NODATA') 252 IF NOT keyword_set(cont_color) THEN cont_color = (!d.n_colors-1) < 255 253 ; 254 ; si il y a des points a nan 227 255 ; on trace en blanc les points a nan avant de dessiner les cotes avec 228 256 ; un trait. 229 if keyword_set(trinan) THEN BEGIN 230 contour, [-masknan[*], fltarr(more)],[xnan[*], fltarr(more)],[ynan[*], fltarr(more)],levels=-0.5,/overplot,/fill,c_color=c_cont $ 231 , TRIANGULATION=trinan, _extra = ex 232 completecointerre, coinmonte=coinmontenan, coindescend=coindescendnan $ 233 , indicezoom = indicezoomnan, _extra = ex 234 if keyword_set(desstrinan) then dessinetri, trinan, xnan, ynan, color = colortrinan 235 endif 236 endif 237 ;------------------------------------------------------------ 238 ; IV) trace les cotes en trait de couleur c_cote 239 ;------------------------------------------------------------ 257 ; 258 if keyword_set(trinan) THEN BEGIN 259 IF size(x, /n_dimensions) EQ 1 THEN x = x#replicate(1, (size(masknan))[2]) 260 IF size(y, /n_dimensions) EQ 1 THEN y = replicate(1, (size(masknan))[1])#y 261 contour, [1b-masknan[*], fltarr(more)], [x[*], fltarr(more)] $ 262 , [y[*], fltarr(more)], levels = 0.5, /overplot, /fill $ 263 , c_colors = cont_color, TRIANGULATION = trinan, _extra = ex 264 IF keyword_set(forplt) THEN $ 265 completecointerre, COINMONTE = coinmontenan $ 266 , COINDESCEND = coindescendnan, INDICEZOOM = indicezoomnan $ 267 , CONT_COLOR = cont_color, _EXTRA = ex $ 268 ELSE fillcornermask, x[*, 0], y[0, *], COINMONTE = coinmontenan $ 269 , COINDESCEND = coindescendnan, CONT_COLOR = cont_color, _extra = ex 270 ENDIF 271 ; 272 ; remplissage des continents 273 ; 274 if keyword_set(realcont) then if realcont EQ 1 then mask = 1b 275 if n_elements(mask) NE 1 then BEGIN ; si mask=1 on saute. 276 ; 277 if NOT keyword_set(cont_nofill) then BEGIN 278 ; 279 ; mask filling 280 ; 281 case 1 of 282 keyword_set(realsection):drawsectionbottom, mask, xm, ym $ 283 , CONT_NOFILL = cont_nofill, CONT_COLOR = cont_color, _EXTRA = ex 284 usetri GE 1:BEGIN 285 if n_elements(trimsk) eq 0 then trimsk = trichamp 286 IF size(xm, /N_DIMENSIONS) EQ 1 THEN xm = xm#replicate(1, (size(mask))[2]) 287 IF size(ym, /N_DIMENSIONS) EQ 1 THEN ym = replicate(1, (size(mask))[1])#ym 288 contour, [1b-mask[*], fltarr(more)], [xm[*], fltarr(more)] $ 289 , [ym[*], fltarr(more)], LEVELS = 0.5, /OVERPLOT, /FILL $ 290 , C_COLORS = cont_color, TRIANGULATION = trimsk, _extra = ex 291 IF keyword_set(forplt) THEN $ 292 completecointerre, COINMONTE = coinmontemask $ 293 , COINDESCEND = coindescendmask, INDICEZOOM = indicezoommask $ 294 , CONT_COLOR = cont_color, _EXTRA = ex $ 295 ELSE fillcornermask, xm[*, 0], ym[0, *], COINMONTE = coinmontemask $ 296 , COINDESCEND = coindescendmask, CONT_COLOR = cont_color, _extra = ex 297 END 298 ELSE:BEGIN 299 IF size(xm, /n_dimensions) EQ 2 THEN xm = xm[*, 0] 300 IF size(ym, /n_dimensions) EQ 2 THEN ym = reform(ym[0, *]) 301 contour, 1b-mask, xm, ym, LEVELS = 0.5, /OVERPLOT $ 302 , /FILL, C_COLORS = cont_color, _EXTRA = ex 303 END 304 ENDCASE 305 ENDIF ; NOT keyword_set(cont_nofill) 306 ;------------------------------------------------------------ 307 ; IV) trace les cotes en trait 308 ;------------------------------------------------------------ 309 case 1 of 310 keyword_set(realsection) AND NOT keyword_set(cont_nofill): 311 keyword_set(realsection) AND keyword_set(cont_nofill): $ 312 drawsectionbottom, mask, xm, ym $ 313 , CONT_NOFILL = cont_nofill, _extra = ex 314 (keyword_set(forplt) AND (!map.projection GT 0 OR key_irregular)) $ 315 OR keyword_set(nan):tracecote, _extra = ex 316 ELSE:tracemask, mask, xm, ym, _extra = ex 317 endcase ; 318 ENDIF ; n_elements(mask) NE 1 319 ENDIF 320 ;------------------------------------------------------------ 321 ; draw the triangulations 322 ;------------------------------------------------------------ 323 if keyword_set(desstrichamp) then $ 324 dessinetri, trichamp, x, y, color = colortrichamp, thick = th_trichamp 325 if keyword_set(desstrimask) then $ 326 dessinetri, trimsk, xm, ym, color = colortrimask, thick = th_trimask 327 if keyword_set(desstrinan) then $ 328 dessinetri, trinan, x, y, color = colortrinan 329 if keyword_set(drawpoints) then $ 330 tracegrille, x, y, color = colorpoints 331 ;------------------------------------------------------------ 332 ; 333 fini: 334 IF keyword_set(key_performance) THEN print, 'temps pltbase', systime(1)-tempsun 240 335 241 if NOT keyword_set(cont_thick) then cont_thick = 1 242 IF chkstru(ex, 'C_THICK') THEN ex.C_THICK = cont_thick 243 ; 244 if n_elements(key_stride) LE 2 then key_stride = [1, 1, 1] 245 key_stride = 1l > long(key_stride) 246 ; 247 if (keyword_set(forplt) AND (!map.projection GT 0 OR key_irregular)) $ 248 OR keyword_set(nan) then $ 249 tracecote, CONT_THICK = cont_thick, _extra = ex $ 250 ELSE tracemask, mask, xm, ym, CONT_THICK = cont_thick, _extra = ex 251 ; 252 endif 253 ENDIF 254 ;------------------------------------------------------------ 255 fini: 256 if keyword_set(desstrichamp) then dessinetri, trichamp, x, y, color = colortrichamp, thick = th_trichamp 257 if keyword_set(desstrimask) then dessinetri, trimsk, xm, ym, color = colortrimask, thick = th_trimask 258 IF keyword_set(key_performance) THEN print, 'temps pltbase', systime(1)-tempsun 259 260 return 336 return 261 337 end -
trunk/ToBeReviewed/PLOTS/DESSINE/pltt.pro
r35 r67 24 24 ; valmask) et type doit qd meme etre specifie pour qu''on 25 25 ; sache de quel trace il sagit. Pour avoir une legende 26 ; correcte, respecifier la zone d''extraction via BO ITE26 ; correcte, respecifier la zone d''extraction via BOXZOOM 27 27 ; * 1d: uniquement pour les traces de type 't'. Type doit qd 28 28 ; meme etre specifie pour qu''on sache de quel trace il 29 29 ; sagit. Pour avoir une legende correcte, respecifier la zone 30 ; d''extraction via BO ITE30 ; d''extraction via BOXZOOM 31 31 ; 2) une structure repondant aux critaire specifies par 32 32 ; litchamp.pro. cf. IDL> xhelp,'litchamp'. Le tableau contennu ds … … 53 53 ; KEYWORD PARAMETERS: 54 54 ; 55 ; BO ITE:vecteur indiquant la zone geographique (3d) sur laquelle doit55 ; BOXZOOM:vecteur indiquant la zone geographique (3d) sur laquelle doit 56 56 ; etre fait l''extraction du champ pour faire le hovmoeller. 57 ; Si BO ITEa :58 ; 1 element : l''extraction est faite sur [lon1, lon2, lat1, lat2, 0.,bo ite[0]]59 ; 2 elements: l''extraction est faite sur [lon1, lon2, lat1, lat2, bo ite[0],boite[1]]60 ; 4 elements: l''extraction est faite sur [Bo ite, prof1, prof2]61 ; 5 elements: l''extraction est faite sur [Bo ite[0:3], 0, Boite[4]]62 ; 6 elements: l''extraction est faite sur Bo ite63 ; 64 ; Ou lon1, lon2,lat1,lat2, prof1,prof2 sont les variables globales57 ; Si BOXZOOM a : 58 ; 1 element : l''extraction est faite sur [lon1, lon2, lat1, lat2, 0.,boxzoom[0]] 59 ; 2 elements: l''extraction est faite sur [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]] 60 ; 4 elements: l''extraction est faite sur [Boxzoom, vert1, vert2] 61 ; 5 elements: l''extraction est faite sur [Boxzoom[0:3], 0, Boxzoom[4]] 62 ; 6 elements: l''extraction est faite sur Boxzoom 63 ; 64 ; Ou lon1, lon2,lat1,lat2,vert1,vert2 sont les variables globales 65 65 ; definies lors du dernier domdef! 66 66 ; … … 71 71 ; CB_CHARSIZE: The character size of the color bar annotations 72 72 ; 73 ; COAST_COLOR: the color of the coastline. 74 ; defaut value is 0 => black 75 ; 76 ; COAST_THICK: the thickness of the coastline. 77 ; defaut value is 1 78 ; 79 ; /CONT_NOFILL: activer pour ne pas remplir les points masques 80 ; pour les laisser en transparent! 81 ; Rq: on trace qd meme le contour du mask 82 ; 83 ; CONT_COLOR: the color of the continent. defaut value is 84 ; (!d.n_colors - 1) < 255 => white 85 ; 73 86 ; CONTINTERVALLE: lorsque CONTOUR est active, valeur d''un 74 ; intervalle entre deux isolignes traces par un trait ds la couleur75 ; c_lab. Il peut ainsi etre different de celui specifie par INTERVALLE87 ; intervalle entre deux isolignes traces par un trait. Il peut ainsi 88 ; etre different de celui specifie par INTERVALLE 76 89 ; qui, cas ce cas, ne controle que les isolignes coloriees en 77 90 ; couleurs. Si aucun min n''est specifie, on choisit un contour min qui va … … 86 99 ; CONTMAX: lorsque CONTOUR est active, valeur maximum que l''on 87 100 ; veut prendre en compte dans le trace des isolignes traces par un 88 ; trait de couleur c_lab. Par defaut on prend le max (sur les pts mer)101 ; trait. Par defaut on prend le max (sur les pts mer) 89 102 ; du tableau passe ds le mot cle CONTOUR. 90 103 ; 91 104 ; CONTMIN: lorsque CONTOUR est active, valeur minimum que l''on 92 105 ; veut prendre en compte dans le trace des isolignes traces par un 93 ; trait de couleur c_lab. Par defaut on prend le max (sur les pts mer)106 ; trait. Par defaut on prend le max (sur les pts mer) 94 107 ; du tableau passe ds le mot cle CONTOUR. 95 108 ; 96 109 ; CONTNLEVEL: lorsque CONTOUR est active, nombre de contours 97 ; trace par un trait de couleur c_laba dessiner (actif si110 ; trace par un trait a dessiner (actif si 98 111 ; CONTLABEL=0) par defaut =20. 99 112 ; … … 118 131 ; INTERVALLE ne specifie que intervalle entre 2 isolignes coloriees en 119 132 ; couleur. Pour specifier l''intervalle entre 2 isolignes traces par un trait 120 ; de couleur c_labutiliser CONTINTERVALLE.133 ; utiliser CONTINTERVALLE. 121 134 ; 122 135 ; /INV: inverse le vecteur couleur utilise pour colorier le graphe … … 126 139 ; label correspondant aux cas n. cf label.pro 127 140 ; Rq: Qd CONTOUR est active, ne specifie le type de label que pour les 128 ; isolignes coloriees en couleur. Pour celles tracees par un trait de129 ; couleur c_lab utiliser CONTLABEL.141 ; isolignes coloriees en couleur. Pour celles tracees par un trait 142 ; utiliser CONTLABEL. 130 143 ; 131 144 ; /LANDSCAPE: oblige la feuille ou le fenetre a l''ecran a etre … … 162 175 ; les couleurs 163 176 ; 164 ; /NO COULEUR: activer si on veut juste les contours en noir et177 ; /NOFILL: activer si on veut juste les contours en noir et 165 178 ; blanc sur fond blanc 166 179 ; … … 246 259 ; d'ouvrir plusieurs fenetres). par defaut on ouvre 'IDL0' 247 260 ; 248 ; Y SURX: rapport d'echelle entre y et x. Par defaut=1261 ; YXASPECT: rapport d'echelle entre y et x. Par defaut=1 249 262 ; Par defaut on adapte pour occupe une grande partie de la feuille en sortie 250 263 ; postScript ou pour cree une fenetre pas trop etiree 264 ; 265 ; /ZEROMIDDLE: fo force the middle of the colorbar to be equal 266 ; to 0 (force max=max(abs([min,max])) and min=-max) 251 267 ; 252 268 ; COMMON BLOCKS: … … 277 293 ;------------------------------------------------------------ 278 294 ;------------------------------------------------------------ 279 pro pltt,tab,giventype,givenmin,givenmax,datmin,datmax,BO ITE = boite, CONTOUR=contour $295 pro pltt,tab,giventype,givenmin,givenmax,datmin,datmax,BOXZOOM = boxzoom, CONTOUR=contour $ 280 296 ,ENDPOINTS=endpoints,INTERVALLE=intervalle,INV=inv $ 281 297 ,CONTINTERVALLE=contintervalle,LABEL=label,CONTLABEL=contlabel $ 282 ,STYLE=style, CONTMAX=contmax , USETRI = usetri$298 ,STYLE=style, CONTMAX=contmax $ 283 299 ,CONTMIN=contmin,NLEVEL=nlevel,CONTNLEVEL=contnlevel $ 284 300 ,COL1D=col1d,STY1D=sty1d, MININ = minin, MAXIN = maxin $ 285 301 ,OV1D=ov1d, FILTER = filter, TREND_TYPE = trend_type $ 286 302 ,REPEAT_C = repeat_c, TYPEIN = typein, XT = XT, YT = YT, ZT = zt $ 287 , TT = tt, STRICTFILL = strictfill, OVERPLOT = overplot, EXCHANGE_XY = exchange_xy $ 303 , TT = tt, STRICTFILL = strictfill, OVERPLOT = overplot $ 304 , EXCHANGE_XY = exchange_xy $ 288 305 , _extra = ex 289 @common 306 ;--------------------------------------------------------- 307 ; include common 308 @cm_4mesh 309 @cm_4data 310 @cm_4cal 311 IF NOT keyword_set(key_forgetold) THEN BEGIN 312 @updatenew 313 @updatekwd 314 ENDIF 315 ;-------------------------------------------------------------- 290 316 ;------------------------------------------------------------ 291 317 tempsun = systime(1) ; pour key_performance … … 299 325 ; I1) lecture du champ 300 326 ;-------------------------------------------------------------- 301 if keyword_set(boite) then oldboite = [lon1, lon2, lat1, lat2, prof1, prof2] 327 if (keyword_set(boxzoom) OR keyword_set(endpoints)) $ 328 AND n_elements(contour) ne 4 THEN BEGIN 329 savedbox = 1b 330 saveboxparam, 'boxparam4pltt.dat' 331 ENDIF 302 332 if n_elements(giventype) NE 0 then type = giventype 303 333 if n_elements(givenmin) NE 0 then min = givenmin … … 311 341 endif 312 342 type = typein 313 endif 314 checktypeminmax, 'pltt', TYPE = type, MIN = min, MAX = max, XT = XT, YT = YT, ZT = zt, TT = tt, ENDPOINTS=endpoints, BOITE = boite, _extra = ex 343 ENDIF 344 ; 345 checktypeminmax, 'pltt', TYPE = type, MIN = min, MAX = max $ 346 , XT = XT, YT = YT, ZT = zt, TT = tt, ENDPOINTS = endpoints, _extra = ex 347 ; 315 348 if keyword_set(endpoints) then begin 316 section, tab, z2d, glam, gphi, ENDPOINTS = endpoints, TYPE = type, BOITE = boite, DIREC = direc 349 section, tab, z2d, glam, gphi, ENDPOINTS = endpoints, TYPE = type $ 350 , BOXZOOM = boxzoom, DIREC = direc 317 351 nx = n_elements(glam) 318 352 ny = nx 319 353 if strupcase(vargrid) EQ 'W' then begin 320 z = gdepw[ premierzw:dernierzw]354 z = gdepw[firstzw:lastzw] 321 355 nz = nzw 322 356 ENDIF ELSE BEGIN 323 z = gdept[ premierzt:dernierzt]357 z = gdept[firstzt:lastzt] 324 358 nz = nzt 325 359 ENDELSE 326 360 ENDIF ELSE BEGIN 327 z2d = checkfield(tab, 'pltt', TYPE = type, BOITE = boite, direc = direc, _extra = ex) 361 z2d = checkfield(tab, 'pltt', TYPE = type, BOXZOOM = boxzoom $ 362 , direc = direc, _extra = ex) 328 363 if z2d[0] EQ -1 then BEGIN 329 if keyword_set(boite) AND n_elements(oldboite) NE 0 then domdef, oldboite,GRILLE=vargrid330 364 IF keyword_set(savedbox) THEN restoreboxparam, 'boxparam4pltt.dat' 365 return 331 366 endif 332 367 grille, mask, glam, gphi, gdep, nx, ny,nz … … 371 406 ENDIF 372 407 373 374 408 ;--------------------------------------------------------------- 375 409 ; selection du type de graphique. … … 377 411 taille=size(z2d) 378 412 case taille[0] of 379 2 : begin 380 niveau=1 381 typdes='2d' 382 end 413 2 : typdes='2d' 383 414 1 : begin 384 415 z1d=z2d … … 401 432 ; on construit le mask pour cela le tableau doit etre masque (fait 402 433 ; automatiquement a la valeur valmask si on passe ds moyenne ou grossemoyenne) 403 mask = fltarr(taille[1], taille[2])404 434 nan = total(finite(z2d,/nan)) < 1 405 435 if n_elements(valmask) EQ 0 then valmask = 1e20 … … 407 437 notanum = where(finite(z2d) EQ 0) 408 438 z2d[notanum] = 0. 409 mask (where(z2d LT valmask/10.)) = 1439 mask = z2d LT valmask/10. 410 440 z2d[notanum] = !values.f_nan 411 ENDIF ELSE mask (where(z2d LT valmask/10)) = 1441 ENDIF ELSE mask = z2d LT valmask/10. 412 442 ;---------------------------------------------------------------------------- 413 443 ; determination du mi:min et du ma:max de z2d ainsi que de max: max et … … 416 446 ; faudra-t-il faire un autoscale ??? 417 447 autoscale = testvar(var = min) EQ testvar(var = max) AND NOT keyword_set(intervalle) 418 determineminmax, z2d, mask, mi, ma, MININ = min, MAXIN = max, nan = nan, INTERVALLE = intervalle 448 determineminmax, z2d, mask, mi, ma, MININ = min, MAXIN = max, nan = nan, INTERVALLE = intervalle, _extra = ex 419 449 if z2d[0] EQ -1 THEN return 420 450 ; on fait un autoscale si besoin … … 505 535 if keyword_set(intervalle) AND NOT keyword_set(label) then label=1 506 536 if keyword_set(label) eq 0 then cas=0 else cas=label 507 label,cas,min,max,ncontour,level_z2d,NLEVEL=nlevel,INTERVALLE=intervalle, strictfill = strictfill 537 label, cas, min, max, ncontour, level_z2d, colnumb, NLEVEL = nlevel $ 538 , INTERVALLE = intervalle, strictfill = strictfill 508 539 ;-------------------------------------------------------------- 509 540 ; choix de style … … 511 542 if not keyword_set(style) then style=0 512 543 style,style,level_z2d,linestyle,thick 513 if keyword_set(inv) then co uleur=reverse(couleur)544 if keyword_set(inv) then colnumb=reverse(colnumb) 514 545 ;---------------------------------------------------------------------- 515 546 nby = n_elements(yy) 516 547 nbx = n_elements(xx) 517 xx = xx#replicate(1, nby) ; on passe les axes en tableaux 2d 518 yy = replicate(1, nbx)#yy 519 ; 520 if keyword_set(nan) then begin 521 notanumber = where(finite(z2d, /nan) EQ 1) 522 z2d[notanumber] = max 523 case type of 524 'xt':masknan = replicate(1, nx, jpt) 525 'yt':masknan = replicate(1, ny, jpt) 526 'zt':masknan = replicate(1, nz, jpt) 527 endcase 528 masknan[notanumber] = 0 529 ENDIF ELSE masknan = 1 530 z2d = remplit(z2d,nite=2+keyword_set(nan), mask = mask*masknan, /basique, _extra=ex) 548 ; 549 if keyword_set(nan) then BEGIN 550 ; xx = xx#replicate(1, nby) ; on passe les axes en tableaux 2d 551 ; yy = replicate(1, nbx)#yy 552 masknan = finite(z2d) 553 z2d[where(masknan EQ 0)] = max 554 mask = temporary(mask)*temporary(masknan) 555 ENDIF 556 z2d = remplit(z2d,nite=2+keyword_set(nan), mask = mask, /basique, _extra=ex) 531 557 if NOT keyword_set(strictfill) then z2d = min > z2d < max 532 if NOT keyword_set(usetri) then triangulation = -1 ELSE $ 533 triangulation = triangule(mask*masknan,/regulier,coinmonte=coinmontemask,coindescend=coindescendmask) 534 ; 558 if keyword_set(nan) then $ 559 triangulation = triangule(mask,/basic,coinmonte=coinmontemask $ 560 ,coindescend=coindescendmask) $ 561 ELSE triangulation = -1 535 562 ;---------------------------------------------------------------------- 536 pltbase,z2d, xx, yy, mask,xx, yy, level_z2d,co uleur, contour = contour,/noerase $563 pltbase,z2d, xx, yy, mask,xx, yy, level_z2d,colnumb, contour = contour,/noerase $ 537 564 , c_linestyle=linestyle,c_labels=1-(indgen(n_elements(level_z2d)) MOD 2) $ 538 565 , trichamp = triangulation, trimsk = triangulation, overplot = overplot $ 539 , c_thick=thick, performance = key_performance $540 , coinmontemask= -1, coindescendmask=-1, masknan = masknan, _extra = ex566 , c_thick=thick, performance = key_performance, usetri = keyword_set(nan) $ 567 , coinmontemask=coinmontemask, coindescendmask=coindescendmask, _extra = ex 541 568 ;------------------------------------------------------------ 542 569 if n_elements(contour) eq 4 then BEGIN ; c''est la 2eme fois que je passe ds pltt … … 548 575 pourlegende = [1, 1, 1, 1] 549 576 oldattributs = saveatt() 550 oldco uleur = couleur577 oldcolnumb = colnumb 551 578 pltt,contour,type, contmin,contmax,CONTOUR=pourlegende, /noerase, USETRI = usetri $ 552 579 ,INTERVALLE=contintervalle,LABEL=contlabel,STYLE=style, ENDPOINTS = endpoints $ 553 ,NLEVEL=contnlevel,YSURX=ysurx, BOITE = boite, STRICTFILL = strictfill, _extra = ex554 co uleur = oldcouleur580 , NLEVEL = contnlevel, BOXZOOM = boxzoom, STRICTFILL = strictfill, _extra = ex 581 colnumb = oldcolnumb 555 582 restoreatt, oldattributs 556 583 endif … … 559 586 if keyword_set(overplot) then GOTO, fini 560 587 ;------------------------------------------------------------ 561 ; Trace de la ligne de changement de date 562 ;------------------------------------------------------------ 563 if (type eq 'xt') then $ 564 plot, [180,180],[tempsmin,tempsmax],/noerase,color=c_cote 588 ; Trace de la ligne de changement de date or the equator 589 ;------------------------------------------------------------ 590 IF key_onearth THEN BEGIN 591 CASE type OF 592 'xt':oplot, [180, 180] - 360*(!x.range[1] LT 180), !y.range 593 'yt':oplot, !x.range, [0, 0] 594 ELSE: 595 ENDCASE 596 ENDIF 565 597 ;------------------------------------------------------------ 566 598 ; legendes + affichage de celles-ci … … 569 601 , ENDPOINTS = endpoints, _extra = ex 570 602 ; 571 plot,[0],[0],/noerase,color=c_cote, xstyle = 1+4*(keyword_set(endpoints) AND type EQ 'xt' AND lat1 NE lat2) $ 572 , ystyle = 1+4*(keyword_set(endpoints) AND type EQ 'yt'), _extra = ex 603 ; we want to draw the time axis with tick length = 1. if we simply 604 ; use [xy]style=1 then each axis (up and down or left and right) have 605 ; majorticks with a length of 1 (-> not very nice when xgridstyle=2), 606 ; same if xticklen=0.5 (not very nice in the middle). => so we draw 607 ; the top (right) axis by hand using axis. 608 ; 609 if n_elements(ex) NE 0 then BEGIN 610 ; pour avoir un cadre de la couleur noire 611 if (where(tag_names(ex) EQ 'COLOR'))[0] NE -1 then ex.COLOR = 0 612 ENDIF 613 ; 614 plot, [0], [0], /nodata, /noerase, _extra = ex $ 615 , xstyle = 1+4*(keyword_set(endpoints) AND type EQ 'xt' AND lat1 NE lat2)+8*(type EQ 'yt' OR type EQ 'zt') $ 616 , ystyle = 1+4*(keyword_set(endpoints) AND type EQ 'yt')+8*(type EQ 'xt') 617 ; call axis for the missing axis. 618 IF type EQ 'xt' AND NOT keyword_set(endpoints) THEN BEGIN 619 if n_elements(ex) NE 0 then $ 620 if (where(tag_names(ex) EQ 'YTICKNAME'))[0] NE -1 then $ 621 ex.YTICKNAME = replicate(' ', n_elements(ex.YTICKNAME)) 622 axis, yaxis = 1, ystyle = 1, yticklen = 0 $ 623 , ytickname = replicate(' ', !y.ticks+1), _extra = ex 624 ENDIF 625 IF (type EQ 'yt' OR type EQ 'zt') AND NOT keyword_set(endpoints) THEN BEGIN 626 if n_elements(ex) NE 0 then $ 627 if (where(tag_names(ex) EQ 'XTICKNAME'))[0] NE -1 then $ 628 ex.XTICKNAME = replicate(' ', n_elements(ex.XTICKNAME)) 629 axis, xaxis = 1, xstyle = 1, xticklen = 0 $ 630 , xtickname = replicate(' ', !x.ticks+1), _extra = ex 631 ENDIF 573 632 ; ajout d'un axe ds le cas ou l'on utilise endpoints 574 633 if keyword_set(endpoints) then addaxe, endpoints, type, posfenetre, _EXTRA = ex … … 576 635 ; barre de couleur 577 636 ;------------------------------------------------------------ 578 co uleur = couleur[0:ncontour-1-keyword_set(strictfill)]579 barrecouleur, position=posbar,divisions=(ncontour-keyword_set(strictfill))/2,min=min$580 , max=max,discret=couleur,_extra = ex637 colnumb = colnumb[0:ncontour-1-keyword_set(strictfill)] 638 barrecouleur, colnumb, min, max, (ncontour-keyword_set(strictfill))/2 $ 639 , position = posbar, _extra = ex 581 640 ;------------------------------------------------------------ 582 641 endif … … 592 651 bar_plot, yy, background = (!d.n_colors-1) < 255, $ 593 652 baselines = replicate(!y.range[0], n_elements(yy)), barnames = ['', ''], $ 594 colors = replicate(col1d , n_elements(yy)), /outline 595 plot, [0], [0],/noerase,color=c_cote, _extra = ex 653 colors = replicate(col1d, n_elements(yy)), /outline 654 if n_elements(ex) NE 0 then BEGIN 655 ; pour avoir un cadre de la couleur noire 656 if (where(tag_names(ex) EQ 'COLOR'))[0] NE -1 then ex.COLOR = 0 657 ENDIF 658 plot, [0], [0], /nodata, /noerase, _extra = ex 596 659 GOTO, fini 597 660 ENDIF … … 609 672 yy = rien 610 673 endif 611 plot,xx,yy,color=col1d,linestyle=sty1d,thick=2, title = '', subtitle = '', _extra = ex 674 plot, xx, yy, color = col1d, linestyle = sty1d, thick = 2 $ 675 , title = '', subtitle = '', _extra = ex 676 ; draw 0 line 677 if keyword_set(exchange_xy) then $ 678 oplot, [0, 0], !y.range ELSE oplot, !x.range, [0, 0] 679 ; we want to draw the axis with the time axis length = 1. if we simply 680 ; use xstyle=1 then each axis (up and down) have majorticks with a 681 ; length of 1 (-> not very nice when xgridstyle=2), same if 682 ; xticklen=0.5 (not very nice in the middle). 683 ; => so we draw the top axis by hand using axis. 612 684 if n_elements(ex) NE 0 then BEGIN 613 ; pour avoir un cadre de la couleur c_cote614 if (where(tag_names(ex) EQ 'COLOR'))[0] NE -1 then ex.COLOR = c_cote685 ; pour avoir un cadre de la couleur noire 686 if (where(tag_names(ex) EQ 'COLOR'))[0] NE -1 then ex.COLOR = 0 615 687 ENDIF 616 if keyword_set(exchange_xy) then $ 617 plot, [0, 0],!y.range ,/noerase,color=c_cote, xstyle = 1, ystyle = 1, _extra = ex $ 618 ELSE plot, !x.range, [0, 0],/noerase,color=c_cote, xstyle = 1, ystyle = 1, _extra = ex 619 ENDIF ELSE oplot,xx,yy,color=col1d,linestyle=sty1d,thick=2, _extra = ex 688 plot, [0], [0], /nodata, /noerase $ 689 , xstyle = 1+8*(1-keyword_set(exchange_xy)) $ 690 , ystyle = 1+8*keyword_set(exchange_xy), _extra = ex 691 ; call axis for the missing axis. 692 if n_elements(ex) NE 0 then BEGIN 693 ; force tickname to blank array 694 if (where(tag_names(ex) EQ 'YTICKNAME'))[0] NE -1 AND keyword_set(exchange_xy) then ex.YTICKNAME = replicate(' ', n_elements(ex.YTICKNAME)) 695 if (where(tag_names(ex) EQ 'XTICKNAME'))[0] NE -1 AND NOT keyword_set(exchange_xy) then ex.XTICKNAME = replicate(' ', n_elements(ex.XTICKNAME)) 696 ENDIF 697 if keyword_set(exchange_xy) then axis, yaxis = 1, ystyle = 1 $ 698 , yticklen = 0, ytickname = replicate(' ', !y.ticks+1), _extra = ex $ 699 ELSE axis, xaxis = 1, xstyle = 1, xticklen = 0 $ 700 , xtickname = replicate(' ', !x.ticks+1), _extra = ex 701 ENDIF ELSE oplot, xx, yy, color = col1d, linestyle = sty1d, thick = 2, _extra = ex 620 702 endif 621 703 fini: … … 633 715 ; on fait un faut plot pour que ces valeurs soient prises en 634 716 ; consideration 635 plot,[0], [0], /noerase,xstyle=5, ystyle = 5, title = '', subtitle = '', ytitle = '', xtitle = '' 717 plot, [0], [0], /nodata, /noerase, xstyle = 5, ystyle = 5 $ 718 , title = '', subtitle = '', ytitle = '', xtitle = '' 636 719 ;------------------------------------------------------------ 637 720 ;------------------------------------------------------------ … … 640 723 ;------------------------------------------------------------ 641 724 terminedessin, _extra = ex 642 if keyword_set( oldboite) then domdef, oldboite,GRILLE=[vargrid, 'T']725 if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4pltt.dat' 643 726 ;------------------------------------------------------------ 644 727 if n_elements(key_performance) NE 0 then $ -
trunk/ToBeReviewed/PLOTS/DESSINE/sbar_plot.pro
r35 r67 39 39 ; EXAMPLE: 40 40 ; 41 ; IDL> sbar_plot, indgen(10), petit=[2,2,2],/rempli42 ; IDL> sbar_plot, indgen(10), petit=[2,2,3],/noerase41 ; IDL> sbar_plot, indgen(10),small = [2,2,2],/rempli 42 ; IDL> sbar_plot, indgen(10),small = [2,2,3],/noerase 43 43 ; IDL> @ps 44 44 ; … … 62 62 ENDIF ELSE colors = congrid(indgen(!d.n_colors < 256), n_elements(Values)) 63 63 ; 64 bar_plot, Values, background = !p.background, colors = colors, _extra = ex 64 bar_plot, Values, background = !p.background, colors = colors $ 65 , xstyle = 1, ystyle = 1, _extra = ex 65 66 ; 4) je termine le dessin 66 67 terminedessin, _extra=ex -
trunk/ToBeReviewed/PLOTS/DESSINE/splot.pro
r35 r67 35 35 ; EXAMPLE: 36 36 ; 37 ; IDL> splot, indgen(10),ystyle=1, petit=[1,2,1],/portrait38 ; IDL> splot, -indgen(10),ystyle=1, petit=[1,2,2],/noerase37 ; IDL> splot, indgen(10),ystyle=1,small=[1,2,1],/portrait 38 ; IDL> splot, -indgen(10),ystyle=1,small=[1,2,2],/noerase 39 39 ; IDL> @ps 40 40 ; … … 52 52 placedessin, 'autre', _extra = ex 53 53 ; 3) je fais mon joli dessin 54 if n_elements(y) EQ 0 then plot, x, _EXTRA = ex ELSE plot, x, y, _EXTRA = ex 54 if n_elements(y) EQ 0 then plot, x, xstyle = 1, ystyle = 1, _EXTRA = ex $ 55 ELSE plot, x, y, xstyle = 1, ystyle = 1, _EXTRA = ex 55 56 ; 4) je termine le dessin 56 57 terminedessin, _extra=ex
Note: See TracChangeset
for help on using the changeset viewer.