Changeset 226 for trunk/SRC/ToBeReviewed/PLOTS/DESSINE/tvplus.pro
- Timestamp:
- 03/16/07 10:22:26 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/ToBeReviewed/PLOTS/DESSINE/tvplus.pro
r163 r226 7 7 ; Enhanced version of tvscl 8 8 ; 9 ; @categories quick exploration of 2D arrays 10 ; 11 ; INPUTS: 9 ; @categories quick exploration of 2D arrays 12 10 ; 13 11 ; @param Z2D {in}{required} … … 21 19 ; of cellsize that forces tvplus to create a window larger than 22 20 ; the screen, a "scrolling window" will be displayed instead of a 23 ; regular window. Unfortunately the nice function nalities of tvplus21 ; regular window. Unfortunately the nice functionalities of tvplus 24 22 ; are not coded for "scrolling window" case... 25 23 ; … … 33 31 ; The color number that should be used for the mask values. 34 32 ; 35 ; @keyword OFFSET 33 ; @keyword OFFSET 36 34 ; 2 elements vector used by tvplus itself when showing zoom. 37 35 ; It is used to shift the ranges of xaxis and yaxis. 38 ; For example: tvplus,sst[x1:x2,y1:y2],off est=[x1,y1]39 ; 40 ; @keyword MASK 36 ; For example: tvplus,sst[x1:x2,y1:y2],offset=[x1,y1] 37 ; 38 ; @keyword MASK 41 39 ; The mask value. Note that if abs(mask) < 1.e6, then the 42 40 ; exact value of the mask is used to find the maskwd point. … … 67 65 ; @keyword _EXTRA 68 66 ; used to pass keywords to TV, PLOT, COLORBAR 69 ; 70 ; @restrictions 67 ; 68 ; @restrictions 71 69 ; use your mouse to scan the array values... 72 70 ; left button : mouse position and associated array value … … 74 72 ; right button : quit 75 73 ; 76 ; the nice function nalities of tvplus are not coded74 ; the nice functionalities of tvplus are not coded 77 75 ; for "scrolling window" case... 78 76 ; … … 102 100 arr = reform(float(z2d)) 103 101 ;------------------------------------------------------------ 104 ; check the size of the input array 102 ; check the size of the input array 105 103 ;------------------------------------------------------------ 106 104 if (size(arr))[0] NE 2 then begin … … 130 128 ;------------------------------------------------------------ 131 129 ; Compute the size (in pixel) of the square representing 1 132 ; point of the input array 130 ; point of the input array 133 131 ;------------------------------------------------------------ 134 132 dimensions = GET_SCREEN_SIZE() 135 if n_elements(cellsize) EQ 0 then BEGIN 133 if n_elements(cellsize) EQ 0 then BEGIN 136 134 cellsize = min(floor(dimensions/(size(z2d))[1: 2]*.75)) 137 ENDIF ELSE $ 135 ENDIF ELSE $ 138 136 ; we need to use a scrolling bar window 139 137 if cellsize GE min(floor(dimensions/(size(z2d))[1: 2]*.75)) then scrolling = 1 … … 145 143 ; Change the value of the masked value for the min of the non-masked values 146 144 ;------------------------------------------------------------ 147 if n_elements(mask) then BEGIN 148 if abs(mask) LT 1e6 then BEGIN 145 if n_elements(mask) then BEGIN 146 if abs(mask) LT 1e6 then BEGIN 149 147 masked = where(arr EQ mask) 150 148 if masked[0] NE -1 then arr[masked] = min(arr[where(arr NE mask)]) 151 ENDIF ELSE BEGIN 149 ENDIF ELSE BEGIN 152 150 masked = where(abs(arr) GE abs(mask)/10.) 153 151 if masked[0] NE -1 then arr[masked] = min(arr[where(abs(arr) LT abs(mask)/10.)]) … … 157 155 ; apply min/max keywords 158 156 ;------------------------------------------------------------ 159 if n_elements(min) NE 0 then BEGIN 157 if n_elements(min) NE 0 then BEGIN 160 158 arr = min > arr 161 159 truemin = min 162 160 ENDIF ELSE truemin = min(arr) 163 if n_elements(max) NE 0 then BEGIN 161 if n_elements(max) NE 0 then BEGIN 164 162 arr = arr < max 165 163 truemax = max … … 171 169 ENDIF 172 170 ;------------------------------------------------------------ 173 ; apply other keywords (nointerp, c_nan, c_mask) 171 ; apply other keywords (nointerp, c_nan, c_mask) 174 172 ;------------------------------------------------------------ 175 173 if NOT keyword_set(nointerp) then BEGIN … … 177 175 m = 1.*(ncolors-1)/(truemax-truemin) 178 176 p = bottom-1.*truemin*m 179 arr = round(m*temporary(arr)+p) 180 endif 181 ; set c_nan for NaN values 177 arr = round(m*temporary(arr)+p) 178 endif 179 ; set c_nan for NaN values 182 180 if keyword_set(nan) then begin 183 181 if n_elements(c_nan) NE 0 THEN arr[nanindex] = c_nan < (ncolmax -1) $ … … 190 188 arr = byte(temporary(arr)) 191 189 ; increase the size of the array in order to be displayed 192 ; with the suitable size 190 ; with the suitable size 193 191 szarr = size(arr, /dimensions) 194 192 arr = congrid(temporary(arr), szarr[0]*cellsize, szarr[1]*cellsize) … … 205 203 if NOT keyword_set(window) then window = 0 206 204 window, window, xsize = nx+marginpix[0]+marginpix[1] $ 207 , ysize = ny+marginpix[2]+marginpix[3] 205 , ysize = ny+marginpix[2]+marginpix[3] 208 206 ; for 24 bits colors, make sure thate the background color is the good one... 209 207 if !d.n_colors gt 256 then BEGIN … … 215 213 tv, arr, marginpix[0], marginpix[2], _EXTRA = ex 216 214 ; 217 ; axis and plot frame 215 ; axis and plot frame 218 216 ; 219 217 ; get the normalized position of the tv (we just done above) … … 233 231 xenvsauve = !x & yenvsauve = !y & penvsauve = !p 234 232 ; 235 ; draw the colorbar 233 ; draw the colorbar 236 234 ; 237 235 IF truemin ne truemax THEN BEGIN … … 244 242 ENDIF 245 243 ; !p.position = poscadre 246 ENDIF ELSE BEGIN 244 ENDIF ELSE BEGIN 247 245 ;------------------------------------------------------------ 248 246 ; scrolling bar window case... … … 261 259 , yvisible = round(.7*dimensions[1]) < (size(arr))[2], /register, congrid = 0, show_full = 0 262 260 return 263 ENDELSE 261 ENDELSE 264 262 ;------------------------------------------------------------ 265 263 ; Use the mouse to get nice functionalities
Note: See TracChangeset
for help on using the changeset viewer.