Changeset 226 for trunk/SRC/ToBeReviewed/PLOTS/VECTEUR/vecteur.pro
- Timestamp:
- 03/16/07 10:22:26 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/ToBeReviewed/PLOTS/VECTEUR/vecteur.pro
r163 r226 1 1 ;+ 2 ; @file_comments 3 ; 4 ; 2 ; @file_comments 3 ; 4 ; 5 5 ; @categories 6 ; 7 ; 8 ; @param ANGLE 9 ; 6 ; 7 ; 8 ; @param ANGLE 10 9 ; 11 10 ; @returns 12 ; 13 ; 11 ; 14 12 ; @restrictions 15 ; 16 ; 13 ; 17 14 ; @examples 18 15 ; 19 ;20 16 ; @history 21 ;22 17 ; 23 18 ; @version … … 29 24 ; by rapport at the x axis and which must do 1 cm on the drawing. 30 25 ; Angle can be an array. 31 ; 26 ; 32 27 ; 33 28 ; … … 53 48 ; 54 49 ;+ 55 ; @file_comments 56 ; 57 ; 50 ; @file_comments 51 ; 52 ; 58 53 ; @categories 59 ; 60 ; 54 ; 55 ; 61 56 ; @param U 62 57 ; … … 64 59 ; @param V 65 60 ; 66 ; 67 ; @param W 68 ; 61 ; @param W 69 62 ; 70 63 ; @restrictions 71 ; 72 ; 64 ; 73 65 ; @examples 74 66 ; 75 ;76 67 ; @history 77 ;78 68 ; 79 69 ; @version … … 87 77 compile_opt idl2, strictarrsubs 88 78 ; 89 IF n_elements(w) NE 0 THEN BEGIN 79 IF n_elements(w) NE 0 THEN BEGIN 90 80 norme = sqrt(u^2.+v^2.+w^2.) 91 81 ind = where(norme NE 0) … … 98 88 u[ind] = u[ind]/norme[ind] 99 89 v[ind] = v[ind]/norme[ind] 100 ENDELSE 90 ENDELSE 101 91 END 102 92 ;------------------------------------------------------------ … … 111 101 ; and is position on the sphere). 112 102 ; 113 ; @categories 103 ; @categories 114 104 ; Graphics 115 ; 105 ; 116 106 ; @param COMPOSANTEU {in}{required} 117 ; It is the u component of the vector to be traced. This 2d array has the 107 ; It is the u component of the vector to be traced. This 2d array has the 118 108 ; same dimension that reduitindice2d (see further) 119 ; 109 ; 120 110 ; @param COMPOSANTEV {in}{required} 121 ; It is the v component of the vector to be traced. This 2d array has the 111 ; It is the v component of the vector to be traced. This 2d array has the 122 112 ; same dimension that reduitindice2d (see further) 123 ; 113 ; 124 114 ; @param NORMEVECTEUR 125 115 ; 126 116 ; 127 117 ; @param INDICE2D {in}{required} 128 ; It in an index allowing to to pass from an jpi or jpj array to the zoom 118 ; It in an index allowing to to pass from an jpi or jpj array to the zoom 129 119 ; on which we do the drawing 130 ; 120 ; 131 121 ; @param REDUITINDICE2D {in}{required} 132 ; It is an index allowing to pass from an array defined by indice2d to the 133 ; array for which we really have vectors to be traced (to be clear, it is 122 ; It is an index allowing to pass from an array defined by indice2d to the 123 ; array for which we really have vectors to be traced (to be clear, it is 134 124 ; for example when we trace only one vector on two). 135 125 ; 136 126 ; @keyword CMREF {default=between .5 and 1.5 cm} 137 ; The length in cm that must measure the arrow normed normeref. By default, 127 ; The length in cm that must measure the arrow normed normeref. By default, 138 128 ; it is adjusted to other drawing and included between .5 and 1.5 cm. 139 129 ; 140 130 ; @keyword MISSING 141 ; The value of a missing value. Do not use this keyword. Fixed at 1e5 by 131 ; The value of a missing value. Do not use this keyword. Fixed at 1e5 by 142 132 ; ajoutvect.pro 143 ; 144 ; @keyword NORMEREF 133 ; 134 ; @keyword NORMEREF 145 135 ; The norme of the reference arrow. 146 136 ; 147 137 ; @keyword VECTCOLOR {default=0} 148 138 ; The color of the arrow. Black by default (color 0) 149 ; 139 ; 150 140 ; @keyword VECTTHICK {default=1} 151 ; The thick of the arrow. 141 ; The thick of the arrow. 152 142 ; 153 143 ; @keyword VECTREFPOS 154 ; Vector composed of 2 elements specifying the position on DATA coordinates 155 ; from the beginning of the reference vector. By default at the right bottom 144 ; Vector composed of 2 elements specifying the position on DATA coordinates 145 ; from the beginning of the reference vector. By default at the right bottom 156 146 ; of the drawing. 157 147 ; … … 161 151 ; @keyword NOVECTREF 162 152 ; To delete the display of the reference vector. 163 ; 153 ; 164 154 ; @keyword _EXTRA 165 ; Used to pass your keywords 166 ; 167 ; @uses 155 ; Used to pass your keywords 156 ; 157 ; @uses 168 158 ; common.pro 169 159 ; … … 179 169 ; 180 170 ; @version 181 ; $Id$ 171 ; $Id$ 182 172 ; 183 173 ;- … … 209 199 msk = replicate(1, nx, ny) 210 200 if keyword_set(missing) then terre = where(abs(zu) GE missing/10) ELSE terre = -1 211 if terre[0] NE -1 then BEGIN 201 if terre[0] NE -1 then BEGIN 212 202 msk[terre] = 0 213 203 zu[terre] = 0 … … 216 206 ENDIF 217 207 ; 218 ; Stage 1: 219 ; 220 ; Given that the directions and the sense that the vector has on the sphere, 221 ; we have to try to determinate this direction and the sense that the vector 208 ; Stage 1: 209 ; 210 ; Given that the directions and the sense that the vector has on the sphere, 211 ; we have to try to determinate this direction and the sense that the vector 222 212 ; will have on the screen once it will have been projected. 223 213 ; 224 ; In theory: on the sphere, a vector in a given point has for direction the 225 ; tangent at the circle passing by the center of the Earth and by the vector. 214 ; In theory: on the sphere, a vector in a given point has for direction the 215 ; tangent at the circle passing by the center of the Earth and by the vector. 226 216 ; So, find the direction once the projection is done, it is find the tangent 227 ; to the curve representing the projection of the circle on the 2d plan at the 228 ; point representing the projection of the starting point of the s here on the217 ; to the curve representing the projection of the circle on the 2d plan at the 218 ; point representing the projection of the starting point of the sphere on the 229 219 ; 2d plan. 230 ; 231 ; In practice we do no know the definition of the curve given by the projection 220 ; 221 ; In practice we do no know the definition of the curve given by the projection 232 222 ; of a circle so find its tangente in a point... 233 223 ; 234 224 ; What we do: 235 225 ; In a 3d cartesian reference, 236 ; a) We find coor inates of the point T (starting of the arrow) situed226 ; a) We find coordinates of the point T (starting of the arrow) situed 237 227 ; on the sphere. 238 228 ; b) To each point T, we determine local directions defined by the grid 239 229 ; on this point and on which coordinates (u,v) of the vector refer to. 240 230 ; These local directions are defined by gradients of glam and gphi. Once 241 ; we have obtain these directions, we consid arethem like orthogonal and231 ; we have obtain these directions, we consider them like orthogonal and 242 232 ; by norming them, we build an orthonormal reference (nu,nv) on which 243 233 ; coordinates (u,v) of the vector refer to. In the starting 3d cartesian … … 254 244 ; e) We pass coordinates of these points in normalized coordinates, then 255 245 ; in polar coordinates in order to find the angle and the direction they 256 ; de rtermine on the drawing.246 ; determine on the drawing. 257 247 ; 258 248 ; … … 280 270 ; points u[i,j] and u[i-1,j] (resp v[i,j] and v[i,j-1]) which define, for each 281 271 ; point on the sphere, local directions associated with u and v. These vectors 282 ; define a local orthonormal reference. 283 ; These vectors are built in a cartesian reference (cv_coord). We have choose a 272 ; define a local orthonormal reference. 273 ; These vectors are built in a cartesian reference (cv_coord). We have choose a 284 274 ; unity radius of the Earth (unit). 285 275 ; … … 294 284 uy = reform(r[1, *], nxgd, nygd) 295 285 uz = reform(r[2, *], nxgd, nygd) 296 ; calculation of nu 286 ; calculation of nu 297 287 nux = ux-shift(ux, 1, 0) 298 288 nuy = uy-shift(uy, 1, 0) … … 311 301 IF finite(glamv[0]*gphiv[0]) NE 0 THEN $ 312 302 coord_sphe = transpose([ [(glamv[indice2d])[*]], [(gphiv[indice2d])[*]], [radius[*]] ]) $ 313 ELSE coord_sphe = transpose([ [(glamt[indice2d])[*]], [(gphif[indice2d])[*]], [radius[*]] ]) 303 ELSE coord_sphe = transpose([ [(glamt[indice2d])[*]], [(gphif[indice2d])[*]], [radius[*]] ]) 314 304 r = cv_coord(from_sphere=coord_sphe,/to_rect,/degrees) 315 305 ; coordinates of points of the grid in cartesian. … … 317 307 vy = reform(r[1, *], nxgd, nygd) 318 308 vz = reform(r[2, *], nxgd, nygd) 319 ; calcul of nv 309 ; calcul of nv 320 310 nvx = vx-shift(vx, 0, 1) 321 311 nvy = vy-shift(vy, 0, 1) … … 383 373 ; Stage 1, e) 384 374 ; 385 r = convert_coord(glam,gphi,/data,/to_normal) 375 r = convert_coord(glam,gphi,/data,/to_normal) 386 376 x0 = r[0, *] ; normal coordinates of the beginning of the array. 387 y0 = r[1, *] ; 388 389 r = convert_coord(glam1,gphi1,/data,/to_normal) 377 y0 = r[1, *] ; 378 379 r = convert_coord(glam1,gphi1,/data,/to_normal) 390 380 x1 = r[0, *] ; normal coordinates of the ending of the array (Before scaling). 391 y1 = r[1, *] ; 381 y1 = r[1, *] ; 392 382 ; 393 383 ; tests to avoid that arrows be drawing out of the domain. … … 397 387 if out[0] NE -1 THEN x0[out] = !values.f_nan 398 388 ; 399 ; Following projections, there may are points at NaN when we pass in normal coordinates. 389 ; Following projections, there may are points at NaN when we pass in normal coordinates. 400 390 ; We delete these points. 401 391 ; … … 422 412 ; Now we take care of the norme... 423 413 ; 424 ; Automatic putting at the scale 425 ; 426 if NOT keyword_set(cmref) then BEGIN 414 ; Automatic putting at the scale 415 ; 416 if NOT keyword_set(cmref) then BEGIN 427 417 mipgsz = min(page_size, max = mapgsz) 428 418 sizexfeuille = mipgsz*key_portrait+mapgsz*(1-key_portrait) … … 438 428 cm = 1.*normeref/cmref 439 429 ; 440 ; We modify the array norme to an element having the value cm be represented 441 ; by a trait of lenght 1 cm on the paper. Norme contain the norme of vectors 430 ; We modify the array norme to an element having the value cm be represented 431 ; by a trait of lenght 1 cm on the paper. Norme contain the norme of vectors 442 432 ; we want to draw. 443 433 ; … … 446 436 ; 447 437 ; Stage 3 448 ; Now that we have the angle and the norme, we recuperate coordinates in 438 ; Now that we have the angle and the norme, we recuperate coordinates in 449 439 ; rectangular and we draw arrows. 450 440 ; … … 467 457 ; 468 458 if NOT keyword_set(novectref) then BEGIN 469 dx = cmref*cv_cm2normal(0) ; Leng htof the vector of reference in normalzed coordinates.459 dx = cmref*cv_cm2normal(0) ; Length of the vector of reference in normalzed coordinates. 470 460 if keyword_set(vectrefformat) then $ 471 461 normelegende = strtrim(string(normeref, format = vectrefformat), 1)+' ' $ … … 490 480 ; 491 481 492 if keyword_set(key_performance) NE 0 THEN print, 'temps vecteur', systime(1)-tempsun 482 if keyword_set(key_performance) NE 0 THEN print, 'temps vecteur', systime(1)-tempsun 493 483 ;------------------------------------------------------------ 494 484 ;------------------------------------------------------------ 495 485 return 496 END 497 498 499 500 486 END 487 488 489 490
Note: See TracChangeset
for help on using the changeset viewer.