Changeset 142 for trunk/SRC/ToBeReviewed/PLOTS/VECTEUR
- Timestamp:
- 07/21/06 14:47:49 (18 years ago)
- Location:
- trunk/SRC/ToBeReviewed/PLOTS/VECTEUR
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/ToBeReviewed/PLOTS/VECTEUR/ajoutvect.pro
r134 r142 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:ajoutvect 6 ; 7 ; PURPOSE:surimprimme des vecteur sur un champ tarce par plt 8 ; 9 ; CATEGORY:grafique 10 ; 11 ; CALLING SEQUENCE:ajoutvect,vecteur 12 ; 13 ; INPUTS: 14 ; vecteur: une structure a 2 elements contenant les 2 matrices U 15 ; et V des valeurs de la composante zonale et meridienne du 16 ; champ de vecteurs a tracer. 17 ; par ex: 5 ; 6 ; @file_comments 7 ; Overprint vectors in a field traced by plt. 8 ; 9 ; @categories 10 ; graphic 11 ; 12 ; @param VECTEUR {in}{required} 13 ; It is a structure with 2 elements containing we 2 matrixes U and V of 14 ; values of the zonal and meridian component of the fiel of vectors to 15 ; be traced. 16 ; For ex: 18 17 ; vecteur={matriceu:lec('unsurface'),matricev:lec('vnsurface')} 19 ; rq:le nom des elements de vecteur n''a aucune importance. 20 ; vecteur={u:lec('unsurface'),v:lec('vnsurface')} convient aussi 21 ; 22 ; KEYWORD PARAMETERS: 23 ; 24 ; /UNVECTSUR:un scalaire n on un tableau a 2 elements [n1,n2]. 25 ; dans le premier cas, on tracera un vecteur sur n suivant les 26 ; x et les y. 27 ; dans le second cas on tracera un vecteur sur n1 suivant x 28 ; et un vecteur sur n2 suivant y 29 ; Rq; pour tracer tous les vecteurs suivant y et 1 sur 2 suivant 30 ; x mettre unvectsur=[2,1] 31 ; 32 ; VECTMIN=norme minimun des vecteurs a tracer 33 ; 34 ; VECTMAX=norme minimun des vecteurs a tracer 35 ; 36 ; OUTPUTS: 37 ; 38 ; COMMON BLOCKS: 39 ; common.pro 40 ; 41 ; SIDE EFFECTS: 42 ; 43 ; RESTRICTIONS: 44 ; 45 ; EXAMPLE: 46 ; 47 ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr) 18 ; rq:the name of elements of vector does not have any importance. 19 ; vecteur={u:lec('unsurface'),v:lec('vnsurface')} goes well too. 20 ; 21 ; @keyword UNVECTSUR 22 ; It is a scalar n or an array with 2 elements [n1,n2]. 23 ; In the first case, we will trace a vector on n following x and y. 24 ; In the second case, we will trace a vector on n1 following x and a 25 ; vector n2 following n2 26 ; Comments: To trace all vectors following y and one vector on two 27 ; following x, put unvectsur=[2,1] 28 ; 29 ; @keyword VECTMIN {in}{required} 30 ; Minimum norme of vectors to be traced 31 ; 32 ; @keyword VECTMAX {in}{required} 33 ; Maximum norme of vectors to be traced 34 ; 35 ; @keyword _EXTRA 36 ; Used to pass your keywords 37 ; 38 ; @uses 39 ; common.pro 40 ; 41 ; @history 42 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 48 43 ; 10/3/1999 49 44 ; 11/6/1999 compatibilite avec NAN et la lecture 50 45 ; des structures. 46 ; 47 ; @version 48 ; $Id$ 49 ; 51 50 ;- 52 51 ;------------------------------------------------------------ … … 58 57 ; 59 58 @common 60 tempsun = systime(1) ; pour key_performance59 tempsun = systime(1) ; For key_performance 61 60 ;---------------------------------------------------------------------------- 62 61 ; … … 66 65 v = checkfield(v, 'plt', TYPE = 'xy', /NOQUESTION) 67 66 ;----------------------------------------------------------- 68 ;----------------------------------------------------------- -69 ; on recupere les eventuelles info sur les champs70 ;----------------------------------------------------------- -67 ;----------------------------------------------------------- 68 ; We recuperate possible informations on fields 69 ;----------------------------------------------------------- 71 70 grilleu = litchamp(vecteur.(0), /grid) 72 71 if grilleu EQ '' then grilleu = 'U' … … 82 81 endif 83 82 ;------------------------------------------------------------ 84 ; on trouve les points que u et v ont en communs83 ; We find common points between u and v 85 84 ;------------------------------------------------------------ 86 85 if interpolle then begin … … 96 95 indice2d = indice2d[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1] 97 96 ;------------------------------------------------------------ 98 ; extraction de u et v sur le domaine qui convient97 ; extraction of u and v on the appropriated domain 99 98 ;------------------------------------------------------------ 100 99 case 1 of … … 122 121 endcase 123 122 ;------------------------------------------------------------------ 124 ; on reform u et v pour s'assurer qu'aucune dimension n'a ete ecrasee123 ; We reshape u and v to make sure that none dimension has been erased. 125 124 ;------------------------------------------------------------------ 126 125 if ny EQ 1 then begin … … 129 128 endif 130 129 ;------------------------------------------------------------------ 131 ; construction de u et v aux pts T130 ; construction of u and v at points T 132 131 ;----------------------------------------------------------- 133 132 a=u[0,*] … … 138 137 if NOT keyword_set(key_periodic) OR nx NE jpi then v[*,0]=a 139 138 ;---------------------------------------------------------------------------- 140 ; attribution du mask et des tableau de longitude et latitude141 ; on recupere la grille complette pour etablir un grand mask etendu ds les 4142 ; directions pour couvrir les points pour lesquels un pt terre a ete pris en143 ; compte (faire un petit dessin...)139 ; attribution of the mask and of longitude and latitude arrays. 140 ; We recuperate the complete grid to establish a big mask extensive 141 ; in the four directions to cover points for which a land point has 142 ; been considerated (do a small drawing) 144 143 ;---------------------------------------------------------------------------- 145 144 vargrid='T' … … 155 154 endif 156 155 ;----------------------------------------------------------- 157 ; on masque u et v le long des cotes (la on l''on ne peut pas calculer158 ; la moyenne)159 ;----------------------------------------------------------- 160 ; extention dumask156 ; We mask u and v et v the long of coasts (the place where we 157 ; can not calculate the average) 158 ;----------------------------------------------------------- 159 ; extention of the mask 161 160 u = u*msku*shift(msku,1,0) 162 161 v = v*mskv*shift(mskv,0,1) … … 189 188 ENDIF 190 189 ;----------------------------------------------------------- 191 ; remise d''une grande valeur sur tous les points pour lesquelles on ne 192 ; put faire le calcul 190 ; Put back of a big value on all points for which we can do the calculation. 193 191 ;----------------------------------------------------------- 194 192 if interpolle then t2 = msku*shift(msku,1,0)*mskv*shift(mskv,0,1) $ … … 202 200 ENDIF 203 201 ;----------------------------------------------------------- 204 ; trace r qu'un vecteur sur202 ; trace only one vector one two 205 203 ;----------------------------------------------------------- 206 204 if keyword_set(unvectsur) then BEGIN ; 207 ; indx est un vecteur contenant les numero des colonnes a selectionner208 ; indy est un vecteur contenant les numero des lignes a selectionner205 ; indx is a vector containing number of columns to be selected. 206 ; indy is a vector containing number of lines to be selected. 209 207 if n_elements(unvectsur) EQ 1 then begin 210 208 indx = where((lindgen(nx) MOD unvectsur[0]) eq 0) … … 213 211 indx = where((lindgen(nx) MOD unvectsur[0]) eq 0) 214 212 indy = where((lindgen(ny) MOD unvectsur[1]) eq 0) 215 ENDELSE 216 ; a partir de indx et indy on va construire un tableau d''indices 2d 217 ; qui donnera les indices des points intersections des colonnes 218 ; specifiee par indx 213 ENDELSE 214 ; From indx and indy, we will construct an array which will give indexes 215 ; of intersections points of columns specified by indx. 219 216 indicereduit = indx#replicate(1,n_elements(indy))+nx*replicate(1,n_elements(indx))#indy 220 ; on reduit les tableaux qui vont etre passes avecteur.217 ; We reduce arrays which will be passed to vecteur. 221 218 u = u[indicereduit] 222 219 v = v[indicereduit] … … 233 230 endif 234 231 ;----------------------------------------------------------- 235 ; trace des vecteurs232 ; Drawing of vectors. 236 233 ;---------------------------------------------------------- 237 234 vecteur, u, v, tabnorme, indice2d, indicereduit, missing=1e5, _extra = ex 238 235 ;----------------------------------------------------------- 239 ; on complete la legende236 ; We complete the caption. 240 237 ;----------------------------------------------------------- 241 238 if terre[0] ne -1 then mini = min(tabnorme[where(t2 eq 1)], max = maxi, /nan) $ -
trunk/SRC/ToBeReviewed/PLOTS/VECTEUR/vecteur.pro
r134 r142 1 ;------------------------------------------------------------2 ;------------------------------------------------------------3 ;------------------------------------------------------------4 ;+5 ; NAME:vecteur6 ;7 ; PURPOSE: trace des vecteurs (meme situees sur une grille tordue) sur8 ; n''importe quelle projection, de telle sorte que tous les vecteurs9 ; aient une norme comparable sur le dessin (en clair, un vecteur qui10 ; doit faire 1cm le fait quelque soit la projection et sa position sur11 ; la sphere)12 ;13 ; CATEGORY:trace de vecteur14 ;15 ; CALLING SEQUENCE:vecteur, composanteu, composantev, normevecteur, indice2d, reduitindice2d16 ;17 ; INPUTS: COMPOSANTEU et COMPOSANTEV: ce sont les composantes des18 ; vecteurs a tracer. Ces tableaux 2d ont la meme dimension que19 ; reduitindice2d (cf apres).20 ; INDICE2D: indice permettant de passer d''un tableau jpi,jpj au21 ; zoom surlequel on fait le dessin.22 ; REDUITINDICE2D: indice permettant de passer d''un tableau23 ; definit par indice2d au tableau pourlequel on a reelement des24 ; vecteurs a tracer (en clair: c''est par ex qd on ne trace par exemple25 ; que un vecteur sur 2)26 ;27 ; KEYWORD PARAMETERS:28 ;29 ; CMREF: la longeur en cm sur le papier que diot faire la fleche30 ; de norme normeref. par defaut ajuste au dessin et compris entre31 ; .5 et 1.5 cm32 ;33 ; MISSING: la valeur d''une missing value. ne pas utilisder ce34 ; mot cle. fixe a 1e5 par ajoutvect.pro35 ;36 ; NORMEREF: la norme de la fleche de reference. par defaut on37 ; essaie de faire qqch qui colle pas trop mal!38 ;39 ; VECTCOLOR: la couleur de la fleche. Par defaut noir (couleur 0)40 ;41 ; VECTTHICK; l''epaissuer de la fleche. par defaut 1.42 ;43 ; VECTREFPOS: vecteur de 2 elements specifiant la position en44 ; coordonnees DATA du debut du vecteur de reference. Par defaut45 ; en bas a droite du dessin.46 ;47 ; VECTREFFORMAT: format a utiliser pour specifier la norme du48 ; vecteur de reference.49 ;50 ; /NOVECTREF: pour supprimer l'affichage du vecteur de reference.51 ;52 ; OUTPUTS:53 ;54 ; COMMON BLOCKS:common.pro55 ;56 ; SIDE EFFECTS:57 ;58 ; RESTRICTIONS:59 ;60 ; EXAMPLE:61 ;62 ; MODIFICATION HISTORY:63 ; Creation : 13/02/98 G. Roullet (grlod@lodyc.jussieu.fr)64 ; Modification : 14/01/99 realise la transformation65 ; spherique<->cartesien G. Roullet66 ; 12/03/99 verification de la routine G. Roullet67 ; 8/11/1999:68 ; G. Roullet et Sebastien Masson (smasson@lodyc.jussieu.fr)69 ; adaptation pour les zoom. reverification...traitement separe de la70 ; direction et de la norme des vecteurs. mots cles NORMEREF et CMREF.71 ;-72 ;------------------------------------------------------------73 ;------------------------------------------------------------74 ;------------------------------------------------------------75 76 1 FUNCTION cv_cm2normal, angle 77 2 ; 78 ; donne la longeur en coordonnes normales d''un trait ortiente de79 ; angle par rapport a l''axe des x et qui doit faire 1 cm sur le80 ; dessin.81 ; angle peut etre un tableau.3 ; Give the lenth in normal coordinates of a trait oriented of an angle 4 ; by rapport at the x axis and which must do 1 cm on the drawing. 5 ; Angle can be an array. 6 ; 82 7 ; 83 8 ; … … 85 10 ; 86 11 @common 87 ; quelle est la longeur en coordonnees normales d''un trait qui fera 188 ; cm sur le parier et qui est parallele ax?12 ; What is the lenth in normal coordinates of a trait which will do 1 cm 13 ; on the paper an which is parallel to x? 89 14 mipgsz = min(page_size, max = mapgsz) 90 15 sizexfeuille = mipgsz*key_portrait+mapgsz*(1-key_portrait) … … 92 17 cm_en_normal = 1./sizexfeuille 93 18 ; 94 ; si le rapport d''aspect de la fenetre n''est pas egale a 1, la95 ; longeur en coordonees normalise d''un trait de 1cm varie suivant96 ; l''angle polaire de cetrait.19 ; If the aspect rapport of the window is not equal to 1, the lenth in 20 ; normalized coordinates of a trait of 1 cm vary following the polar 21 ; angle of this trait. 97 22 ; 98 23 aspect = sizexfeuille/sizeyfeuille … … 104 29 PRO normalise, u, v, w 105 30 ; 106 ; normali se le vecteur31 ; normalize the vector 107 32 ; 108 33 ; … … 122 47 ENDELSE 123 48 END 49 ;------------------------------------------------------------ 50 ;------------------------------------------------------------ 51 ;------------------------------------------------------------ 52 ;+ 53 ; 54 ; @file_comments 55 ; Trace vectors (even if they are on a deformed grid) on any projection. 56 ; In this way, all vectors have a comparable norme on the drawing (to be 57 ; clear, a vector which measure 1 cm measure it, no matter the projection 58 ; and is position on the sphere). 59 ; 60 ; @categories 61 ; graphic 62 ; 63 ; @param COMPOSANTEU {in}{required} 64 ; It is the u component of the vector to be traced. This 2d array has the 65 ; same dimension that reduitindice2d (see further) 66 ; 67 ; @param COMPOSANTEV {in}{required} 68 ; It is the v component of the vector to be traced. This 2d array has the 69 ; same dimension that reduitindice2d (see further) 70 ; 71 ; @param INDICE2D {in}{required} 72 ; It in an index allowing to to pass from an jpi or jpj array to the zoom 73 ; on which we do the drawing 74 ; 75 ; @param REDUITINDICE2D {in}{required} 76 ; It is an index allowing to pass from an array defined by indice2d to the 77 ; array for which we really have vectors to be traced (to be clear, it is 78 ; for example when we trace only one vector on two). 79 ; 80 ; @keyword CMREF 81 ; The lenth in cm that must measure the arrow normed normeref. By default, 82 ; it is ajusted t othe drawing and included between .5 and 1.5 cm. 83 ; 84 ; @keyword MISSING 85 ; The value of a missing value. Do not use this keyword. Fixed at 1e5 by 86 ; ajoutvect.pro 87 ; 88 ; @keyword NORMEREF 89 ; The norme of the reference arrow. 90 ; 91 ; @keyword VECTCOLOR 92 ; The color of the arrow. Black by default (color 0) 93 ; 94 ; @keyword VECTTHICK 95 ; The thick of the arrow. 1 by default 96 ; 97 ; @keyword VECTREFPOS 98 ; Vector composed of 2 elements specifing the position on DATA coordinates 99 ; from de begining of the reference vector. By default at the right bottom 100 ; of the drawing. 101 ; 102 ; @keyword VECTREFFORMAT 103 ; The format to be used to specify the norme of the reference vector. 104 ; 105 ; @keyword NOVECTREF 106 ; To delete the display of the reference vector. 107 ; 108 ; @keyword _EXTRA 109 ; Used to pass your keywords 110 ; 111 ; @uses 112 ; common.pro 113 ; 114 ; @history 115 ; Creation : 13/02/98 G. Roullet (grlod@lodyc.jussieu.fr) 116 ; Modification : 14/01/99 realise la transformation 117 ; spherique<->cartesien G. Roullet 118 ; 12/03/99 verification de la routine G. Roullet 119 ; 8/11/1999: 120 ; G. Roullet et Sebastien Masson (smasson@lodyc.jussieu.fr) 121 ; adaptation pour les zoom. reverification...traitement separe de la 122 ; direction et de la norme des vecteurs. mots cles NORMEREF et CMREF. 123 ; 124 ; @version 125 ; $Id$ 126 ; 127 ;- 128 ;------------------------------------------------------------ 129 ;------------------------------------------------------------ 130 ;------------------------------------------------------------ 124 131 PRO vecteur, composanteu, composantev, normevecteur, indice2d, reduitindice2d $ 125 132 , CMREF = cmref, MISSING = missing, NORMEREF = normeref $ … … 130 137 ; 131 138 @common 132 tempsun = systime(1) ; pour key_performance139 tempsun = systime(1) ; For key_performance 133 140 ; 134 141 ; … … 153 160 ENDIF 154 161 ; 155 ; Etape 1: 156 ; 157 ; etant donne la direction et le sens que le vecteur a sur la 158 ; sphere, il faut se debrouiller pour determiner cette direction et le 159 ; sens qu'aura le vecteur sur l''ecran ou la feuille une fois qu''il 160 ; aura ete projete. 161 ; 162 ; En theorie: sur la sphere, un vecteur en un point donne a pour 163 ; direction la tangente au cercle qui passe par le centre de la terre 164 ; et par le vecteur. Donc trouver la direction une fois la projection 165 ; faite ds le plan 2d, c''est trouver la tangente a la courbe 166 ; representant la projection du cercle sur le plan 2d au point 167 ; representant la projection du point de depart de la shere sur le 168 ; plan 2d!!! 169 ; 170 ; En pratique on ne connait pas la definition de la courbe que donne 171 ; la projection d''un cercle alors trouver sa tangente en un point... 172 ; 173 ; Ce que l''on fait: 174 ; Ds un repere cartesien 3d, 175 ; a) on trouve les coordonnees du point T (debut de la fleche) 176 ; situe sur la shere. 177 ; b) pour chaque point T on determine les directions locales 178 ; definies par la grille en ce point et auxquelles se rapportent 179 ; les coordonnes (u,v) du vecteur. Ces directions locales sont 180 ; definies par les gradiants des glam et gphi. Une fois ces 181 ; directions obtenues, on les considere comme orthogonales et en 182 ; les normant on construit un repere orthonormal (nu,nv) auquel se 183 ; rapporte les coordonnes (u,v) du vecteur. Ds le repere 184 ; cartesien 3d de depart, le vecteur est definit par: 185 ; V=u*nu+v*nv (ou V, nu et nv sont des vecteurs 3d et u et v des 186 ; scalaires) 187 ; c) pour approximer la tangente au cercle par la corde definie 188 ; par le debut et la fin de la fleche, on va normaliser V puis 189 ; le diviser par 100. 190 ; d) ceci nous permet de determiner les coordonnees ds le repere 191 ; cartesien 3d des extremites de la corde, on les passe en 192 ; coordonnes sphereriques de facon a recuperer les positions en 193 ; latitude longitude de ces points sur la sphere. 194 ; e) on passe les coordonnees de ces points en coordonnees 195 ; normalise puis en corrdonnes polaire de facon a trouver 196 ; l''angle et la direction qu''ils determinent sur le dessin... 197 ; 198 ; 199 ; etape 1, a) 200 ; 201 ; 202 ; coordonnes du point T (debut de la fleche) en coordonnes sheriques 162 ; Stage 1: 163 ; 164 ; Given that the directions and the sense that the vector has on the sphere, 165 ; we have to try to determinate this direction and the sense that the vector 166 ; will have on the screen once it will have been projected. 167 ; 168 ; In theory: on the sphere, a vector in a given point has for direction the 169 ; tangent at the circle passing by the center of the Earth and by the vector. 170 ; So, find the direction once the projection is done, it is find the tangent 171 ; to the curve representing the projection of the circle on the 2d plan at the 172 ; point representing the projection of the starting point of the shere on the 173 ; 2d plan. 174 ; 175 ; In practice we do no know the definition of the curve given by the projection 176 ; of a circle so find its tangente in a point... 177 ; 178 ; What we do: 179 ; In a 3d cartesian reference, 180 ; a) We find coorinates of the point T (starting of the arrow) situed 181 ; on the sphere. 182 ; b) To each point T, we determine local directions defined by the grid 183 ; on this point and on which coordinates (u,v) of the vector refer to. 184 ; These local directions are defined by gradients of glam and gphi. Once 185 ; we have obtain these directions, we considare them like orthogonal and 186 ; by norming them, we build an orthonormal reference (nu,nv) on which 187 ; coordinates (u,v) of the vector refer to. In the starting 3d cartesian 188 ; reference, the vector is defined by: 189 ; V=u*nu+v*nv 190 ; (where V, nu and nv are 3d vectors and u and v are scalars). 191 ; c) To approximate the tangente to the circle by the chord defined by 192 ; the beginning and the ending of the arrow, we will normalize V, and 193 ; then divide it by 100. 194 ; d) This allows us to determine coordinates of extremities of the chord 195 ; in the 3d cartesian reference. We pass them in spherical coordinates in 196 ; order to recuperate latitude and longitude position of these points on 197 ; the sphere. 198 ; e) We pass coordinates of these points in normalized coordinates, then 199 ; in polar coordinates in order to find the angle and the direction they 200 ; dertermine on the drawing. 201 ; 202 ; 203 ; Stage 1, a) 204 ; 205 ; 206 ; coordinates of the point T (beginning of the arrow) in spherical coordinates. 203 207 glam = glamt[indice2d[reduitindice2d]] 204 208 gphi = gphit[indice2d[reduitindice2d]] 205 209 ; 206 ; coordonnes du point T (debut de la fleche) dans le repere cartesien207 ; on utilise comme shere, une shere de rayon1.210 ; Coordinates of the point T (beginning of the arrow) in the cartesian reference. 211 ; For the sphere, we use a sphere with a radius of 1. 208 212 ; 209 213 radius = replicate(1,nx*ny) … … 215 219 z0 = reform(r[2, *], nx, ny) 216 220 ; 217 ; etape 1, b) 218 ; 219 ; Construction du vecteur nu (resp. nv), vecteur norme porte par 220 ; l''axe des points u[i,j] et u[i-1,j] (resp v[i,j] et v[i,j-1]) 221 ; qui definissent pour chaque point sur la shere les directions locales 222 ; associee a u et v. ces vecteurs definissent un repere orthonorme 223 ; local. 224 ; ces vecteurs sont construits dans un repere cartesien (cv_coord) 225 ; on a choisit un rayon de la terre unite (unit). 226 ; 227 ; definition de nu 221 ; Stage 1, b) 222 ; 223 ; Construction of a vector nu (resp. nv), vectr normed carried by the axis of 224 ; points u[i,j] and u[i-1,j] (resp v[i,j] and v[i,j-1]) which define, for each 225 ; point on the sphere, local directions associated with u and v. These vectors 226 ; define a local orthonormal reference. 227 ; These vectors are built in a cartesian reference (cv_coord). We have choose a 228 ; unity radius of the Earth (unit). 229 ; 230 ; definition of nu 228 231 radius = replicate(1,nxgd*nygd) 229 232 IF finite(glamu[0]*gphiu[0]) NE 0 THEN $ … … 231 234 ELSE coord_sphe = transpose([ [(glamf[indice2d])[*]], [(gphit[indice2d])[*]], [radius[*]] ]) 232 235 r = cv_coord(from_sphere=coord_sphe,/to_rect,/degrees) 233 ; coord onnes de points de la grille u en cartesien236 ; coordinates of points of the grid u in cartesian. 234 237 ux = reform(r[0, *], nxgd, nygd) 235 238 uy = reform(r[1, *], nxgd, nygd) 236 239 uz = reform(r[2, *], nxgd, nygd) 237 ; calcul denu240 ; calculation of nu 238 241 nux = ux-shift(ux, 1, 0) 239 242 nuy = uy-shift(uy, 1, 0) 240 243 nuz = uz-shift(uz, 1, 0) 241 ; conditions a ux limites244 ; conditions at extremities. 242 245 if NOT keyword_set(key_periodic) OR nxgd NE jpi then begin 243 246 nux[0, *] = nux[1, *] … … 245 248 nuz[0, *] = nuz[1, *] 246 249 ENDIF 247 ; reduction de la grille250 ; reduction of the grid 248 251 nux = nux[reduitindice2d] 249 252 nuy = nuy[reduitindice2d] 250 253 nuz = nuz[reduitindice2d] 251 ; definition denv254 ; definition of nv 252 255 IF finite(glamv[0]*gphiv[0]) NE 0 THEN $ 253 256 coord_sphe = transpose([ [(glamv[indice2d])[*]], [(gphiv[indice2d])[*]], [radius[*]] ]) $ 254 257 ELSE coord_sphe = transpose([ [(glamt[indice2d])[*]], [(gphif[indice2d])[*]], [radius[*]] ]) 255 258 r = cv_coord(from_sphere=coord_sphe,/to_rect,/degrees) 256 ; coord onnes de points de la grille v en cartesien259 ; coordinates of points of the grid in cartesian. 257 260 vx = reform(r[0, *], nxgd, nygd) 258 261 vy = reform(r[1, *], nxgd, nygd) 259 262 vz = reform(r[2, *], nxgd, nygd) 260 ; calcul denv263 ; calcul of nv 261 264 nvx = vx-shift(vx, 0, 1) 262 265 nvy = vy-shift(vy, 0, 1) 263 266 nvz = vz-shift(vz, 0, 1) 264 ; conditions a ux limites267 ; conditions at extremities 265 268 nvx[*, 0] = nvx[*, 1] 266 269 nvy[*, 0] = nvy[*, 1] 267 270 nvz[*, 0] = nvz[*, 1] 268 ; reduction de la grille271 ; reduction of the grid 269 272 nvx = nvx[reduitindice2d] 270 273 nvy = nvy[reduitindice2d] 271 274 nvz = nvz[reduitindice2d] 272 275 ; 273 ; normali sation276 ; normalization 274 277 ; 275 278 normalise, nux, nuy, nuz 276 279 normalise, nvx, nvy, nvz 277 280 ; 278 ; etape 1, c)279 ; 280 ; coord onnes du vecteur V ds le repere cartesion281 ; Stage 1, c) 282 ; 283 ; coordinates of the vector V in the cartesian reference 281 284 ; 282 285 direcx = zu*nux + zv*nvx 283 286 direcy = zu*nuy + zv*nvy 284 287 direcz = zu*nuz + zv*nvz 285 ; normali sation du vecteur v288 ; normalization of the vector V 286 289 normalise, direcx, direcy, direcz 287 ; on divi se par 100.290 ; on divide by 100 288 291 direcx = direcx/100. 289 292 direcy = direcy/100. 290 293 direcz = direcz/100. 291 294 ; 292 ; etape 1, d)293 ; coord onnees de la pointe de la fleche dans le repere cartesien295 ; Stege 1, d) 296 ; coordinates of the point of the arrow in the cartesian reference. 294 297 295 298 x1 = x0 + direcx … … 297 300 z1 = z0 + direcz 298 301 299 ; coord onnees de la pointe en spherique302 ; coordinates of the point of the arrow in spherical coordinates. 300 303 301 304 coord_rect = transpose([ [x1[*]], [y1[*]], [z1[*]] ]) … … 305 308 306 309 ; 307 ; modif des glam tout se passe bien au niveau de la ligne de308 ; changement de date...attention, il ne faut pas couper les fleches309 ; qui sortent de la fenetre!310 ; test: si il sort du cadre mais qu''avec un +/- 360 il y rentre on le311 ; modifie...310 ; modification of glams. Everything take place at the level of the line 311 ; of changing of date... BEWARE, do not cut arrow which goes out of the 312 ; window! 313 ; test: If it goes out of the frame, but, thanks to +/- 360° it come in, 314 ; we modify it 312 315 ; 313 316 ind = where(glam1 LT !x.range[0] AND glam1+360. LE !x.range[1]) … … 322 325 ; 323 326 ; 324 ; etape 1, e)327 ; Stage 1, e) 325 328 ; 326 329 r = convert_coord(glam,gphi,/data,/to_normal) 327 x0 = r[0, *] ; coordonnes normales du debut de la fleche330 x0 = r[0, *] ; normal coordinates of the beginning of the array. 328 331 y0 = r[1, *] ; 329 332 330 333 r = convert_coord(glam1,gphi1,/data,/to_normal) 331 x1 = r[0, *] ; coordonnes normales de la fin de la fleche (avant scaling)334 x1 = r[0, *] ; normal coordinates of the ending of the array (Before scaling). 332 335 y1 = r[1, *] ; 333 336 ; 334 ; tests pour eviter que des fleches soient dessineees hors du domaine337 ; tests to avoid that arrows be drawing out of the domain. 335 338 ; 336 339 out = where(x0 LT !p.position[0] OR x0 GT !p.position[2] $ … … 338 341 if out[0] NE -1 THEN x0[out] = !values.f_nan 339 342 ; 340 ; suivant les projections, il peu y a voir des points a nan qd on341 ; passe en coordonnes normales. on supprime cespoints.343 ; Following projections, there may are points at NaN when we pass in normal coordinates. 344 ; We delete these points. 342 345 ; 343 346 nan = finite(x0*y0*x1*y1) … … 348 351 norme = norme[number] 349 352 ; 350 ; on definit le vecteur direction dans le repere normalise353 ; We define the vector direction in the normalize reference. 351 354 ; 352 355 dirx = x1-x0 353 356 diry = y1-y0 354 357 ; 355 ; on passe en polaire pour recuperer l''angle qui etait le but de 356 ; toute la partie 1!!! 358 ;We pass in polar coordinates to recuperate the angle which wasb the goal of all the first stage!!! 357 359 ; 358 360 … … 360 362 dirpol = msk*dirpol[0, *] 361 363 ; 362 ; 2eme etape....363 ; 364 ; maintenant on s''occupe de lanorme...365 ; 366 ; Mise a l''echelle automatique364 ; Stage 2 365 ; 366 ; Now we take care of the norme... 367 ; 368 ; Automatic putting at the scale 367 369 ; 368 370 if NOT keyword_set(cmref) then BEGIN … … 380 382 cm = 1.*normeref/cmref 381 383 ; 382 ; on modifie le tableau norme de facon a ce que un element qui a la 383 ; valeur cm soit represente par un trait de longueur 1cm sur le 384 ; papier. 385 ; norme contient la norme des vecteur que l''on veut dessiner 384 ; We modify the array norme to an element having the value cm be represented 385 ; by a trait of lenght 1 cm on the paper. Norme contain the norme of vectors 386 ; we want to draw. 386 387 ; 387 388 norme = 1/(1.*cm)*norme*cv_cm2normal(dirpol) 388 389 ; 389 390 ; 390 ; 3eme etape....391 ; maintenant qu''on a l''angle et la norme, et bien on recupere les392 ; coordonnes en rectangulaire et on dessine les fleches.391 ; Stage 3 392 ; Now that we have the angle and the norme, we recuperate coordinates in 393 ; rectangular and we draw arrows. 393 394 ; 394 395 r = cv_coord(from_polar = transpose([ [dirpol[*]], [norme[*]] ]), /to_rect) … … 399 400 y1 = y0+composantey 400 401 ; 401 ; c''est parti pour le trace !402 ; Drawing 402 403 ; 403 404 if NOT KEYWORD_SET(vectcolor) then vectcolor = 0 … … 407 408 , hsize = -.2, COLOR = vectcolor, THICK = vectthick 408 409 ; 409 ; D essine une fleche en bas a droite de la figure en guise de legende410 ; Draw an arrow at the right bottom of the drawing as a caption. 410 411 ; 411 412 if NOT keyword_set(novectref) then BEGIN 412 dx = cmref*cv_cm2normal(0) ; longuer du vecteur de reference en coordonnes normalisees.413 dx = cmref*cv_cm2normal(0) ; Lenght of the vector of reference in normalzed coordinates. 413 414 if keyword_set(vectrefformat) then $ 414 415 normelegende = strtrim(string(normeref, format = vectrefformat), 1)+' ' $ -
trunk/SRC/ToBeReviewed/PLOTS/VECTEUR/velovect.pro
r134 r142 1 ; $Id$2 ;3 ; Copyright (c) 1983-1998, Research Systems, Inc. All rights reserved.4 ; Unauthorized reproduction prohibited.5 6 1 ; 7 2 ;+ 8 ; NAME:9 ; VELOVECT10 3 ; 11 ; PURPOSE:12 ; 4 ; @file_comments 5 ; Produce a two-dimensional velocity field plot. 13 6 ; 14 ; 15 ; 7 ; A directed arrow is drawn at each point showing the direction and 8 ; magnitude of the field. 16 9 ; 17 ; CATEGORY: 18 ; Plotting, two-dimensional. 19 ; 20 ; CALLING SEQUENCE: 21 ; VELOVECT, U, V [, X, Y] 22 ; 23 ; INPUTS: 24 ; U: The X component of the two-dimensional field. 25 ; U must be a two-dimensional array. 26 ; 27 ; V: The Y component of the two dimensional field. Y must have 28 ; the same dimensions as X. The vector at point [i,j] has a 29 ; magnitude of: 30 ; 31 ; (U[i,j]^2 + V[i,j]^2)^0.5 32 ; 33 ; and a direction of: 34 ; 35 ; ATAN2(V[i,j],U[i,j]). 36 ; 37 ; OPTIONAL INPUT PARAMETERS: 38 ; X: Optional abcissae values. X must be a vector with a length 39 ; equal to the first dimension of U and V. 40 ; 41 ; Y: Optional ordinate values. Y must be a vector with a length 42 ; equal to the first dimension of U and V. 43 ; 44 ; KEYWORD INPUT PARAMETERS: 45 ; COLOR: The color index used for the plot. 46 ; 47 ; DOTS: Set this keyword to 1 to place a dot at each missing point. 48 ; Set this keyword to 0 or omit it to draw nothing for missing 49 ; points. Has effect only if MISSING is specified. 50 ; 51 ; LENGTH: Length factor. The default of 1.0 makes the longest (U,V) 52 ; vector the length of a cell. 53 ; 54 ; MISSING: Missing data value. Vectors with a LENGTH greater 55 ; than MISSING are ignored. 56 ; 57 ; OVERPLOT: Set this keyword to make VELOVECT "overplot". That is, the 58 ; current graphics screen is not erased, no axes are drawn, and 59 ; the previously established scaling remains in effect. 10 ; @categories 11 ; Plotting, two-dimensional. 60 12 ; 61 13 ; 62 ; Note: All other keywords are passed directly to the PLOT procedure 63 ; and may be used to set option such as TITLE, POSITION, 64 ; NOERASE, etc. 65 ; OUTPUTS: 66 ; None. 14 ; @param U {in}{required} 15 ; The X component of the two-dimensional field. 16 ; U must be a two-dimensional array. 67 17 ; 68 ; COMMON BLOCKS: 69 ; None. 18 ; @param V {in}{required} 19 ; The Y component of the two dimensional field. Y must have 20 ; the same dimensions as X. The vector at point [i,j] has a 21 ; magnitude of: 70 22 ; 71 ; SIDE EFFECTS: 72 ; Plotting on the selected device is performed. System 73 ; variables concerning plotting are changed. 23 ; (U[i,j]^2 + V[i,j]^2)^0.5 74 24 ; 75 ; RESTRICTIONS: 76 ; None. 25 ; and a direction of: 77 26 ; 78 ; PROCEDURE: 79 ; Straightforward. Unrecognized keywords are passed to the PLOT 80 ; procedure. 27 ; ATAN2(V[i,j],U[i,j]). 81 28 ; 82 ; MODIFICATION HISTORY: 29 ; @param X {in}{optional} 30 ; Optional abcissae values. X must be a vector with a length 31 ; equal to the first dimension of U and V. 32 ; 33 ; @param Y {in}{optional} 34 ; Optional ordinate values. Y must be a vector with a length 35 ; equal to the first dimension of U and V. 36 ; 37 ; @keyword COLOR 38 ; The color index used for the plot. 39 ; 40 ; @keyword DOTS 41 ; Set this keyword to 1 to place a dot at each missing point. 42 ; Set this keyword to 0 or omit it to draw nothing for missing 43 ; points. Has effect only if MISSING is specified. 44 ; 45 ; @keyword LENGTH 46 ; Length factor. The default of 1.0 makes the longest (U,V) 47 ; vector the length of a cell. 48 ; 49 ; @keyword MISSING 50 ; Missing data value. Vectors with a LENGTH greater 51 ; than MISSING are ignored. 52 ; 53 ; @keyword OVERPLOT 54 ; Set this keyword to make VELOVECT "overplot". That is, the 55 ; current graphics screen is not erased, no axes are drawn, and 56 ; the previously established scaling remains in effect. 57 ; 58 ; @keyword CLIP 59 ; 60 ; @keyword NOCLIP 61 ; 62 ; @keyword _EXTRA 63 ; Used to pass your keywords. 64 ; 65 ; @restrictions 66 ; Plotting on the selected device is performed. System 67 ; variables concerning plotting are changed. 68 ; Note: All other keywords are passed directly to the PLOT procedure 69 ; and may be used to set option such as TITLE, POSITION, 70 ; NOERASE, etc. 71 ; 72 ; @history 83 73 ; DMS, RSI, Oct., 1983. 84 74 ; For Sun, DMS, RSI, April, 1989. … … 96 86 ; February, 1998, DLD. Add support for CLIP and NO_CLIP keywords. 97 87 ; June, 1998, DLD. Add support for OVERPLOT keyword. 88 ; 89 ; Copyright (c) 1983-1998, Research Systems, Inc. All rights reserved. 90 ; Unauthorized reproduction prohibited. 91 ; 92 ; @version 93 ; $Id$ 94 ; 98 95 ;- 99 96 ;
Note: See TracChangeset
for help on using the changeset viewer.