Changeset 133 for trunk/SRC/Utilities
- Timestamp:
- 07/07/06 11:57:27 (18 years ago)
- Location:
- trunk/SRC/Utilities
- Files:
-
- 11 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Utilities/fitintobox.pro
r132 r133 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:fitintobox6 ; 7 ; PURPOSE: check that the input array has size and dimensions5 ; 6 ; @file_comments 7 ; Check that the input array has size and dimensions 8 8 ; compatible with the domain that was defined with the previous call 9 9 ; of domdef. 10 10 ; 11 ; CATEGORY: domain compatibility 12 ; 13 ; CALLING SEQUENCE: 14 ; res = fitintobox(field[, nx, ny, nz, firstx, firsty, firstz 15 ; , lastx, lasty, lastz]) 16 ; 17 ; INPUTS: 18 ; field: an array or a structure that can be read by the function 19 ; litchamp.pro 20 ; 21 ; nx, ny, nz, firstx, firsty, firstz, lastx, lasty, lastz: 22 ; optional parameters. If not given they will be define with a 23 ; call to the procedure grille.pro 24 ; 25 ; KEYWORD PARAMETERS: none 26 ; 27 ; OUTPUTS: an array with dimensions matching the domain 28 ; or -1 if there is an error... 29 ; 30 ; COMMON BLOCKS: cm_4mesh and cm_4cal 31 ; 32 ; SIDE EFFECTS: 33 ; 34 ; RESTRICTIONS: 35 ; 36 ; EXAMPLE: 37 ; 38 ; IDL> help, fitintobox(findgen(jpi,jpj)) 39 ; <Expression> FLOAT = Array[41, 3] 40 ; IDL> help, fitintobox(findgen(jpi,jpj,78)) 41 ; Error: 42 ; the array dimensions [180,148,78] are incompatible 43 ; with the the domain dimensions 44 ; [jpi/nx, jpj/ny, jpk/nz, jpt] = [180/41, 148/3, 31/31, 1] 45 ; <Expression> INT = -1 46 ; 47 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) 48 ; 10 juin 2000. 49 ; June 2005: S. Masson rewrite all. 11 ; @categories domain compatibility 12 ; 13 ; @param sz {in}{required} 14 ; 15 ; @param nx {in}{required} 16 ; 17 ; @param ny {in}{required} 18 ; 19 ; @param nz {in}{required} 20 ; 21 ; @param jpi {in}{required} 22 ; 23 ; @param jpj {in}{required} 24 ; 25 ; @param jpk {in}{required} 26 ; 27 ; @param jpt {in}{required} 28 ; 29 ; @returns -1 30 ; 31 ; @history Sebastien Masson (smasson@lodyc.jussieu.fr) 32 ; 10 juin 2000. 33 ; June 2005: S. Masson rewrite all. 34 ; 35 ; @version $Id$ 36 ; 37 ; @hidden 38 ; 50 39 ;- 51 40 ;------------------------------------------------------------ … … 67 56 RETURN, report(['Error: ' $ 68 57 , 'the array dimensions ' + tostr(sz) + ' are incompatible' $ 69 , 'with the the domain dimensions ' $ 58 , 'with the the domain dimensions ' $ 70 59 , '[jpi/nx, jpj/ny, jpk/nz, jpt] = [' $ 71 60 + strtrim(jpi, 1) + '/' + strtrim(nx, 1) $ … … 74 63 + ', ' + strtrim(jpt, 1) + ']'], /simple) 75 64 END 65 ; 66 ;+ 67 ; 68 ; @categories domain compatibility 69 ; 70 ; @param field {in}{required} an array or a structure that can be read by the function 71 ; litchamp.pro 72 ; 73 ; @param nx {in}{optional}{default=define by grille.pro} 74 ; 75 ; @param ny {in}{optional}{default=define by grille.pro} 76 ; 77 ; @param nz {in}{optional}{default=define by grille.pro} 78 ; 79 ; @param firstx {in}{optional}{default=define by grille.pro} 80 ; 81 ; @param firsty {in}{optional}{default=define by grille.pro} 82 ; 83 ; @param firstz {in}{optional}{default=define by grille.pro} 84 ; 85 ; @param lastx {in}{optional}{default=define by grille.pro} 86 ; 87 ; @param lasty {in}{optional}{default=define by grille.pro} 88 ; 89 ; @param lastz {in}{optional}{default=define by grille.pro} 90 ; 91 ; @keyword WDEPTH To specify that we are at W level 92 ; 93 ; @returns an array with dimensions matching the domain 94 ; or -1 if there is an error... 95 ; 96 ; @uses cm_4mesh 97 ; @uses cm_4cal 98 ; 99 ; @examples IDL> help, fitintobox(findgen(jpi,jpj)) 100 ; <Expression> FLOAT = Array[41, 3] 101 ; IDL> help, fitintobox(findgen(jpi,jpj,78)) 102 ; Error: 103 ; the array dimensions [180,148,78] are incompatible 104 ; with the the domain dimensions 105 ; [jpi/nx, jpj/ny, jpk/nz, jpt] = [180/41, 148/3, 31/31, 1] 106 ; <Expression> INT = -1 107 ; 108 ; @history Sebastien Masson (smasson@lodyc.jussieu.fr) 109 ; 10 juin 2000. 110 ; June 2005: S. Masson rewrite all. 111 ; 112 ; @version $Id$ 113 ;- 76 114 ;------------------------------------------------------------ 77 115 FUNCTION fitintobox, field, nx, ny, nz, firstx, firsty $ -
trunk/SRC/Utilities/linearequation.pro
r132 r133 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME: linearequation6 5 ; 7 ; PURPOSE:calcule une equation de droite du type ax+by+c=0 a partir 8 ; des coordonnees de 2 points. Rq: on peut avoir un tableau de couple 9 ; de points. 6 ; @file_comments 7 ; Calculate a linear equation of the type ax+by+c=0 8 ; thanks to coordinates of 2 points. 9 ; comment: we can have a table with pairs of points. 10 10 ; 11 ; CATEGORY:petit truc qui peut etre utile (sans boucles, ca va de soit!) 11 ; @categories utilities 12 ; 13 ; @param point1 {in}{required} This is the first point of(the) straight 14 ; line(s) whose we want to calculate equation(s) 12 15 ; 13 ; CALLING SEQUENCE:abc=linearequation(point1, point2) 14 ; 15 ; INPUTS: point1 et point2 dont deux point de(s) la droite(s) dont on 16 ; veut calculer l(es) equations(s). 17 ; deux possibilites sont possibles: 18 ; 1) point est un complexe ou un tableau de complexes, ou chaque 19 ; element du complexe est les coordonnees du point 20 ; 2) points est un tableau de reels de dimensions 2 21 ; ,nbre_de_droite. ou pour chaque ligne du tableau on a les 22 ; coordonnees du point. 16 ; @param point2 {in}{required} This is the second point of(the) straight 17 ; line(s) whose we want to calculate equation(s) 23 18 ; 24 ; KEYWORD PARAMETERS: 19 ; There is 2 possibilities: 20 ; 1) point is a complex or a table ofcomplex, where each element is the coordinates of the point. 21 ; 2) point is a table of real of dimension 2,number_of_straight_line. 22 ; For each row of the table, we have coordinates of the point. 25 23 ; 26 ; OUTPUTS:abc c''est un tableau de dimensions 3, nbre_de_droite, ou27 ; pour chaque ligne du tableau on obtient les 3 parametres a, b, c de28 ; l'equation de la droiteax+by+c=024 ; @returns abc is a table of dimension 3, number_of_straight_line, 25 ; where for each lign of the table we obtain the 3 parameters 26 ; a, b and c of the linear equation ax+by+c=0 29 27 ; 30 ; COMMON BLOCKS: 28 ; @examples IDL> abc=linearequation(complex(1,2),[3,4]) 29 ; IDL> print, abc[0]*1+abc[1]*2+abc[2] 30 ; 0.00000 31 31 ; 32 ; SIDE EFFECTS: 32 ; @history Sebastien Masson (smasson@lodyc.jussieu.fr) 33 ; 10 juin 2000 33 34 ; 34 ; RESTRICTIONS:35 ; @version $Id$ 35 36 ; 36 ; EXAMPLE:37 ; IDL> abc=linearequation(complex(1,2),[3,4])38 ; IDL> print, abc[0]*1+abc[1]*2+abc[2]39 ; 0.0000040 ;41 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)42 ; 10 juin 200043 37 ;- 44 38 ;------------------------------------------------------------ -
trunk/SRC/Utilities/lineintersection.pro
r132 r133 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME: lineintersection6 5 ; 7 ; PURPOSE: Calcule les coordonnees de l''intersection de 2 droites ou 8 ; d''une serie de 2 droites 6 ; @file_comments 7 ; Calculate coordinates of the intersection between 2 straight lines 8 ; or of a succession of 2 straight lines. 9 9 ; 10 ; CATEGORY:petit truc qui peut etre utile (sans boucles, ca va de soit!) 10 ; @categories utilities 11 ; 12 ; @param abc1 {in}{required} is the first table of dimension 3, number_of_pairs_of_straight_lines, 13 ; whose each line contain the 3 parameters a,b and c of the first linear 14 ; equation of the type ax+by+c=0 11 15 ; 12 ; CALLING SEQUENCE: point=lineintersection(abc1, abc2) 13 ; 14 ; INPUTS: abc est un tableau de dimensions 3, 15 ; nbre_de_couple_de_droites, dont chaque ligne contient les 3 16 ; parametres a, b, c de l''equation de droite du type ax+by+c=0 16 ; @param abc2 {in}{required} is second table of dimension 3, number_of_pairs_of_straight_lines, 17 ; whose each line contain the 3 parameters a,b and c of the second linear 18 ; equation of the type ax+by+c=0 17 19 ; 18 ; KEYWORD PARAMETERS: 19 ; /FLOAT: pour retourner l''output sous forme de tableau de 20 ; reel plutot que de vecteur decomplexes (par defaut) 20 ; @keyword FLOAT To return the output as a table of real numbers instead of vectors of complex (by default) 21 21 ; 22 ; OUTPUTS:2 possibilites: 23 ; 1) par defaut: c''est une vecteur de complexe dont chaque 24 ; element est les coordonnees du point d''intersection d''un 25 ; couple de droites. 26 ; 2) si /FLOAT est active, c'est un tableau de reels de 27 ; dimensiones 2, nbre_de_couple_de_droites dont chaque 28 ; ligne est les coordonnees du point d''intersection d''un 29 ; couple de droites 22 ; @returns 2 possibilities: 23 ; 1) by default: it is a vector of complex whose each element is the coordinates 24 ; of the intersection point of a pair of straight lines. 25 ; 2) if FLOAT is activated, it is a table of reals of dimension 2, 26 ; number_of_pairs_of_straight_lines whose each row is the coordinates 27 ; of the intersection point of a pair of straight line. 30 28 ; 31 ; COMMON BLOCKS:29 ; @restrictions If the 2 straight line are parallel, we return coordinates (!values.f_nan,!values.f_nan) 32 30 ; 33 ; SIDE EFFECTS:si les deux droites dont paralleles, on retourne les 34 ; coordonnes (!values.f_nan,!values.f_nan) 31 ; @restrictions Beware of the precision of the machine which make 32 ; that calculated coordinates may not exactly verify 33 ; equations of the pair of straight lines. 35 34 ; 36 ; RESTRICTIONS:attention a la precision de la machine qui fait que 37 ; les coordonnees calcules de verifient peut-etre pas exactement les 38 ; equations du couple de droites. 35 ; @examples IDL> abc1=linearequation(complex(1,2),[3,4]) 36 ; IDL> abc2=linearequation(complex(1,2),[8,15]) 37 ; IDL> print, lineintersection(abc1, abc2) 38 ; ( 1.00000, 2.00000) 39 ; IDL> print, lineintersection(abc1, abc2,/float) 40 ; 1.00000 2.00000 39 41 ; 40 ; EXAMPLE: 41 ; IDL> abc1=linearequation(complex(1,2),[3,4]) 42 ; IDL> abc2=linearequation(complex(1,2),[8,15]) 43 ; IDL> print, lineintersection(abc1, abc2) 44 ; ( 1.00000, 2.00000) 45 ; IDL> print, lineintersection(abc1, abc2,/float) 46 ; 1.00000 2.00000 42 ; @history Sebastien Masson (smasson@lodyc.jussieu.fr) 43 ; 10 juin 2000 47 44 ; 48 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)49 ; 10 juin 200045 ; @version $Id$ 46 ; 50 47 ;- 51 48 ;------------------------------------------------------------ -
trunk/SRC/Utilities/pwd.pro
r132 r133 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:pwd6 5 ; 7 ; PURPOSE:print the current directory 6 ; @file_comments 7 ; print the current directory 8 8 ; 9 ; CATEGORY:like unix function 9 ; @categories like unix function 10 ; 11 ; @history Sebastien Masson (smasson@lodyc.jussieu.fr) 10 12 ; 11 ; CALLING SEQUENCE:pwd 12 ; 13 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) 13 ; @version $Id$ 14 14 ; 15 15 ;- -
trunk/SRC/Utilities/report.pro
r132 r133 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:report6 5 ; 7 ; PURPOSE: comme dialog_message.pro si il y a deja des widgets actives 8 ; ou comme message.pro si il n''y a pas de widgets actives. pour poser 9 ; des question dont la reponse n''est pas oui/non utiliser xquestion 6 ; @file_comments 7 ; Like dialog_message.pro if there is already some widget 8 ; active or like message.pro if there is not any widget active. 9 ; To ask a question whose answer is not yes/no,use xquestion. 10 10 ; 11 ; CATEGORY: 12 ; 13 ; CALLING SEQUENCE:res = report(text) 14 ; 15 ; INPUTS: text: un string on un vecteur de string. Si le string ne 11 ; @param text {in}{required} un string on un vecteur de string. Si le string ne 16 12 ; comporte qu''un element, on cherche les eventuels characteres de 17 13 ; retour a la ligne: '!C'. If text is set to an array of strings, each 18 14 ; array element is displayed as a separate line of text. 19 15 ; 20 ; KEYWORD PARAMETERS: 21 ; SIMPLE: activate to print only the message without the name 16 ; @keyword SIMPLE activate to print only the message without the name 22 17 ; and the line of the routine (defined by calling routine_name) 23 18 ; 24 ; ceux dialog_message.pro et message.pro avec en + 25 ; PARENT qui fait la meme chose que DIALOG_PARENT de dialog_message.pro 19 ; @keyword _extra used to pass keywords from dialog_message.pro and message.pro 26 20 ; 27 ; OUTPUTS: -1 si le mot cle QUESTION n''est pas activer 28 ; si le mot cle est active la fonction retourne 1 pour yes et 29 ; 0 pour no. 21 ; @keyword PARENT same as DIALOG_PARENT de dialog_message.pro 30 22 ; 31 ; COMMON BLOCKS: 23 ; @keyword QUESTION Set this keyword to create a "Question" dialog. 24 ; The default dialog type is "Warning" 32 25 ; 33 ; SIDE EFFECTS: 26 ; @keyword DEFAULT_NO Set this keyword to make the "No" button the default 27 ; selection for "Question" dialog. Normally, the default is yes. 34 28 ; 35 ; RESTRICTIONS: 29 ; @keyword SIMPLE Activate to print the error message without printing 30 ; the routine name with its full path. 36 31 ; 37 ; EXAMPLE: 32 ; @returns -1 if the keyword QUESTION is not activated 33 ; If the keyword is activated, return 1 for yes and 0 for no. 38 34 ; 39 ; si aucun widget n''est active:35 ; @example If there is not any widget activated: 40 36 ; 41 37 ; IDL> help, report('toto tata') 42 38 ; % $MAIN$: toto tata 43 39 ; <Expression> INT = -1 44 ; IDL> help, report(' ca marche?',/question)45 ; ca marche? y/n (default answer is y)40 ; IDL> help, report('does it works ?',/question) 41 ; does it works ? y/n (default answer is y) 46 42 ; <Expression> BYTE = 1 47 ; IDL> help, report('question1: !C ca marche?',/question)43 ; IDL> help, report('question1: !C does it works ?',/question) 48 44 ; question1: 49 ; ca marche? y/n (default answer is y)45 ; does it works ? y/n (default answer is y) 50 46 ; <Expression> BYTE = 1 51 47 ; 52 ; si des widgets sont deja actives, c''est la meme chose mais avec des 53 ; widgets! 48 ; If widgets are already activated, it is the same thing but with widgets! 54 49 ; 55 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)50 ; @history Sebastien Masson (smasson@lodyc.jussieu.fr) 56 51 ; 21/10/1999 52 ; 53 ; @version $ID$ 54 ; 57 55 ;- 58 56 ;------------------------------------------------------------ … … 63 61 compile_opt idl2, strictarrsubs 64 62 ; 65 res = -1 ; 66 ; on separe le texte en differentes lignes (separees par !C) si ce 67 ; n''est pas deja fait... 63 res = -1 ; 64 ; we separate the text in different lines (separated by !C) if it is not already done... 68 65 if n_elements(text) EQ 1 then text = str_sep(text, '!C', /trim) 69 ; il y a des widgets actifs, c''est facile on appelledialog_massage66 ; there is some widgets activated, it is easy, we call dialog_massage 70 67 if (widget_info(/managed))[0] NE 0 then BEGIN 71 68 res = dialog_message(text, dialog_parent = parent, QUESTION = question $ … … 73 70 if keyword_set(question) THEN res = res EQ 'Yes' ELSE res = -1 74 71 ENDIF ELSE BEGIN 75 ; aucun widget n''est actif76 ; on pose unequestion ?72 ; there is not any widget activated 73 ; do we ask a question ? 77 74 if keyword_set(question) then BEGIN 78 ; quelle est la reponse par defaut ?75 ; what i sthe answer by default ? 79 76 if keyword_set(default_no) then answer = 'n' ELSE answer = 'y' 80 77 default_answer = answer … … 83 80 read, text[n_elements(text)-1]+' y/n (default answer is '+default_answer+')' , answer 84 81 answer = strlowcase(answer) ; 85 ; si la reponse ne convient pas82 ; if the answer is not appropriated 86 83 while answer NE '' and answer NE 'y' and answer NE 'n' do begin 87 84 read, text[n_elements(text)-1]+' y/n (default answer is '+default_answer+')' , answer 88 85 answer = strlowcase(answer) 89 86 ENDWHILE ; 90 ; on ajuste res en fonction de la reponse87 ; we adjust res in function of th answer 91 88 case answer of 92 89 '':res = default_answer EQ 'y' … … 95 92 endcase 96 93 endif ELSE BEGIN 97 ; si on ne pose pas de question on fait juste unprint94 ; If we do not ask any question, we just make a print 98 95 IF keyword_set(simple) THEN prefix = '' ELSE prefix = '% '+routine_name(1)+': ' 99 96 if n_elements(text) GT 1 THEN $ -
trunk/SRC/Utilities/routine_name.pro
r132 r133 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:routine_name,remonte6 5 ; 7 ; PURPOSE:retourne le nom de la routine (procedure ou function) ds8 ; lequel on se trouve6 ; @file_comments 7 ; Give us the name of the routine (procedure or function) where we are. 9 8 ; 10 ; CATEGORY:utilitaire 9 ; @categories utilities 10 ; 11 ; @param pilingnum {in}{optional} A whole number which give us how many level we have to reascend 12 ; in the piling up of routines and subroutines to find the looked for routine. 11 13 ; 12 ; CALLING SEQUENCE:res=routine_name([remonte])13 ;14 ; INPUTS: remonte: un entier qui donne de combien de niveau on doit15 ; remonter ds l''empillement des routines ewt sous-routines pour16 ; retrouver le nom de la routine cherchee17 14 ; 18 ; KEYWORD PARAMETERS:15 ; @returns a string giving either the full name of the routine (with the path) or '$MAIN$' 19 16 ; 20 ; OUTPUTS:un string donnant soit le nom de la routine en entier (avec 21 ; le path) soit '$MAIN$' 17 ; @restriction This function use the keyword OUTPUT in help.pro and it is specified 18 ; in the online help that the return syntax of this word can change in 19 ; function of the version of the code. This version works with IDL 5.2. 22 20 ; 23 ; COMMON BLOCKS: 24 ; 25 ; SIDE EFFECTS: 26 ; 27 ; RESTRICTIONS: 28 ; cette fonction utilise le mot cle OUTPUT ds help.pro et il est 29 ; specifie ds l''aide en ligne que la syntaxe du retour de ce mot cle 30 ; peut changer suivant la version du code. Cette version marche avec 31 ; IDL 5.2 32 ; 33 ; EXAMPLE: 34 ; 35 ; IDL> print, routine_name() 21 ; @example IDL> print, routine_name() 36 22 ; /usr1/com/smasson/IDL_RD/UTILITAIRE/report.pro 37 23 ; IDL> print, routine_name(1) … … 44 30 ; $MAIN$ 45 31 ; 46 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)32 ; @history Sebastien Masson (smasson@lodyc.jussieu.fr) 47 33 ; 21/10/1999 34 ; 35 ; @version $Id$ 36 ; 48 37 ;- 49 38 ;------------------------------------------------------------ 50 39 ;------------------------------------------------------------ 51 40 ;------------------------------------------------------------ 52 FUNCTION routine_name, remonte41 FUNCTION routine_name, pilingnum 53 42 ; 54 43 ; … … 56 45 ; 57 46 help, /traceback, output = name 58 name = strtrim(name, 1) ; on enleve les blancs en debut de ligne59 ; on va mettre les elements du vecteur bout a bout pour former un60 ; unique sring47 name = strtrim(name, 1) ; we remove blanks at the beginning of lines and 48 ; we put elements of the vector stuck ones with 49 ; each others to make an unique string. 61 50 allnames = '' 62 51 for i = 0, n_elements(name)-1 do allnames = allnames+name[i] 63 52 ; 64 name = str_sep(allnames, '%') ; on le redecoupe65 name = strtrim(name, 2) ; on eleve les blancs devant et derriere66 name = strcompress(name) ; on compresse les blancs67 ; on ne retient pas les 2 premiers elements qui sont 1 un vide et la68 ; ligne concernant routine_name53 name = str_sep(allnames, '%') ; we cut it out again. 54 name = strtrim(name, 2) ; we remouve blanks in front of and behind 55 name = strcompress(name) ; we compress blanks 56 ; we do not hold back the two first elements who are a blanck and the line concerning 57 ; routine_name. 69 58 name = name[2: n_elements(name)-1] 70 ; on choisit la ligne qui nous concerne71 if NOT keyword_set( remonte) then remonte= 072 if remonteGE n_elements(name) then return, '$MAIN$'73 name = name[ remonte]59 ; we choose the line which concern us. 60 if NOT keyword_set(pilingnum) then pilingnum = 0 61 if pilingnum GE n_elements(name) then return, '$MAIN$' 62 name = name[pilingnum] 74 63 if strpos(name, '$MAIN$') NE -1 then return, '$MAIN$' 75 64 name = str_sep(name, ' ') -
trunk/SRC/Utilities/testvar.pro
r132 r133 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:testvar6 5 ; 7 ; PURPOSE:une sorte de keyword_set mais qd la valeur existe renvoie8 ; celle-ci6 ; @file_comments 7 ; A kind of keyword_set but when the value exist, it send it back 9 8 ; 10 ; CATEGORY:comme keyword_set9 ; @categories utlities 11 10 ; 12 ; CALLING SEQUENCE:res=testvar(var=variable) 13 ; 14 ; INPUTS:rien 11 ; @keyword var any kind of 15 12 ; 16 ; KEYWORD PARAMETERS:var : n''importe quoi13 ; @returns 0 if the variable does not exist 17 14 ; 18 ; OUTPUTS:0 si la variable n''existe pas 19 ; 20 ; COMMON BLOCKS: 21 ; 22 ; SIDE EFFECTS: 23 ; 24 ; RESTRICTIONS: 25 ; 26 ; EXAMPLE: 27 ; 28 ; IDL> print, testvar(var=toto) 15 ; @examples IDL> print, testvar(var=toto) 29 16 ; 0 30 17 ; IDL> print, testvar(var='toto') 31 18 ; toto 32 19 ; 33 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)20 ; @history Sebastien Masson (smasson@lodyc.jussieu.fr) 34 21 ; 14/12/1999 22 ; 23 ; @version $Id$ 24 ; 35 25 ;- 36 26 ;------------------------------------------------------------ -
trunk/SRC/Utilities/text_box.pro
r132 r133 1 1 ;+ 2 ; Name : text_box3 2 ; 4 ; Purpose : Writes a text message within a box in a graphics window. 3 ; @file_comments 4 ; This procedure writes a short text message within a box-shaped 5 ; area in a graphics window. The message may be split at word 6 ; boundaries into several lines, and the character size and 7 ;orientation may be adjusted for the text to fit within the box. 8 ; 9 ; @param TEXT {in}{required} ASCII text string containing the message. 5 10 ; 6 ; Description: This procedure writes a short text message within a box-shaped 7 ; area in a graphics window. The message may be split at word 8 ; boundaries into several lines, and the character size and 9 ; orientation may be adjusted for the text to fit within the box. 10 ; 11 ; Useage: text_box,text,pos=pos,color=color,$ 12 ; justify=justify,vert_space=vert_space 13 ; 14 ; Inputs 15 ; TEXT ASCII text string containing the message. 16 ; 17 ; keywords 18 ; pos 4 element vector specifying the box position and size 11 ; @keyword pos 4 element vector specifying the box position and size 19 12 ; pos[0],pos[1] specify the lower left corner coordinate 20 13 ; pos[2],pos[3] specify the upper right corner coordinate 21 14 ; data window normalized coordinates are use 22 15 ; 23 ; fg_colorcolor of box and legend titles (default=0)16 ; @keyword fg_color color of box and legend titles (default=0) 24 17 ; 25 ; bg_colorbackground color. Setting BG_COLOR erases the area18 ; @keyword bg_color background color. Setting BG_COLOR erases the area 26 19 ; covered by the text box (filling it with color BG_COLOR) 27 20 ; prior to writing the text. If both BG_COLOR and !p.color … … 29 22 ; gaurantee a readability. 30 23 ; 31 ; right if set, right justify text 32 ; center if set, center the text 24 ; @keyword right if set, right justify text 33 25 ; 34 ; vert_space vertical spacing of lines in units of character height 35 ; (default = 1.5) 26 ; @keyword center if set, center the text 36 27 ; 28 ; @keyword vert_space {default=1.5}vertical spacing of lines in units of character height 37 29 ; 38 ; author: Paul Ricchiazzi 7Jul93 30 ; @keyword _EXTRA used to pass your keyword 31 ; 32 ; @keyword box activate to show the box on graphics window. 33 ; 34 ; @history Paul Ricchiazzi 7Jul93 39 35 ; Institute for Computational Earth System Science 40 36 ; University of California, Santa Barbara 37 ; 38 ; @version $Id$ 39 ; 41 40 ;- 42 41 PRO text_box,text,pos=pos,fg_color=fg_color,bg_color=bg_color,$ -
trunk/SRC/Utilities/undefine.pro
r132 r133 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME: undefine6 5 ; 7 ; PURPOSE: effacer une variable 8 ; meme chose que delvar mais utiulisable ds un programme et 9 ; utilisable que pour une variable a la fois 6 ; @file_comments 7 ; erase a variable 8 ; same thing that delvar but usable in a program and usable 9 ; for one variable simultaneously 10 10 ; 11 ; CATEGORY: 11 ; @categories utilities 12 ; 13 ; @param varname {in}{required} The name of the variable we want erase 12 14 ; 13 ; CALLING SEQUENCE: UNDEFINE, varname 14 ; 15 ; INPUTS: varname: la variable a detruire 15 ; @example IDL> a=1 16 ; IDL> undefine,a 17 ; % Compiled module: UNDEFINE. 18 ; IDL> help, a 19 ; A UNDEFINED = <Undefined> 16 20 ; 17 ; EXAMPLE: 18 ; 19 ; IDL> a=1 20 ; IDL> undefine,a 21 ; % Compiled module: UNDEFINE. 22 ; IDL> help, a 23 ; A UNDEFINED = <Undefined> 24 ; 25 ; MODIFICATION HISTORY: trouve sur la page web de D.Fanning 21 ; @history trouve sur la page web de D.Fanning 26 22 ; http://www.dfanning.com : 27 23 ;QUESTION: How do I make an IDL variable have a type "undefined"? -
trunk/SRC/Utilities/xfile.pro
r132 r133 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME: xfile6 5 ; 7 ; PURPOSE: affiche ds un widget un fichier ASCII. 8 ; c''est la meme chose que xdisplaydife mais ici on l''utilise pour 9 ; visualiser le contenu d''une procedure ou d''une fonction 10 ; meme si elle n''est pas ds le repertoire courant (grace a !path) 6 ; @file_comments 7 ; display in a widget an ASCII file. 8 ; It is the same thing that xdisplaydife but here, we use it 9 ; to display the content of a procedure or of a function, 10 ; even if it is not in the current directory (thanks to the path). 11 11 ; 12 ; CATEGORY: help12 ; @categories utilities 13 13 ; 14 ; CALLING SEQUENCE: xfile,'nom_fichier' 14 ; @param filename {in}{required} It is the name of the procedure or of the function 15 ; we want to display (with or without .pro at the end). 15 16 ; 16 ; INPUTS: 17 ; nom_fichier:le nom d''une procedure ou d''une fonction a 18 ; visualiser avec ou sans le .pro a la fin 17 ; @keyword _extra used to pass your keywords 19 18 ; 20 ; KEYWORD PARAMETERS:ceux de xdisplayfile19 ; @examples xfile,'plt' 21 20 ; 22 ; EXAMPLE:xfile,'plt' 23 ; 24 ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr) 21 ; @history Sebastien Masson (smasson@lodyc.jussieu.fr) 25 22 ; 7/1/99 26 23 ; 6/7/1999: compatibilite mac et windows 24 ; 25 ; @version $Id$ 26 ; 27 27 ;- 28 28 ;------------------------------------------------------------ … … 35 35 pfile = strlowcase(filename) 36 36 ; 37 ; il faut trouver le nom complet37 ; we have to find the full name. 38 38 ; 39 39 if strpos(pfile,".pro") lt 0 then pfile=pfile+".pro" … … 57 57 endrep until res[0] NE '' OR i EQ n_elements(pfile) 58 58 if res[0] NE '' then BEGIN 59 ; on ouvre le fichier ds unwidget59 ; we open the file in a widget 60 60 xdisplayfile, pfile[i-1], _extra = ex 61 61 ENDIF ELSE ras = report('le fichier demande n''existe pas...') -
trunk/SRC/Utilities/xhelp.pro
r132 r133 1 1 ;+ 2 ; NAME:3 ; xhelp4 2 ; 5 ; PURPOSE:6 ; 3 ; @file_comments 4 ; Display an IDL procedure header using widgets and the widget manager. 7 5 ; 8 ; CATEGORY: 9 ; Widgets. 6 ; @categories Widgets. 10 7 ; 11 ; CALLING SEQUENCE: 12 ; xhelp, Filename,_extra=ex 13 ; 14 ; INPUTS: 15 ; Filename: A scalar string that contains the filename of the file 8 ; @param Filename {in}{required} A scalar string that contains the filename of the file 16 9 ; to display. If FILENAME does not include a complete path 17 10 ; specification, xhelp will search for the file in … … 20 13 ; ".pro" file suffix will be appended if it is not supplied. 21 14 ; 22 ; KEYWORD PARAMETERS: 23 ; Ceux de xdisplayfile 15 ; @keyword _extra used to pass your keywords 24 16 ; 25 ; OUTPUTS: 26 ; No explicit outputs. A file viewing widget is created. 17 ; @restrictions Triggers the XMANAGER if it is not already in use. 27 18 ; 28 ; SIDE EFFECTS: 29 ; Triggers the XMANAGER if it is not already in use. 19 ; @examples Open a file and create a widget to display its contents. 30 20 ; 31 ; RESTRICTIONS: 32 ; None. 33 ; 34 ; PROCEDURE: 35 ; Open a file and create a widget to display its contents. 36 ; 37 ; MODIFICATION HISTORY: 38 ; Written By Steve Richards, December 1990 21 ; @history Written By Steve Richards, December 1990 39 22 ; Graceful error recovery, DMS, Feb, 1992. 40 23 ; Modified to extract .pro documentation headers, PJR/ESRG mar94 41 ; 42 ; author: Paul Ricchiazzi jun93 43 ; Institute for Computational Earth System Science 44 ; University of California, Santa Barbara 45 ; 24 ; Paul Ricchiazzi jun93 25 ; Institute for Computational Earth System Science 26 ; University of California, Santa Barbara 46 27 ; 7/1/99 : legeres mofification par Sebastien Masson : utilisation de 47 28 ; xdisplayfile, de findfile et de _extra. 48 29 ; 6/7/1999: compatibilite mac et windows 30 ; 31 ; @version $Id$ 32 ; 49 33 ;- 50 34 PRO xhelp, filename, _extra=ex … … 53 37 ; 54 38 55 ; filename est bien unstring?39 ; Are we sure filename is a string? 56 40 cquoidonc = size(filename, /type) 57 41 if cquoidonc NE 7 then begin … … 59 43 return 60 44 endif 61 ; il faut trouver le nom complet45 ; We have to find the full name 62 46 pfile=FILENAME 63 47 if strpos(pfile,".pro") lt 0 then pfile=pfile+".pro" … … 75 59 pfile = [current, multipath]+ pfile 76 60 ENDIF 77 ; on test tous les noms possibles pour trouver ou est le fichier61 ; We test each possile name to find where the file is. 78 62 nfile=n_elements(pfile) 79 63 n = 0 … … 83 67 endrep until res[0] NE '' OR n EQ n_elements(pfile) 84 68 if res[0] NE '' then BEGIN 85 openr, unit,pfile[n-1], /get_lun ; o uverture du fichier86 ; on selectionne le morceaux en-tete69 openr, unit,pfile[n-1], /get_lun ; opening of the file 70 ; we select the heading piece 87 71 a = strarr(1000) ;Maximum # of lines 88 72 xsize=0 … … 104 88 ras = report('le programme a etait mal ecrit, il n''y a pas d''en-tete... utiliser xfile.pro.') ELSE BEGIN 105 89 a = a[0:i-1] 106 ; on ecrit le contenu de a ds unwidget90 ; we wrote the a's content in a widget 107 91 xdisplayfile,'toto',text = a,title=pfile[n-1], _extra = ex 108 92 ENDELSE
Note: See TracChangeset
for help on using the changeset viewer.