Changeset 150 for trunk/SRC/ToBeReviewed/TRIANGULATION/tracemask.pro
- Timestamp:
- 08/09/06 12:12:54 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/ToBeReviewed/TRIANGULATION/tracemask.pro
r134 r150 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:tracemask6 5 ; 7 ; PURPOSE:dessiner des contour d''un mask 6 ; @file_comments 7 ; Draw contours of a mask 8 8 ; 9 ; CATEGORY:plus simple que tracecote, car ne s''occuppe pas du type de 10 ; projection et de la periodicite de la grille 9 ; @categories 10 ; utilities 11 ; 12 ; @param MASKENTREE {in}{required} 13 ; 2d array specifing the mask 14 ; 15 ; @param XIN {in}{required}, 16 ; 2d array specifing longitude coordinates. 17 ; 18 ; @param YIN {in}{required}, 19 ; 2d array specifing latitude coordinates. 11 20 ; 12 ; CALLING SEQUENCE: tracemask, maskentree, xentree, yentree 13 ; 14 ; INPUTS:maskentree, xentree, yentree tableaux 2d specifiant le mask 15 ; et ses coordonees en longitude te latitude. 21 ; @keyword COAST_COLOR 22 ; The color of the coastline. 23 ; defaut value is 0 => black 16 24 ; 17 ; KEYWORD PARAMETERS: 25 ; @keyword COAST_THICK 26 ; The thick of the trait to trace continents 27 ; It is 1 by default. 18 28 ; 19 ; COAST_COLOR: the color of the coastline.20 ; defaut value is 0 => black29 ; @keyword OVERPLOT 30 ; To do a plot over an other one. 21 31 ; 22 ; COAST_THICK: l''epaisseur du trait pour tracer les23 ; continents. par defaut c''est 1.32 ; @keyword _EXTRA 33 ; used to pass your keywords 24 34 ; 25 ; OUTPUTS: none 35 ; @uses 36 ; common.pro 26 37 ; 27 ; COMMON BLOCKS:common.pro 38 ; @history 39 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 28 40 ; 29 ; SIDE EFFECTS: 30 ; 31 ; RESTRICTIONS: 32 ; 33 ; EXAMPLE: 34 ; 35 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) 41 ; @version 42 ; $Id$ 36 43 ; 37 44 ;- … … 51 58 ENDIF 52 59 ;--------------------------------------------------------- 53 tempsun = systime(1) ; pour key_performance54 ; on s''afranchit des problemes de bord:55 tempdeux = systime(1) ; pour key_performance =260 tempsun = systime(1) ; For key_performance 61 ; We avoid edging problems: 62 tempdeux = systime(1) ; For key_performance =2 56 63 tailleentree = size(maskentree) 57 64 nx = tailleentree[1]+1 … … 62 69 IF n_elements(yin) EQ 0 THEN yentree = findgen(ny-1) ELSE yentree = yin 63 70 IF (size(yentree))[0] EQ 1 THEN yentree = replicate(1,nx-1)#yentree 64 ; on agrandi le mask de une colonne a gauche et de une colonne en bas71 ; We enlarge the mask by 1 column to the left an d1 line to the bottom 65 72 mask = intarr(tailleentree[1]+1, tailleentree[2]+1) 66 73 mask[1:tailleentree[1], 1:tailleentree[2]] = maskentree 67 ; les 2 premieres colonnes sont identiques74 ; The 2 first columns are identical. 68 75 mask[0, 1:tailleentree[2]] = maskentree[0, *] 69 ; les 2 premieres lignes sont identiques76 ; The 2 first lines are identical. 70 77 mask[1:tailleentree[1], 0] = maskentree[*, 0] 71 ; on calcul la position suivant x des points qui seviront a tracer le 72 ; masque. ils sont situes entre chaque points du masque, sauf pour la 73 ; derniere colonne que l''on ne peut pas calculer et que l''on met 74 ; donc a max(!x.range) 75 xrange = !x.range[sort(!x.range)] ; si reverse_x est utilise! 78 ; We calculate the position following x of points which will serve to trace the mask. They are situated between each points of the mask, exept for the last column we can not calculate and so we put at max (!x.range). 79 xrange = !x.range[sort(!x.range)] ; if REVERSE_X is used 76 80 xentree = .5*(xentree+shift(xentree, -1, 0)) 77 81 IF not keyword_set(overplot) THEN xentree[nx-2, *] = xrange[1] $ 78 82 ELSE xentree[nx-2, *] = xentree[nx-3, *] 79 ; on seuil83 ; we sill 80 84 xentree = xrange[0] > xentree < xrange[1] 81 ; on agrandit le tableau85 ; we enlarge the array 82 86 xf = fltarr(nx, ny) 83 87 xf[1:nx-1, 1:ny-1] = xentree … … 103 107 print, 'temps tracemask: determination du mask et des ses coordonnes', systime(1)-tempdeux 104 108 ; 105 ; on trace les segments verticaux:109 ; We trace vertical segments: 106 110 ; 107 tempdeux = systime(1) ; pour key_performance =2111 tempdeux = systime(1) ; For key_performance =2 108 112 liste = where(mask+shift(mask, -1, 0) EQ 1) 109 113 IF liste[0] NE -1 THEN BEGIN 110 ; on recupere lx et ly qui sont les indices ds un tableau 2d des 111 ; points donnes par liste 114 ; We recuperate lx and ly which are indexes in a 2d array of points given by list 112 115 ly = liste/nx & lx = temporary(liste)-nx*ly 113 indice = where(ly NE 0) ; on ne prend pas les points concernant114 ; la premiere ligne car ds ce cas le pt j-1 n''est pas definit116 indice = where(ly NE 0) ; We do not take points concernining 117 ; the first line because in this case, the point j-1 is not defined 115 118 if indice[0] NE -1 then begin 116 119 lx = lx[indice] & ly = ly[temporary(indice)] 117 120 IF testvar(var = key_performance) EQ 2 THEN $ 118 121 print, 'temps tracemask: liste traits verticaux', systime(1)-tempdeux 119 tempdeux = systime(1) ; pour key_performance =2120 ; boucle sur les points concernes et trace du segment121 ; rq: on utilise plots au lieu de plot car plots est bcp plus rapide.122 tempdeux = systime(1) ; For key_performance =2 123 ; loop on concerned points and drawing of the segment. 124 ; comments: we use plots instead of plot because plots is faster. 122 125 for pt = 0L, n_elements(lx)-1 do BEGIN 123 126 i = lx[pt] & j = ly[pt] … … 132 135 ENDIF 133 136 ; 134 ; on trace les segments horizontaux:137 ; We trace horizontal segments: 135 138 ; 136 tempdeux = systime(1) ; pour key_performance =2139 tempdeux = systime(1) ; For key_performance =2 137 140 liste = where(mask+shift(mask, 0, -1) EQ 1) 138 141 IF liste[0] NE -1 THEN BEGIN 139 142 ly = liste/nx & lx = temporary(liste)-nx*ly 140 indice = where(lx NE 0) ; on ne prend pas les points de la premiere colonne143 indice = where(lx NE 0) ; We do not take point sof the first column. 141 144 if indice[0] EQ -1 then return 142 145 lx = lx[indice] & ly = ly[temporary(indice)] 143 146 IF testvar(var = key_performance) EQ 2 THEN $ 144 147 print, 'temps tracemask: liste traits horizontaux', systime(1)-tempdeux 145 tempdeux = systime(1) ; pour key_performance =2148 tempdeux = systime(1) ; For key_performance =2 146 149 for pt = 0L, n_elements(lx)-1 do BEGIN 147 150 i = lx[pt] & j = ly[pt]
Note: See TracChangeset
for help on using the changeset viewer.