Changeset 37
- Timestamp:
- 05/02/06 16:55:58 (18 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 deleted
- 15 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/ToBeReviewed/PLOTS/DIVERS/addaxe.pro
r35 r37 41 41 IF strpos(type, 'x') NE -1 THEN BEGIN 42 42 IF endpoints[1] EQ endpoints[3] THEN return 43 formeaxe0 = 'lonaxe' 44 formeaxe1 = 'lataxe' 45 titreaxe = 'latitude' 43 IF key_onearth THEN BEGIN 44 formeaxe0 = 'lonaxe' 45 formeaxe1 = 'lataxe' 46 titreaxe = 'latitude' 47 ENDIF ELSE BEGIN 48 formeaxe0 = '' 49 formeaxe1 = '' 50 titreaxe = 'j index' 51 ENDELSE 46 52 range = [endpoints[1], endpoints[3]] 53 if endpoints[2] LT endpoints[0] THEN range = reverse(range) 47 54 ENDIF ELSE BEGIN 48 55 IF endpoints[0] EQ endpoints[2] THEN return 49 formeaxe0 = 'lataxe' 50 formeaxe1 = 'lonaxe' 51 titreaxe = 'longitude' 56 IF key_onearth THEN BEGIN 57 formeaxe0 = 'lataxe' 58 formeaxe1 = 'lonaxe' 59 titreaxe = 'longitude' 60 ENDIF ELSE BEGIN 61 formeaxe0 = '' 62 formeaxe1 = '' 63 titreaxe = 'i index' 64 ENDELSE 52 65 range = [endpoints[0], endpoints[2]] 53 66 if endpoints[3] LT endpoints[1] THEN range = reverse(range) -
trunk/ToBeReviewed/PLOTS/DIVERS/barrecouleur.pro
r35 r37 19 19 ;------------------------------------------------------------ 20 20 ;------------------------------------------------------------ 21 PRO barrecouleur, NOCOLORBAR = nocolorbar, CB_TITLE = cb_title, CB_SUBTITLE = cb_subtitle $ 22 , POST = post, _extra = ex 23 @common 21 PRO barrecouleur, colnumb, clbinf, clbsup, clbdiv $ 22 , NOCOLORBAR = nocolorbar, CB_TITLE = cb_title $ 23 , NOFILL = nofill, COLOR_c = color_c $ 24 , min = min, max = max, divisions = divisions $ 25 , CB_SUBTITLE = cb_subtitle, POST = post, _extra = ex 26 ;------------------------------------------------------------ 27 @cm_general 28 IF NOT keyword_set(key_forgetold) THEN BEGIN 29 @updatekwd 30 ENDIF 31 ;------------------------------------------------------------ 32 if keyword_set(min) then clbinf = min 33 if keyword_set(max) then clbsup = min 34 if keyword_set(divisions) THEN clbdiv = divisions 35 nocolorbar = keyword_set(nocolorbar) + keyword_set(nofill) $ 36 + keyword_set(color_c) 37 ;------------------------------------------------------------ 38 def_myuniquetmpdir 39 ; 40 IF lmgr(/demo) EQ 1 THEN BEGIN 41 ; if we are in demo mode, we cannot save the parameters in a temporary file... 42 @cm_demomode_used 43 ; 44 colorbarparam = {colnumb:colnumb, clbinf:clbinf $ 45 , clbsup:clbsup, clbdiv:clbdiv} 46 ENDIF ELSE BEGIN 47 save, colnumb, clbinf, clbsup, clbdiv $ 48 , file = myuniquetmpdir + '4colorbar.dat' 49 ENDELSE 50 ;------------------------------------------------------------ 51 if keyword_set(nocolorbar) then return 24 52 ;------------------------------------------------------------ 25 53 ancienx = !x … … 30 58 !y.style = 1 31 59 ;------------------------------------------------------------ 32 if n_elements(ex) NE 0 then BEGIN 33 if (where(tag_names(ex) EQ 'MIN'))[0] NE -1 then colorbarinf=ex.MIN 34 if (where(tag_names(ex) EQ 'MAX'))[0] NE -1 then colorbarsup=ex.MAX 35 if (where(tag_names(ex) EQ 'DIVISIONS'))[0] NE -1 then colorbardiv=ex.DIVISIONS 36 if (where(tag_names(ex) EQ 'NOCOULEUR'))[0] NE -1 then nocolorbar = 1 37 ENDIF 38 if not keyword_set(nocolorbar) then BEGIN 39 colorbar,cb_color=0, cb_charsize=ancienp.charsize, pscolor=keyword_set(post) $ 40 , cb_title = cb_title,_extra = ex 41 ENDIF 60 colorbar, cb_color = 0, cb_charsize = ancienp.charsize $ 61 , pscolor = keyword_set(post), division = clbdiv $ 62 , min = clbinf, max = clbsup $ 63 , cb_title = cb_title, discret = colnumb, _extra = ex 64 ;------------------------------------------------------------ 42 65 !x= ancienx 43 66 !y= ancieny 44 67 !p= ancienp 68 ; 45 69 return 46 70 end -
trunk/ToBeReviewed/PLOTS/DIVERS/checkfield.pro
r35 r37 20 20 ; 21 21 ; KEYWORD PARAMETERS: 22 ; 23 ; /WDEPTH: to specify that the field is at W depth instad of T 24 ; depth (automatically activated if vargrid eq 'W') 22 25 ; 23 26 ; OUTPUTS: … … 36 39 ;------------------------------------------------------------ 37 40 ;------------------------------------------------------------ 38 ;------------------------------------------------------------ 39 FUNCTION checkfield, field, procedure, TYPE = type, BOITE = boite, DIREC = direc, NOQUESTION = noquestion, VECTEUR = vecteur, _EXTRA = ex 40 ;-------------------------------------------------------------- 41 @common 41 FUNCTION err_1d, type, n1, name, n2 42 return, report(['Error in "' + type + '" type plot with a 1D input array:' $ 43 , 'the number of elements of the input vector ('+strtrim(n1, 1)+') ' $ 44 , 'is not equal to ' + name + ' ('+strtrim(n2, 1)+')'], /simple) 45 END 46 ; 47 FUNCTION err_2d, type, sz, nx, ny, nz 48 @cm_4mesh 49 @cm_4cal 50 return, report(['Error in "' + type + '" type plot with a 2D input array:' $ 51 , 'the array dimensions ' + tostr(sz[1:2]) + ' are incompatible' $ 52 , 'with the the domain dimensions ' $ 53 , '[jpi/nx, jpj/ny, jpk/nz, jpt] = [' $ 54 + strtrim(jpi, 1) + '/' + strtrim(nx, 1) $ 55 + ', ' + strtrim(jpj, 1) + '/' + strtrim(ny, 1) $ 56 + ', ' + strtrim(jpk, 1) + '/' + strtrim(nz, 1) $ 57 + ', ' + strtrim(jpt, 1) + ']'], /simple) 58 END 59 ; 60 FUNCTION err_3d, type, sz, nx, ny, nz 61 @cm_4mesh 62 @cm_4cal 63 return, report(['Error in "' + type + '" type plot with a 3D input array:' $ 64 , 'the array dimensions ' + tostr(sz[1:3]) + ' are incompatible' $ 65 , 'with the the domain dimensions ' $ 66 , '[jpi/nx, jpj/ny, jpk/nz, jpt] = [' $ 67 + strtrim(jpi, 1) + '/' + strtrim(nx, 1) $ 68 + ', ' + strtrim(jpj, 1) + '/' + strtrim(ny, 1) $ 69 + ', ' + strtrim(jpk, 1) + '/' + strtrim(nz, 1) $ 70 + ', ' + strtrim(jpt, 1) + ']'], /simple) 71 END 72 ;-------------------------------------------------------------- 73 ; 74 FUNCTION checkfield, field, procedure, TYPE = type, BOXZOOM = boxzoom, DIREC = direc, NOQUESTION = noquestion, VECTEUR = vecteur, WDEPTH = wdepth, _EXTRA = ex 75 ;-------------------------------------------------------------- 76 ; include commons 77 @cm_4mesh 78 @cm_4cal 79 @cm_4data 80 IF NOT keyword_set(key_forgetold) THEN BEGIN 81 @updatenew 82 @updatekwd 83 ENDIF 42 84 ;-------------------------------------------------------------- 43 85 ; I1) lecture du champ 44 86 ;-------------------------------------------------------------- 45 if n_elements(field) EQ 0 then return, report('field undefined') 46 z2d = litchamp(field) 47 nan = total(finite(z2d,/nan)) < 1 87 if n_elements(field) EQ 0 then return, report('field undefined') 88 arr = litchamp(field) 89 ; first check 90 IF n_elements(arr) EQ 1 THEN BEGIN 91 if arr EQ -1 then $ 92 return, report('Error: input array = -1. Maybe the reading did ont perform well...', /simple) $ 93 ELSE return, report('Error: input array is a scalar', /simple) 94 ENDIF 95 nan = total(finite(arr, /nan)) < 1 48 96 ;--------------------------------------------------------------- 49 97 ; redefinition du domaine 50 98 ;--------------------------------------------------------------- 51 minprof = 0 52 profdefault = 200 53 if keyword_set(boite) then BEGIN 54 ; 55 ; if n_elements(integration3d) EQ 0 THEN integration3d = n_elements(boite) ne 4 56 ; 57 neleboitein = N_Elements(Boite) 58 Case neleboitein Of 59 1:boite=[lon1, lon2, lat1, lat2, minprof,boite[0]] 60 2:boite=[lon1, lon2, lat1, lat2, boite[0],boite[1]] 61 4:$ 62 if strpos(type, 'z') NE -1 THEN boite=[Boite, minprof, profdefault] $ 63 ELSE boite=[Boite, prof1, prof2] 64 5:boite=[Boite[0:3], minprof, Boite[4]] 65 6:boite=Boite 66 Else: return, report('Mauvaise Definition de Boite') 67 ENDCASE 68 ENDIF ELSE neleboitein = 0 99 minprof = 0. 100 profdefault = 200. 101 ; 102 Case n_elements(boxzoom) OF 103 0: 104 1:localbox = [minprof, boxzoom[0]] 105 2:localbox = boxzoom 106 4:if strpos(type, 'z') NE -1 THEN $ 107 localbox = [boxzoom, minprof, profdefault] ELSE localbox = boxzoom 108 5:localbox = [Boxzoom[0:3], minprof, Boxzoom[4]] 109 6:localbox = boxzoom 110 Else: return, report('Bad definition of boxzoom') 111 ENDCASE 112 ; 113 if keyword_set(localbox) then BEGIN 114 if keyword_set(vecteur) then grillechoice = [vargrid, 'T', 'U', 'V'] $ 115 ELSE grillechoice = [vargrid, 'T'] 116 if keyword_set(wdepth) then grillechoice = [grillechoice, 'W'] 117 domdef, localbox, GRIDTYPE = grillechoice, _extra = ex 118 ENDIF 119 ; 69 120 ; la procedure domdef determine les elements qui sont a l''interieur 70 ; de la bo ite.121 ; de la boxzoom. 71 122 ; si on fait un plot contenant l''axe z: 72 123 ; Suivant l''axe z si on veut par ex faire un dessin … … 76 127 ; elevees). Pour ne pas que le dessin s''arrete a 900 mais bien a 77 128 ; 1000, on va aller chercher le niveau au dessous de 1000, d''ou la 78 ; manip suivante sur la bo ite: l''approfondir de 1 niveau sur la129 ; manip suivante sur la boxzoom: l''approfondir de 1 niveau sur la 79 130 ; verticale (si possible) sans changer les y range. 80 if strpos(type, 'z') NE -1 THEN BEGIN 81 if NOT keyword_set(boite) then boite = 1.*[lon1,lon2,lat1,lat2,minprof, profdefault] 82 !y.range = [boite[5], boite[4]] ;on garde les yranges (axe z) avant de changer la boite. 83 profmax = boite[5] 84 if vargrid EQ 'W' then gdep = gdepw ELSE gdep = gdept 85 ; check with vertical grid limits (nearest level) 86 gwork = gdep 87 ; check the increse or decrese of the z axis 88 IF gwork[1] LE gwork[0] THEN gwork = reverse(gdep, 1) 89 niveauprof = where(gwork ge boite[5]) & niveauprof = niveauprof[0] 90 if niveauprof NE -1 then boite[5] = gwork[niveauprof]+1 91 ENDIF 92 if keyword_set(boite) then BEGIN 93 if keyword_set(vecteur) then grillechoice = [vargrid, 'T', 'U', 'V'] ELSE grillechoice = [vargrid, 'T'] 94 if neleboitein LE 2 then domdef, boite, GRILLE=grillechoice ELSE domdef, boite, GRILLE=grillechoice, _extra = ex 95 ENDIF 131 if strpos(type, 'z') NE -1 THEN BEGIN 132 if NOT keyword_set(localbox) then BEGIN 133 localbox = [minprof, profdefault] 134 if keyword_set(wdepth) then grillechoice = 'W' $ 135 ELSE grillechoice = vargrid 136 domdef, localbox, GRIDTYPE = grillechoice 137 END 138 nelbox = n_elements(localbox) 139 ;on garde les yranges (axe z) avant de changer la boxzoom. 140 !y.range = [localbox[nelbox-1], localbox[nelbox-2]] 141 if vargrid EQ 'W' OR keyword_set(wdepth) then BEGIN 142 firstzw = 0 > (firstzw-1) 143 lastzw = (lastzw+1) < (jpk-1) 144 nzw = lastzw - firstzw + 1 145 ENDIF ELSE BEGIN 146 firstzt = 0 > (firstzt-1) 147 lastzt = (lastzt+1) < (jpk-1) 148 nzt = lastzt - firstzt + 1 149 ENDELSE 150 @updateold 151 ENDIF 152 ; make the automatic definition of type for pltz if type is not specified. 153 IF type EQ 'z' AND procedure EQ 'pltz' THEN $ 154 if (lon2-lon1) gt (lat2-lat1) then type = 'xz' else type = 'yz' 155 ; make the automatic definition of type for pltt if type is not specified. 156 IF type EQ 'unkownpltt' AND procedure EQ 'pltt' THEN $ 157 if (lon2-lon1) gt (lat2-lat1) then type = 'xt' else type = 'yt' 96 158 ;-------------------------------------------------------------- 97 159 ; verification de la taille du tableau d''entree et de la valeur de type 98 160 ;-------------------------------------------------------------- 99 grille, mask, glam, gphi, gdep, nx, ny,nz,premierx,premiery,premierz,dernierx,derniery,dernierz 100 taille=size(z2d) 101 case taille[0] of 102 ;-------------------------------------------------------------- 103 0:BEGIN 104 if z2d EQ -1 then $ 105 return, report('Attention le tableau est egale a -1. Probleme lors de la lecture...') $ 106 ELSE return, report('Attention le tableau est un scalaire') 107 END 108 ;-------------------------------------------------------------- 109 1:BEGIN 110 nele = n_elements(z2d) 111 case type of 112 't':if jpt NE nele then $ 113 return, report('jpt: '+strtrim(jpt, 1)+' n''est pas egale au nombres d''elements du vecteur: '+strtrim(nele, 1)) 114 'x':BEGIN 115 case nele of 116 jpi:z2d = z2d[premierx:dernierx] 117 nx: 118 ELSE:return, report('nx: '+strtrim(nx, 1)+' n''est pas egale au nombres d''elements du vecteur: '+strtrim(nele, 1)) 119 endcase 120 end 121 'y':BEGIN 122 case nele of 123 jpj:z2d = z2d[premiery:derniery] 124 ny: 125 ELSE:return, report('ny: '+strtrim(ny, 1)+' n''est pas egale au nombres d''elements du vecteur: '+strtrim(nele, 1)) 126 endcase 127 END 128 'z':BEGIN 129 case nele of 130 jpk:z2d = z2d[premierz:dernierz] 131 nz: 132 ELSE:return, report('nz: '+strtrim(nz, 1)+' n''est pas egale au nombres d''elements du vecteur: '+strtrim(nele, 1)) 133 endcase 134 END 135 ELSE:return, report('imcompatibilite entre type: '+type+' et la taille du tableau 1d en entree: '+strtrim(nele, 1)) 136 ENDCASE 137 END 138 ;-------------------------------------------------------------- 139 2:BEGIN 140 case type of 141 'x':BEGIN 142 case taille[2] of 143 ny:direc = 'y' 144 jpj:direc = 'y' 145 jpt:direc = 't' 146 ELSE:return, report('imcompatibilite entre type: '+type+' et la taille du tableau 2d en entree: '+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)) 147 endcase 148 end 149 'y':BEGIN 150 case 1 of 151 taille[1] EQ jpi OR taille[1] EQ nx:direc = 'x' 152 taille[2] EQ jpt:direc = 't' 153 ELSE:return, report('imcompatibilite entre type: '+type+' et la taille du tableau 2d en entree: '+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)) 154 endcase 155 END 156 'z':BEGIN 157 if taille[2] EQ jpt then direc = 't' $ 158 ELSE return, report('imcompatibilite entre type: '+type+' et la taille du tableau 2d en entree: '+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)) 159 END 160 't':BEGIN 161 case 1 of 162 taille[1] EQ jpi OR taille[1] EQ nx:BEGIN 163 direc = 'x' 164 timearray = 1 165 END 166 jpt EQ 1:BEGIN 167 ras = report('Field average: '+strtrim(moyenne(z2d, 'xy', boite = boite, NAN = nan, _extra = ex), 1)+' in box: '+tostr(boite)) 168 return, -1 169 END 170 ELSE: return, report('imcompatibilite entre type: '+type+' et la taille du tableau 2d en entree: '+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)) 171 ENDCASE 172 END 173 'xy':BEGIN 174 case 1 of 175 taille[1] eq nx and taille[2] eq ny: 176 taille[1] eq jpi and taille[2] eq jpj:z2d=z2d[premierx:dernierx, premiery:derniery] 177 else:return, report('Probleme d''adequation entre les tailles du domaine nx*ny '+strtrim(nx, 1)+'*'+strtrim(ny, 1)+' et du tableau '+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)) 178 endcase 179 if vargrid EQ 'W' then niveau = premierzw+1 ELSE niveau = premierzt+1 180 END 181 'xz':BEGIN 182 case 1 of 183 taille[1] eq jpi and taille[2] eq jpk:z2d = z2d[premierx:dernierx,premierz:dernierz] 184 taille[1] eq nx and taille[2] eq jpk:z2d = z2d[*,premierz:dernierz] 185 taille[1] eq nx and taille[2] eq nz: 186 else:return, report('Probleme d''adequation entre les tailles du domaine nx*nz '+strtrim(nx, 1)+'*'+strtrim(nz, 1)+'et du tableau'+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)) 187 endcase 188 END 189 'yz':BEGIN 190 case 1 of 191 taille[1] eq jpj and taille[2] eq jpk:z2d = z2d[premiery:derniery,premierz:dernierz] 192 taille[1] eq ny and taille[2] eq jpk:z2d = z2d[*,premierz:dernierz] 193 taille[1] eq ny and taille[2] eq nz: 194 else:return, report('Probleme d''adequation entre les tailles du domaine ny*nz '+strtrim(ny, 1)+'*'+strtrim(nz, 1)+'et du tableau'+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)) 195 endcase 196 END 197 'xt':BEGIN 198 case 1 of 199 taille[1] eq jpi and taille[2] eq jpt:z2d = z2d[premierx:dernierx,*] 200 taille[1] eq nx and taille[2] eq jpt: 201 else:return, report('Probleme d''adequation entre les tailles du domaine nx*jpt '+strtrim(nx, 1)+'*'+strtrim(jpt, 1)+'et du tableau'+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)) 202 endcase 203 END 204 'yt':BEGIN 205 case 1 of 206 taille[1] eq jpj and taille[2] eq jpt:z2d = z2d[premiery:derniery,*] 207 taille[1] eq ny and taille[2] eq jpt: 208 else:return, report('Probleme d''adequation entre les tailles du domaine ny*jpt '+strtrim(ny, 1)+'*'+strtrim(jpt, 1)+'et du tableau'+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)) 209 endcase 210 END 211 'zt':BEGIN 212 case 1 of 213 taille[1] eq jpk and taille[2] eq jpt:z2d = z2d[premierz:dernierz,*] 214 taille[1] eq nz and taille[2] eq jpt: 215 else:return, report('Probleme d''adequation entre les tailles du domaine nz*jpt '+strtrim(nz, 1)+'*'+strtrim(jpt, 1)+'et du tableau'+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)) 216 endcase 217 END 218 endcase 219 END 220 ;-------------------------------------------------------------- 221 3:BEGIN 222 case type of 223 'x':BEGIN 224 case taille[3] of 225 nz:direc = 'yz' 226 jpk:direc = 'yz' 227 jpt:direc = 'yt' 228 ELSE:return, report('imcompatibilite entre type: '+type+' et la taille du tableau 3d en entree: '+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)+'*'+strtrim(taille[3], 1)) 229 endcase 230 END 231 'y':BEGIN 232 case taille [3] of 233 nz:direc = 'xz' 234 jpk:direc = 'xz' 235 jpt:direc = 'xt' 236 ELSE:return, report('imcompatibilite entre type: '+type+' et la taille du tableau 3d en entree: '+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)+'*'+strtrim(taille[3], 1)) 237 endcase 238 END 239 'z':BEGIN 240 case taille [3] of 241 nz:direc = 'xy' 242 jpk:direc = 'xy' 243 ELSE:return, report('imcompatibilite entre type: '+type+' et la taille du tableau 3d en entree: '+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)+'*'+strtrim(taille[3], 1)) 244 endcase 245 END 246 't':BEGIN 247 IF jpt EQ 1 THEN BEGIN 248 ras = report('Field average: '+strtrim(moyenne(z2d, 'xyz', boite = boite, NAN = nan, _extra = ex), 1)+' in box: '+tostr(boite)) 249 return, -1 250 ENDIF ELSE BEGIN 251 direc = 'xy' 252 timearray = 1 253 ENDELSE 254 END 255 'xy':BEGIN 256 case 1 of 257 taille[3] EQ jpt:BEGIN 258 direc = 't' 259 if vargrid EQ 'W' then niveau = premierzw+1 ELSE niveau = premierzt+1 260 END 261 taille[3] EQ nz OR taille[3] EQ jpk:BEGIN 262 if keyword_set(boite) OR keyword_set(noquestion) then begin 263 direc = 'z' 264 if vargrid EQ 'W' then niveau = premierzw+1 ELSE niveau = premierzt+1 265 ENDIF ELSE BEGIN 266 if vargrid EQ 'W' then premierz = premierzw ELSE premierz = premierzt 267 if NZ NE 1 then begin 268 niveau = xquestion('Le tableau d''entree est un tableau 3d,' $ 269 +'!C a quel niveau faut-il faire le graphique?', '1', /chkwidget) 270 niveau = 1 > fix(niveau) < (jpk-premierz) 271 case 1 of 272 taille[1] EQ nx AND taille[2] EQ ny: $ 273 z2d=z2d[*, *,niveau-1] 274 taille[1] EQ jpi AND taille[2] EQ jpj: $ 275 z2d=z2d[premierx:dernierx, premiery:derniery,niveau-1] 276 ELSE:return, report('imcompatibilite entre type: '+type+' et la taille du tableau 3d en entree: '+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)+'*'+strtrim(taille[3], 1)) 277 endcase 278 ENDIF ELSE niveau = 1 279 niveau = premierz+niveau 280 endelse 281 END 282 ELSE:return, report('imcompatibilite entre type: '+type+' et la taille du tableau 3d en entree: '+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)+'*'+strtrim(taille[3], 1)) 283 endcase 284 END 285 'xz':BEGIN 286 case 1 of 287 (taille[2] EQ ny OR taille[2] EQ jpj) AND taille[3] EQ jpk:BEGIN 288 z2d = z2d[*, *, premierz:dernierz] 289 direc = 'y' 290 END 291 (taille[2] EQ ny OR taille[2] EQ jpj) AND taille[3] EQ nz:direc = 'y' 292 taille[3] EQ jpt:direc = 't' 293 ELSE:return, report('imcompatibilite entre type: '+type+' et la taille du tableau 3d en entree: '+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)+'*'+strtrim(taille[3], 1)) 294 endcase 295 END 296 'yz':BEGIN 297 case 1 of 298 (taille[1] EQ nx OR taille[1] EQ jpi) AND taille[3] EQ jpk:BEGIN 299 z2d = z2d[*, *, premierz:dernierz] 300 direc = 'x' 301 END 302 (taille[1] EQ nx OR taille[1] EQ jpi) AND taille[3] EQ nz:direc = 'x' 303 ELSE:return, report('imcompatibilite entre type: '+type+' et la taille du tableau 3d en entree: '+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)+'*'+strtrim(taille[3], 1)) 304 endcase 305 END 306 'xt':BEGIN & direc = 'y' & timearray = 1 & end 307 'yt':BEGIN & direc = 'x' & timearray = 1 & end 308 'zt':return, report('imcompatibilite entre type: '+type+' et la taille du tableau 3d en entree: '+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)+'*'+strtrim(taille[3], 1)) 309 ENDCASE 310 end 311 ;-------------------------------------------------------------- 312 4:BEGIN 313 case type of 314 'x':direc = 'yzt' 315 'y':direc = 'xzt' 316 'z':direc = 'xyt' 317 't':direc = 'xyz' 318 'xy':BEGIN 319 if keyword_set(boite) OR keyword_set(noquestion) then begin 320 if vargrid EQ 'W' then niveau = premierzw+1 ELSE niveau = premierzt+1 321 direc = 'zt' 322 ENDIF ELSE BEGIN 323 if vargrid EQ 'W' then premierz = premierzw ELSE premierz = premierzt 324 if NZ NE 1 then begin 325 niveau = xquestion('Le tableau d''entree est un tableau 4d,' $ 326 +'!C a quel niveau faut-il faire le graphique?', '1', /chkwidget) 327 niveau = 1 > fix(niveau) < (jpk-premierz) 328 z2d=reform(z2d[*,*,niveau-1, *], /over) 329 ENDIF ELSE niveau = 1 330 niveau = premierz+niveau 331 direc = 't' 332 ENDELSE 333 END 334 'xz':direc = 'yt' 335 'yz':direc = 'xt' 336 'xt':direc = 'yz' 337 'yt':direc = 'xz' 338 'zt':direc = 'xy' 339 endcase 340 END 341 ENDCASE 342 ;-------------------------------------------------------------- 343 if keyword_set(direc) then begin 344 if strpos(direc, 't') NE -1 OR keyword_set(timearray) OR taille[0] EQ 4 then $ 345 z2d = grossemoyenne(z2d, direc, boite = boite, NAN = nan, /nodomdef, _extra = ex) $ 346 ELSE z2d = moyenne(z2d, direc, boite = boite, NAN = nan, /nodomdef, _extra = ex) 347 ENDIF 348 ;-------------------------------------------------------------- 349 ;-------------------------------------------------------------- 350 ;-------------------------------------------------------------- 351 ;-------------------------------------------------------------- 352 return, z2d 353 end 161 grille, -1, -1, -1, -1, nx, ny, nz, firstx, firsty $ 162 , firstz, lastx, lasty, lastz, WDEPTH = wdepth 163 ;-------------------------------------------------------------- 164 ; basic checks 165 ;-------------------------------------------------------------- 166 CASE 1 OF 167 nx EQ 1: IF strpos(type, 'x') NE -1 THEN return, report('Error: impossible to make a "' + type + '" type plot with nx = 1 ', /simple) 168 ny EQ 1: IF strpos(type, 'y') NE -1 THEN return, report('Error: impossible to make a "' + type + '" type plot with ny = 1 ', /simple) 169 nz EQ 1: IF strpos(type, 'z') NE -1 THEN return, report('Error: impossible to make a "' + type + '" type plot with nz = 1 ', /simple) 170 jpt EQ 1: IF strpos(type, 't') NE -1 THEN return, report('Error: impossible to make a "' + type + '" type plot with jpt = 1 ', /simple) 171 ELSE: 172 ENDCASE 173 ;-------------------------------------------------------------- 174 ; is the size of the array compatible with teh domain? 175 ;-------------------------------------------------------------- 176 arr = fitintobox(temporary(arr), nx, ny, nz, firstx, firsty $ 177 , firstz, lastx, lasty, lastz) 178 ;-------------------------------------------------------------- 179 sz = size(arr) 180 case sz[0] of 181 ;-------------------------------------------------------------- 182 0:return, arr 183 ;-------------------------------------------------------------- 184 1:BEGIN 185 nele = n_elements(arr) 186 case type of 187 't':if jpt NE nele THEN return, err_1d(type, nele, 'jpt', jpt) 188 'x':IF nx NE nele THEN return, err_1d(type, nele, 'nx', nx) 189 'y':IF ny NE nele THEN return, err_1d(type, nele, 'ny', ny) 190 'z':IF nz NE nele THEN return, err_1d(type, nele, 'nz', nx) 191 ELSE:return, report('Error: ' $ 192 , 'Impossible to make a "'+type+'" plot with a 1D array', /simple) 193 ENDCASE 194 END 195 ;-------------------------------------------------------------- 196 2:BEGIN 197 case type of 198 'x':BEGIN 199 case 1 of 200 sz[1] EQ nx AND sz[2] EQ ny:direc = 'y' ; xy array 201 sz[1] EQ nx AND ny EQ 1 AND sz[2] EQ nz:direc = 'z' ; x(y)z array 202 sz[1] EQ nx AND sz[2] EQ jpt:direc = 't' ; xt array 203 ELSE:return, err_2d(type, sz, nx, ny, nz) 204 endcase 205 end 206 'y':BEGIN 207 case 1 of 208 sz[1] EQ nx AND sz[2] EQ ny:direc = 'x' ; xy array 209 nx EQ 1 AND sz[1] EQ ny AND sz[2] EQ nz:direc = 'z' ; (x)yz array 210 sz[1] EQ ny AND sz[2] EQ jpt:direc = 't' ; yt array 211 ELSE:return, err_2d(type, sz, nx, ny, nz) 212 endcase 213 END 214 'z':BEGIN 215 case 1 of 216 sz[1] EQ nx AND ny EQ 1 AND sz[2] EQ nz:direc = 'x' ; x(y)z array 217 nx EQ 1 AND sz[1] EQ ny AND sz[2] EQ nz:direc = 'y' ; (x)yz array 218 sz[1] EQ nz AND sz[2] EQ jpt:direc = 't' ; zt array 219 ELSE:return, err_2d(type, sz, nx, ny, nz) 220 endcase 221 END 222 't':BEGIN 223 case 1 OF 224 sz[1] EQ nx AND sz[2] EQ jpt:direc = 'x' ; xt array 225 nx EQ 1 AND sz[1] EQ ny AND sz[2] EQ jpt:direc = 'y' ; (x)yt array 226 nx EQ 1 AND ny EQ 1 AND sz[1] EQ nz AND sz[2] EQ jpt:direc = 'z' ; (x)(y)zt array 227 ELSE:return, err_2d(type, sz, nx, ny, nz) 228 ENDCASE 229 END 230 'xy':IF sz[1] NE nx OR sz[2] ne ny THEN return, err_2d(type, sz, nx, ny, nz) ; xy array 231 'xz':IF sz[1] NE nx OR sz[2] ne nz THEN return, err_2d(type, sz, nx, ny, nz) ; xz array 232 'yz':IF sz[1] NE ny OR sz[2] NE nz THEN return, err_2d(type, sz, nx, ny, nz) ; yz array 233 'xt':IF sz[1] NE nx OR sz[2] NE jpt THEN return, err_2d(type, sz, nx, ny, nz) ; xt array 234 'yt':IF sz[1] NE ny OR sz[2] NE jpt THEN return, err_2d(type, sz, nx, ny, nz) ; yt array 235 'zt':IF sz[1] NE nz OR sz[2] NE jpt THEN return, err_2d(type, sz, nx, ny, nz) ; zt array 236 ENDCASE 237 END 238 ;-------------------------------------------------------------- 239 3:BEGIN 240 case type of 241 'x':BEGIN 242 case 1 of 243 sz[1] EQ nx AND sz[2] EQ ny AND sz[3] EQ nz:direc = 'yz' ; xyz array 244 sz[1] EQ nx AND ny EQ 1 AND sz[2] EQ nz AND sz[3] EQ jpt:direc = 'zt' ; x(y)zt array 245 sz[1] EQ nx AND sz[2] EQ ny AND sz[3] EQ jpt:direc = 'yt' ; xyt array 246 ELSE:return, err_3d(type, sz, nx, ny, nz) 247 endcase 248 END 249 'y':BEGIN 250 case 1 of 251 sz[1] EQ nx AND sz[2] EQ ny AND sz[3] EQ nz:direc = 'xz' ; xyz array 252 nx EQ 1 AND sz[1] EQ ny AND sz[2] EQ nz AND sz[3] EQ jpt:direc = 'zt' ; (x)yzt array 253 sz[1] EQ nx AND sz[2] EQ ny AND sz[3] EQ jpt:direc = 'xt' ; xyt array 254 ELSE:return, err_3d(type, sz, nx, ny, nz) 255 endcase 256 END 257 'z':BEGIN 258 case 1 of 259 sz[1] EQ nx AND sz[2] EQ ny AND sz[3] EQ nz:direc = 'xy' ; xyz array 260 nx EQ 1 AND sz[1] EQ ny AND sz[2] EQ nz AND sz[3] EQ jpt:direc = 'yt' ; (x)yzt array 261 sz[1] EQ nx AND ny EQ 1 AND sz[2] EQ nz AND sz[3] EQ jpt:direc = 'xt' ; x(y)zt array 262 ELSE:return, err_3d(type, sz, nx, ny, nz) 263 endcase 264 END 265 't':BEGIN 266 case 1 of 267 sz[1] EQ nx AND sz[2] EQ ny AND sz[3] EQ jpt:direc = 'xy' ; xyt array 268 nx EQ 1 AND sz[1] EQ ny AND sz[2] EQ nz AND sz[3] EQ jpt:direc = 'yz' ; (x)yzt array 269 sz[1] EQ nx AND ny EQ 1 AND sz[2] EQ nz AND sz[3] EQ jpt:direc = 'xz' ; x(y)zt array 270 ELSE:return, err_3d(type, sz, nx, ny, nz) 271 endcase 272 END 273 'xy':BEGIN 274 case 1 OF 275 sz[1] EQ nx AND sz[2] EQ ny AND sz[3] EQ nz:direc = 'z' ; xyz array 276 sz[1] EQ nx AND sz[2] EQ ny AND sz[3] EQ jpt:direc = 't' ; xyt array 277 ELSE:return, err_3d(type, sz, nx, ny, nz) 278 endcase 279 END 280 'xz':BEGIN 281 case 1 of 282 sz[1] EQ nx AND sz[2] EQ ny AND sz[3] EQ nz:direc = 'y' ; xyz array 283 sz[1] EQ nx AND ny EQ 1 AND sz[2] EQ nz AND sz[3] EQ jpt:direc = 't' ; x(y)zt 284 ELSE:return, err_3d(type, sz, nx, ny, nz) 285 endcase 286 END 287 'yz':BEGIN 288 case 1 of 289 sz[1] EQ nx AND sz[2] EQ ny AND sz[3] EQ nz:direc = 'x' ; xyz array 290 nx EQ 1 AND sz[1] EQ ny AND sz[2] EQ nz AND sz[3] EQ jpt:direc = 't' ; (x)yzt 291 ELSE:return, err_3d(type, sz, nx, ny, nz) 292 endcase 293 END 294 'xt':BEGIN 295 case 1 of 296 sz[1] EQ nx AND sz[2] EQ ny AND sz[3] EQ jpt:direc = 'y' ; xyt array 297 sz[1] EQ nx AND ny EQ 1 AND sz[2] EQ nz AND sz[3] EQ jpt:direc = 'z' ; x(y)zt array 298 ELSE:return, err_3d(type, sz, nx, ny, nz) 299 endcase 300 END 301 'yt':BEGIN 302 case 1 of 303 sz[1] EQ nx AND sz[2] EQ ny AND sz[3] EQ jpt:direc = 'x' ; xyt array 304 nx EQ 1 AND sz[1] EQ ny AND sz[2] EQ nz AND sz[3] EQ jpt:direc = 'z' ; (x)yzt array 305 ELSE:return, err_3d(type, sz, nx, ny, nz) 306 endcase 307 END 308 'zt':BEGIN 309 case 1 of 310 sz[1] EQ nx AND ny EQ 1 AND sz[2] EQ nz AND sz[3] EQ jpt:direc = 'x' ; x(y)zt array 311 nx EQ 1 AND sz[1] EQ ny AND sz[2] EQ nz AND sz[3] EQ jpt:direc = 'y' ; (x)yzt array 312 ELSE:return, err_3d(type, sz, nx, ny, nz) 313 ENDCASE 314 END 315 ENDCASE 316 END 317 ;-------------------------------------------------------------- 318 4:BEGIN 319 CASE type OF 320 'x':direc = 'yzt' 321 'y':direc = 'xzt' 322 'z':direc = 'xyt' 323 't':direc = 'xyz' 324 'xy':direc = 'zt' 325 'xz':direc = 'yt' 326 'yz':direc = 'xt' 327 'xt':direc = 'yz' 328 'yt':direc = 'xz' 329 'zt':direc = 'xy' 330 ENDCASE 331 END 332 ENDCASE 333 ;-------------------------------------------------------------- 334 IF keyword_set(direc) THEN BEGIN 335 IF strpos(direc, 't') NE -1 OR strpos(type, 't') NE -1 THEN $ 336 arr = grossemoyenne(temporary(arr), direc, boxzoom = localbox $ 337 , NAN = nan, /NODOMDEF, WDEPTH = wdepth, _extra = ex) $ 338 ELSE arr = moyenne(temporary(arr), direc, boxzoom = localbox $ 339 , NAN = nan, /NODOMDEF, WDEPTH = wdepth, _extra = ex) 340 ENDIF 341 ;-------------------------------------------------------------- 342 ;-------------------------------------------------------------- 343 ;-------------------------------------------------------------- 344 ;-------------------------------------------------------------- 345 RETURN, arr 346 END -
trunk/ToBeReviewed/PLOTS/DIVERS/checktypeminmax.pro
r35 r37 34 34 , XZ = xz, YZ = yz, XT = XT, YT = YT, ZT = zt $ 35 35 , TT = tt, XX = xx, YY = yy, ZZ = zz $ 36 , XINDEX = xindex, YINDEX = yindex, BOITE = boite, ENDPOINTS = endpoints 36 , XINDEX = xindex, YINDEX = yindex $ 37 , ENDPOINTS = endpoints, _extra = ex 37 38 ; 38 39 @common … … 87 88 ; 88 89 if keyword_set(type) then begin 89 90 91 92 90 if type EQ 'plt' then type = '' 91 if type EQ 'pltz' then type = '' 92 if type EQ 'pltt' then type = '' 93 if type EQ 'plt1d' then type = '' 93 94 endif 94 95 ;-------------------------------------------------------------- … … 97 98 if NOT keyword_set(type) then BEGIN 98 99 case procedure of 99 'plt':type = 'xy' 100 'pltz':BEGIN 101 @common 102 if keyword_set(endpoints) then BEGIN 103 lon1 = min([endpoints[0], endpoints[2]]) 104 lon2 = max([endpoints[0], endpoints[2]]) 105 lat1 = min([endpoints[1], endpoints[3]]) 106 lat2 = max([endpoints[1], endpoints[3]]) 107 ENDIF ELSE BEGIN 108 if n_elements(boite) GE 4 then BEGIN 109 if keyword_set(xindex) then begin 110 lon1 = glamt[boite[0], 0] 111 lon2 = glamf[boite[1], 0] 112 ENDIF ELSE BEGIN 113 lon1 = boite[0] 114 lon2 = boite[1] 115 ENDELSE 116 if keyword_set(yindex) then begin 117 lat1 = gphit[0, boite[2]] 118 lat2 = gphif[0, boite[3]] 119 ENDIF ELSE BEGIN 120 lat1 = boite[2] 121 lat2 = boite[3] 122 ENDELSE 123 ENDIF 124 ENDELSE 125 if lon2-lon1 gt lat2-lat1 then type='xz' else type='yz' 126 END 127 'pltt':BEGIN 128 if keyword_set(endpoints) then BEGIN 129 lon1 = min([endpoints[0], endpoints[2]]) 130 lon2 = max([endpoints[0], endpoints[2]]) 131 lat1 = min([endpoints[1], endpoints[3]]) 132 lat2 = max([endpoints[1], endpoints[3]]) 133 ENDIF ELSE BEGIN 134 if n_elements(boite) GE 4 then BEGIN 135 if keyword_set(xindex) then begin 136 lon1 = glamt[boite[0], 0] 137 lon2 = glamf[boite[1], 0] 138 ENDIF ELSE BEGIN 139 lon1 = boite[0] 140 lon2 = boite[1] 141 ENDELSE 142 if keyword_set(yindex) then begin 143 lat1 = gphit[0, boite[2]] 144 lat2 = gphif[0, boite[3]] 145 ENDIF ELSE BEGIN 146 lat1 = boite[2] 147 lat2 = boite[3] 148 ENDELSE 149 ENDIF 150 ENDELSE 151 if (lon2-lon1) gt (lat2-lat1) then type='xt' else type='yt' 152 ; type = '' 153 ; WHILE type NE 't' AND type NE 'xt' AND type NE 'yt' AND type NE 'zt' DO BEGIN 154 ; type = xquestion('Quel type de hovmoeller voulez-vous faire? t,xt,yt,zt ? ' $ 155 ; , /chkwidget) 156 ; type = strlowcase(type) 157 ; ENDWHILE 158 END 159 'plt1d':BEGIN 160 if keyword_set(endpoints) then BEGIN 161 lon1 = min([endpoints[0], endpoints[2]]) 162 lon2 = max([endpoints[0], endpoints[2]]) 163 lat1 = min([endpoints[1], endpoints[3]]) 164 lat2 = max([endpoints[1], endpoints[3]]) 165 if (lon2-lon1) gt (lat2-lat1) then type='x' else type='y' 166 ENDIF ELSE BEGIN 167 type = '' 168 WHILE type NE 'x' AND type NE 'y' AND type NE 'z' DO BEGIN 169 type = xquestion('Quel type de plot 1D voulez-vous faire? x,y,z ou t ?' $ 170 , /chkwidget) 171 type = strlowcase(type) 172 endwhile 173 ENDELSE 174 END 100 'plt':type = 'xy' 101 'pltz':BEGIN 102 if keyword_set(endpoints) then BEGIN 103 lon1 = min([endpoints[0], endpoints[2]], max = lon2) 104 lat1 = min([endpoints[1], endpoints[3]], max = lat2) 105 if (lon2-lon1) gt (lat2-lat1) then type = 'xz' else type = 'yz' 106 ENDIF ELSE type = 'z' 107 END 108 'pltt':BEGIN 109 if keyword_set(endpoints) then BEGIN 110 lon1 = min([endpoints[0], endpoints[2]], max = lon2) 111 lat1 = min([endpoints[1], endpoints[3]], max = lat2) 112 lat2 = max([endpoints[1], endpoints[3]]) 113 if (lon2-lon1) gt (lat2-lat1) then type = 'xt' else type = 'yt' 114 ENDIF ELSE type = 'unkownpltt' 115 END 116 'plt1d':BEGIN 117 if keyword_set(endpoints) then BEGIN 118 lon1 = min([endpoints[0], endpoints[2]], max = lon2) 119 lat1 = min([endpoints[1], endpoints[3]], max = lat2) 120 if (lon2-lon1) gt (lat2-lat1) then type = 'x' else type = 'y' 121 ENDIF ELSE BEGIN 122 type = '' 123 WHILE type NE 'x' AND type NE 'y' AND type NE 'z' DO BEGIN 124 type = xquestion('Quel type de plot 1D voulez-vous faire? x,y,z ou t ?' $ 125 , /chkwidget) 126 type = strlowcase(type) 127 endwhile 128 ENDELSE 129 END 175 130 endcase 176 ENDIF 177 WHILE type NE 'xy' AND type NE 'xz' AND type NE 'yz' $ 178 AND type NE 'xt' AND type NE 'yt' AND type NE 'zt' $ 179 AND type NE 't' AND type NE 'x' AND type NE 'y' AND type NE 'z' DO BEGIN 180 type = xquestion('Quel type de plot voulez-vous faire? xy,xz,yz,xt,yt,zt,t,x,y,z ? ' $ 131 ENDIF 132 WHILE type NE 'xy' AND type NE 'xz' AND type NE 'yz' $ 133 AND type NE 'xt' AND type NE 'yt' AND type NE 'zt' $ 134 AND type NE 't' AND type NE 'x' AND type NE 'y' $ 135 AND type NE 'z' AND type NE 'unkownpltt' DO BEGIN 136 type = xquestion('What kind of plot do you want to do? xy,xz,yz,xt,yt,zt,t,x,y,z ? ' $ 181 137 , /chkwidget) 182 138 type = strlowcase(type) 183 ENDWHILE139 ENDWHILE 184 140 ; 185 141 ; 186 187 return188 end142 143 return 144 end -
trunk/ToBeReviewed/PLOTS/DIVERS/determineminmax.pro
r35 r37 21 21 ; prennent la valeur de vraimin et vraimax 22 22 ; 23 ; /ZEROMIDDLE: fo force the middle of the colorbar to be equal 24 ; to 0 (force max=max(abs([min,max])) and min=-max) 25 ; 23 26 ; OUTPUTS: 24 27 ; … … 40 43 ;------------------------------------------------------------ 41 44 ;------------------------------------------------------------ 42 PRO determineminmax, tab, mask, vraimin, vraimax, glam, gphi, MAXIN = maxin, MININ = minin, INTERVALLE = intervalle, _extra = ex45 PRO determineminmax, tab, mask, vraimin, vraimax, glam, gphi, MAXIN = maxin, MININ = minin, INTERVALLE = intervalle, usetri = usetri, ZEROMIDDLE = zeromiddle, _extra = ex 43 46 @common 44 47 ;----------------------------------------------------------------------------- 45 48 ;----------------------------------------------------------------------------- 46 49 ; type de grille verticale: 47 50 if vargrid EQ 'W' then nz = nzw ELSE nz = nzt 48 51 ; liste des points mer 49 if (size(mask))[0] EQ 3 then BEGIN 50 if (size(mask))[3] EQ jpk then mer=mask[*,*,niveau-1] $ 51 ELSE mer=mask[*,*,nz-1] 52 ENDIF ELSE mer=mask 52 if (size(mask))[0] EQ 3 then mer = mask[*, *, 0] $ 53 ELSE mer = mask 53 54 ; si key_irregular eq 1, on masque aussi les points qui ne rentrent 54 55 ; pas ds le domaine geographique definit par lon1,lon2,lat1,lat2 55 56 57 58 56 if keyword_set(key_irregular) AND n_elements(glam) NE 0 AND n_elements(gphi) NE 0 then begin 57 dom = where(glam LT lon1 OR glam GT lon2 OR gphi LT lat1 OR gphi GT lat2) 58 if dom[0] NE -1 then mer[dom] = 0 59 endif 59 60 ; 60 mer=where(mer eq 1)61 mer = where(mer eq 1) 61 62 ; 62 if mer[0] eq -1 then begin 63 ras = report('Il n''y a que de la terre sur le dessin!') 64 tab = -1 65 endif 63 if mer[0] eq -1 then begin 64 ras = report('Il n''y a que de la terre sur le dessin!') 65 vraimax = 0 66 vraimin = 0 67 maxin = vraimax+1 68 minin = vraimin-1 69 usetri = 0 70 return 71 endif 66 72 ; ma et mi : max et min sur les points mer 67 vraimax=max(tab(mer),min=vraimin, _extra = ex) 68 sameminmax = testvar(var = minin) EQ testvar(var = maxin) 69 if n_elements(maxin) EQ 0 OR sameminmax then maxin = vraimax 70 if n_elements(minin) EQ 0 OR sameminmax then BEGIN 71 if keyword_set(intervalle) then minin = floor(vraimin/intervalle)*intervalle $ 72 ELSE minin = vraimin 73 endif 74 if vraimin eq vraimax then BEGIN 75 question = 'ATTENTION le champ est CONSTANT! Faut-il quand meme le tracer?' 76 answer = report(question, /default_no, /question) 77 if answer then begin 78 maxin=vraimax+1 79 minin=vraimin-1 80 endif ELSE tab = -1 81 endif 82 return 73 vraimax = max(tab(mer), min = vraimin, _extra = ex) 74 sameminmax = testvar(var = minin) EQ testvar(var = maxin) 75 if n_elements(maxin) EQ 0 OR sameminmax then maxin = vraimax 76 if n_elements(minin) EQ 0 OR sameminmax then BEGIN 77 if keyword_set(intervalle) then minin = floor(vraimin/intervalle)*intervalle $ 78 ELSE minin = vraimin 79 endif 80 if vraimin eq vraimax then BEGIN 81 IF size(vraimin, /type) EQ 1 THEN vraimin = fix(vraimin) 82 question = ['Warning: constant filed, same value everywhere : ' + strtrim(vraimin, 2) +'!', 'Shall we make the plot?'] 83 answer = report(question, /default_no, /question) 84 if answer then begin 85 maxin = vraimax+1 86 minin = vraimin-1 87 endif ELSE tab = -1 88 ENDIF 89 IF keyword_set(zeromiddle) THEN BEGIN 90 maxin = max(abs([minin, maxin])) 91 minin = -maxin 92 ENDIF 93 94 95 return 83 96 end -
trunk/ToBeReviewed/PLOTS/DIVERS/givewindowsize.pro
r35 r37 1 1 FUNCTION givewindowsize 2 @common 2 ; 3 ;------------------------------------------------------------ 4 ; include commons 5 @cm_4ps 6 IF NOT keyword_set(key_forgetold) THEN BEGIN 7 @updatenew 8 ENDIF 9 ;------------------------------------------------------------ 3 10 ; 4 11 dimensions = get_screen_size(RESOLUTION=resolution) 5 12 coef = floor(1./resolution[0]) 6 if NOT keyword_set(ccwindowsize) then ccwindowsize = 1 7 coef = ccwindowsize*coef 13 if NOT keyword_set(windowsize_scale) then BEGIN 14 windowsize_scale = 1. 15 IF NOT keyword_set(key_forgetold) THEN BEGIN 16 @updateold 17 ENDIF 18 ENDIF 19 coef = windowsize_scale * coef 8 20 ; 9 xsize=coef*(petitfeuille*key_portrait+grandfeuille*(1-key_portrait)) 10 ysize=coef*(petitfeuille*(1-key_portrait)+grandfeuille*key_portrait) 21 mipgsz = min(page_size, max = mapgsz) 22 ; 23 xsize = coef * (mipgsz*key_portrait + mapgsz*(1-key_portrait)) 24 ysize = coef * (mipgsz*(1-key_portrait) + mapgsz*key_portrait) 11 25 ; 12 26 return, [xsize, ysize] -
trunk/ToBeReviewed/PLOTS/DIVERS/placecolor.pro
r35 r37 39 39 ;------------------------------------------------------------ 40 40 ;------------------------------------------------------------ 41 pro placecolor,pos,_extra = ex 42 @common 41 pro placecolor, pos, _extra = ex 43 42 ;------------------------------------------------------------ 43 ; include commons 44 @cm_4ps 45 IF NOT keyword_set(key_forgetold) THEN BEGIN 46 @updatenew 47 ENDIF 48 ;--------------------- 49 ; 44 50 xsave = !x 45 51 ysave = !y 46 52 psave = !p 47 53 ; 48 54 reinitplt, /z, /invert 49 55 pos=1.*pos 56 mipgsz = min(page_size, max = mapgsz) 50 57 if key_portrait eq 1 then begin 51 pos[0]=pos[0]/ petitfeuille52 pos[1]=pos[1]/ grandfeuille53 pos[2]=pos[2]/ petitfeuille54 pos[3]=pos[3]/ grandfeuille58 pos[0]=pos[0]/mipgsz 59 pos[1]=pos[1]/mapgsz 60 pos[2]=pos[2]/mipgsz 61 pos[3]=pos[3]/mapgsz 55 62 endif else begin 56 pos[0]=pos[0]/grandfeuille 57 pos[1]=pos[1]/petitfeuille 58 pos[2]=pos[2]/grandfeuille 59 pos[3]=pos[3]/petitfeuille 60 endelse 61 if keyword_set(divisions) eq 0 then divisions=colorbardiv 62 if keyword_set(max) eq 0 then max=colorbarsup 63 if keyword_set(min) eq 0 then min=colorbarinf 64 COLORBAR, COLOR=0, DIVISIONS=divisions, DISCRET=couleur, cb_color = 0, $ 65 POSITION=pos, MAX=max, MIN=min, cb_charsize=!p.charsize, _extra = ex 66 63 pos[0]=pos[0]/mapgsz 64 pos[1]=pos[1]/mipgsz 65 pos[2]=pos[2]/mapgsz 66 pos[3]=pos[3]/mipgsz 67 ENDELSE 68 ; 69 def_myuniquetmpdir 70 ; 71 IF lmgr(/demo) EQ 1 THEN BEGIN 72 ; if we are in demo mode, we cannot save the parameters in a temporary file... 73 @cm_demomode_used 74 ; 75 colnumb = colorbarparam.colnumb 76 clbinf = colorbarparam.clbinf 77 clbsup = colorbarparam.clbsup 78 clbdiv = colorbarparam.clbdiv 79 ; 80 ENDIF ELSE BEGIN 81 file = myuniquetmpdir + '4colorbar.dat' 82 IF file_test(file) THEN BEGIN 83 restore, file 84 if size(ex, /type) EQ 8 then BEGIN 85 if (where(tag_names(ex) EQ 'MIN'))[0] NE -1 then clbinf = ex.MIN 86 if (where(tag_names(ex) EQ 'MAX'))[0] NE -1 then clbsup = ex.MAX 87 if (where(tag_names(ex) EQ 'DIVISIONS'))[0] NE -1 then clbdiv = ex.DIVISIONS 88 ENDIF 89 ; 90 COLORBAR, COLOR = 0, DIVISIONS = clbdiv, DISCRET = colnumb $ 91 , cb_color = 0, POSITION = pos, MAX = clbsup $ 92 , MIN = clbinf, cb_charsize = !p.charsize $ 93 , _extra = ex 94 ENDIF 95 ENDELSE 96 ; 67 97 !x = xsave 68 98 !y = ysave -
trunk/ToBeReviewed/PLOTS/DIVERS/placedessin.pro
r35 r37 46 46 ;------------------------------------------------------------ 47 47 ;------------------------------------------------------------ 48 PRO placedessin, typedessin,posfenetre, posbar, BARMARGES = barmarges, NOCOLORBAR = nocolorbar, CONTOUR = contour $ 48 PRO placedessin, typedessin, posfenetre, posbar, BARMARGES = barmarges $ 49 , NOCOLORBAR = nocolorbar, NOFILL = nofill, COLOR_c = color_c $ 50 , CONTOUR = contour $ 49 51 , VECTEUR = vecteur, PORTRAIT = portrait, LANDSCAPE = landscape $ 50 , YSURX = ysurx, PETITDESSIN = petitdessin, MARGES = marges, MAP = map $52 , SMALL = small, MARGES = marges, MAP = map $ 51 53 , REMPLI = REMPLI, POST = post, WINDOW = window $ 52 , ENDPOINTS = endpoints, TYPE = type, B asicmarges= basicmarges $54 , ENDPOINTS = endpoints, TYPE = type, BASICMARGES = basicmarges $ 53 55 , NOERASE = noerase, LCT = lct, DIREC = direc, CB_TITLE = cb_title, _extra = ex 54 @common 56 ;--------------------------------------------------------- 57 ; include common 58 @cm_4ps 59 @cm_4mesh 60 IF NOT keyword_set(key_forgetold) THEN BEGIN 61 @updatekwd 62 ENDIF 55 63 ;------------------------------------------------------------- 56 64 ; 1) determination de la taille des marges (unite=nbre de lignes ou colonnes) … … 59 67 ; lieu de la marge en haut 60 68 ;------------------------------------------------------------- 61 if n_elements(typedessin) EQ 0 then typedessin = 'autre' 62 if keyword_set(basicmarges) then begin 63 marge=1.*[6,2,4,3] 64 margebar= replicate(0, 4) 65 if keyword_set(marges) THEN marge = marge+marges 66 ENDIF ELSE BEGIN 67 if n_elements(ex) NE 0 then $ 68 if (where(tag_names(ex) EQ 'NOCOULEUR'))[0] NE -1 then IF ex.NOCOULEUR EQ 1 THEN nocolorbar=1 69 case typedessin of 70 'plt':marge=1.*[6,2,4,3] 71 'pltt':marge=1.*[6+4*(type EQ 'xt'),2,4,4] 72 'pltz':marge=1.*[6,2,4,3] 73 else:marge=1.*[6,2,4,3] 74 ENDCASE 75 if keyword_set(marges) THEN marge = marge+marges 76 if NOT keyword_set(barmarges) then barmarges = replicate(0, 4) 77 barmarges[3] = -barmarges[3] 78 margebar=1.*[marge[0]+1,marge[1]+1,2,4]+barmarges 79 marge=marge+[0,0,4,0]*keyword_set(cb_title) 80 marge=marge+[0,0,2,0]*keyword_set(direc) 81 marge=marge+[0,0,2,0]*keyword_set(contour) 82 marge=marge+[0,0,2,0]*keyword_set(vecteur) 83 if n_elements(lon1) NE 0 and n_elements(lon2) NE 0 $ 84 and n_elements(lat1) NE 0 and n_elements(lat2) NE 0 then begin 85 if keyword_set(type) then $ 86 marge=marge+[0, 3*(type EQ 'yt' AND lon1 NE lon2),0 $ 87 ,2*(type NE 'yt' AND lat1 NE lat2)]*keyword_set(endpoints) $ 88 ELSE marge=marge+[0,0,0,2*(lat1 NE lat2)]*keyword_set(endpoints) 89 endif 90 marge=marge+[0,0,2+margebar[3],0]*(1-keyword_set(nocolorbar)) 91 ENDELSE 69 if n_elements(typedessin) EQ 0 then typedessin = 'autre' 70 if keyword_set(basicmarges) then begin 71 marge = 1.*[6, 2, 4, 3] 72 if keyword_set(marges) THEN marge = marge+marges 73 margebar = 1.*[marge[0]+1, marge[1]+1, marge[2]-8, marge[2]-6] 74 if keyword_set(barmarges) then margebar = margebar+barmarges 75 ENDIF ELSE BEGIN 76 nocolorbar = keyword_set(nocolorbar) + keyword_set(nofill) + keyword_set(color_c) 77 case typedessin of 78 'plt':marge = 1.*[6, 2, 4, 3] 79 'pltt':marge = 1.*[6+4*(type EQ 'xt'), 2, 4, 4] 80 'pltz':marge = 1.*[6, 2, 4, 3] 81 else:marge = 1.*[6, 2, 4, 3] 82 ENDCASE 83 if keyword_set(marges) THEN marge = marge+marges 84 if NOT keyword_set(barmarges) then barmarges = replicate(0, 4) 85 barmarges[3] = -barmarges[3] 86 margebar = 1.*[marge[0]+1, marge[1]+1, 2, 4]+barmarges 87 marge = marge+[0, 0, 4, 0]*keyword_set(cb_title) 88 IF keyword_set(direc) THEN $ 89 marge = marge+[0, 0, 2, 0]*(strlowcase(direc) NE 't') 90 marge = marge+[0, 0, 2, 0]*keyword_set(contour) 91 marge = marge+[0, 0, 2, 0]*keyword_set(vecteur) 92 if n_elements(lon1) NE 0 and n_elements(lon2) NE 0 $ 93 and n_elements(lat1) NE 0 and n_elements(lat2) NE 0 then begin 94 if keyword_set(type) then $ 95 marge = marge+[0, 3*(type EQ 'yt' AND lon1 NE lon2), 0 $ 96 , 2*(type NE 'yt' AND lat1 NE lat2)]*keyword_set(endpoints) $ 97 ELSE marge = marge+[0, 0, 0, 2*(lat1 NE lat2)]*keyword_set(endpoints) 98 endif 99 marge = marge+[0, 0, 2+margebar[3], 0]*(1-keyword_set(nocolorbar)) 100 ENDELSE 92 101 ;-------------------------------------------------------------- 93 102 ; portrair ou landscape 94 103 ;-------------------------------------------------------------- 95 if n_elements(portrait) NE 0 then key_portrait=portrait $96 else if key_portrait ne 1 then key_portrait=097 if n_elements(landscape) then key_portrait=1-landscape104 if n_elements(portrait) NE 0 then key_portrait = portrait $ 105 else if key_portrait ne 1 then key_portrait = 0 106 if n_elements(landscape) then key_portrait = 1-landscape 98 107 ;-------------------------------------------------------------- 99 ; Quel type de rapport d''aspect (sera ecrase si Y SURXexiste)108 ; Quel type de rapport d''aspect (sera ecrase si YXASPECT existe) 100 109 ;-------------------------------------------------------------- 101 102 'plt':yaspect=1.*(lat2-lat1)/(lon2-lon1)103 'pltt':yaspect= 1.104 'pltz':yaspect=.5105 ELSE:yaspect= 1.106 110 case typedessin of 111 'plt':yaspect = 1.*(lat2-lat1)/(lon2-lon1) 112 'pltt':yaspect = 1. 113 'pltz':yaspect = .5 114 ELSE:yaspect = 1. 115 endcase 107 116 ;------------------------------------------------------------- 108 117 ; 2) calcul de !p.position … … 110 119 ;------------------------------------------------------------ 111 120 ; 112 IF NOT keyword_set(petitdessin) then petitdessin= [1, 1, 1]121 IF NOT keyword_set(small) then small = [1, 1, 1] 113 122 ; 114 123 if keyword_set(map) then rempli = 1 115 124 ; 116 calibre,yaspect,marge,margebar,petitdessin,posfenetre, posbar,YSURX=ysurx,REMPLI=rempli, _extra = xe125 calibre, yaspect, marge, margebar, small, posfenetre, posbar, REMPLI = rempli, _extra = ex 117 126 ; 118 !p.position=posfenetre127 !p.position = posfenetre 119 128 ;------------------------------------------------------------ 120 129 ; 3) ouverture de la fenetre graphique ou du postscript 121 130 ;------------------------------------------------------------ 122 131 case 1 of 123 132 ; cas du premier dessin sur un postcript 124 133 keyword_set(post) AND !d.name ne 'PS':openps, _extra = ex 125 134 ; cas du premier dessin sur un ecran 126 127 128 if not keyword_set(window) then window=0135 keyword_set(post) EQ 0 AND keyword_set(noerase) EQ 0 $ 136 AND !d.name ne 'PS' AND !d.name ne 'Z':BEGIN 137 if not keyword_set(window) then window = 0 129 138 ; pour l''utilisation de @ps, @oups et de @vzoom 130 if lmgr(/demo) EQ 0 then BEGIN ; on est en mode demo?? 131 if !journal NE 0 then journal ; on ferme le journal s''il est ouvert 132 homedir = isadirectory(io = homedir, title = 'Bad definition of homedir') 133 journal, homedir+'idlsave.pro' ; on en ouvre un nouveau 134 help, /recall_commands, output = listecommande ; on recupere la derniere commande 135 listecommande = strmid(strcompress(listecommande[1]), 2) 136 printf, !journal, listecommande ; on l''ecrit dans le journal 137 ENDIF 138 windsize = givewindowsize() 139 window, window, xsize = windsize[0], ysize = windsize[1], retain = 2, _extra = ex 139 if lmgr(/demo) EQ 0 then BEGIN ; on est en mode demo?? 140 if !journal NE 0 then journal ; on ferme le journal s''il est ouvert 141 homedir = isadirectory(io = homedir, title = 'Bad definition of homedir') 142 def_myuniquetmpdir 143 journal, myuniquetmpdir+'idlsave.pro' ; on en ouvre un nouveau 144 help, /recall_commands, output = listecommande ; on recupere la derniere commande 145 listecommande = strmid(strcompress(listecommande[1]), 2) 146 journal, listecommande ; on l''ecrit dans le journal 147 ENDIF 148 windsize = givewindowsize() 149 window, window, xsize = windsize[0], ysize = windsize[1], retain = 2, _extra = ex 140 150 ; qd on utilise des couleurs codees sur 24 bit, je n''arrive pas a stipuler la couleur du 141 151 ; fond d''une fenetre a l'aide de !p.background, je suis oblige de faire cette bidouille!!! … … 146 156 ; device, decomposed=0 147 157 ; endif 148 149 150 158 END 159 ELSE: 160 endcase 151 161 ;------------------------------------------------------------ 152 if n_elements(lct) NE 0 then lct, lct162 if n_elements(lct) NE 0 then lct, lct, _extra = ex 153 163 ;------------------------------------------------------------ 154 164 155 165 return 156 166 end -
trunk/ToBeReviewed/PLOTS/DIVERS/restoreatt.pro
r35 r37 20 20 ; SIDE EFFECTS: change la valeur des variables globales attributs 21 21 ; d''un champ: vargrid, varname, varunit, vardate, varexp , valmask, 22 ; niveauet time22 ; et time 23 23 ; 24 24 ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr) … … 38 38 'u':varunit = struct.(i) 39 39 'e':varexp = struct.(i) 40 'l':niveau = struct.(i)41 40 'm':valmask = struct.(i) 42 41 'd':BEGIN -
trunk/ToBeReviewed/PLOTS/DIVERS/saveatt.pro
r35 r37 27 27 FUNCTION saveatt 28 28 @common 29 return, {n:varname,g:vargrid,d:vardate,e:varexp,u:varunit,m:valmask ,l:niveau}29 return, {n:varname,g:vargrid,d:vardate,e:varexp,u:varunit,m:valmask} 30 30 end -
trunk/ToBeReviewed/PLOTS/DIVERS/terminedessin.pro
r35 r37 13 13 ; INPUTS: 14 14 ; 15 ; KEYWORD PARAMETERS:POST et PETITDESSINcf l''aide de plt15 ; KEYWORD PARAMETERS:POST et SMALL cf l''aide de plt 16 16 ; 17 17 ; OUTPUTS: … … 32 32 ;------------------------------------------------------------ 33 33 ;------------------------------------------------------------ 34 PRO terminedessin, POST=post, PETITDESSIN=petitdessin, _EXTRA = ex 35 @common 34 PRO terminedessin, POST = post, SMALL = small, _extra = ex 35 ;--------------------------------------------------------- 36 @cm_4ps 37 IF NOT keyword_set(key_forgetold) THEN BEGIN 38 @updatenew 39 @updatekwd 40 ENDIF 41 ;--------------------------------------------------------- 36 42 if keyword_set(post) then BEGIN 37 if keyword_set(petitdessin) then $ 38 if total(petitdessin) NE (margescadre[2]+margescadre[0]+petitfeuille+grandfeuille $ 39 -margescadre[1]-margescadre[3]) then return 43 if keyword_set(small) then $ 44 if total(small) NE $ 45 (page_margins[2]+page_margins[0]+total(page_size) $ 46 -page_margins[1]-page_margins[3]) then return 40 47 closeps 41 imprime,_extra = ex48 printps 42 49 endif 43 50 return
Note: See TracChangeset
for help on using the changeset viewer.