- Timestamp:
- 08/09/06 12:12:54 (18 years ago)
- Location:
- trunk/SRC
- Files:
-
- 74 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Calendar/daysinmonth.pro
r137 r150 13 13 ; key_caltype = 'greg'. In that case, month and year must have the same 14 14 ; number of elements. 15 ; 16 ; @param 15 17 ; 16 18 ; @returns -
trunk/SRC/ReadWrite/read_grads.pro
r136 r150 38 38 ; default value is common variable iodir 39 39 ; 40 ; @todo41 40 ;--------------- 42 41 ; NOT yet available -
trunk/SRC/ToBeReviewed/CALCULS/curl.pro
r142 r150 44 44 ; adaptation pour marcher avec un domaine reduit 45 45 ; 46 ; 21/5/1999: valeurs manquantes a!values.f_nan46 ; 21/5/1999: missing values at !values.f_nan 47 47 ;periodicite 48 48 ; -
trunk/SRC/ToBeReviewed/IMAGE/animgif.pro
r142 r150 25 25 ; 26 26 ; @restrictions 27 ; If we want to delete the \ 27 ; If we want to delete the \@common, 28 28 ; we have to define manually the picture's size 29 29 ; (variables xsize and ysize) just as iodir. -
trunk/SRC/ToBeReviewed/LECTURE/GRIB/bit2int.pro
r134 r150 1 ;+ 2 ; 3 ; @todo 4 ; seb 5 ; 6 ;- 1 7 FUNCTION bit2int, bitin, checkneg = checkneg 2 8 ; -
trunk/SRC/ToBeReviewed/LECTURE/read_ftp.pro
r142 r150 38 38 ;+ 39 39 ; 40 ; Syntax:40 ; @file_comments 41 41 ; READ_FTP, remote_host [, files] [, directory] [,/FILE] [,DATA=variable] 42 42 ; [,USER=string] [,PASS=string] [,/PTR] … … 118 118 ; $Id$ 119 119 ; 120 ; @todo seb: que fait-on de "syntax" au debut du header? 120 ; @todo 121 ; seb: que fait-on de "syntax" au debut du header? 122 ; give examples with date in year 0 (should not exists but may happen) 121 123 ; 122 124 ;- -
trunk/SRC/ToBeReviewed/LECTURE/read_ncdf.pro
r142 r150 1 ;------------------------------------------------------------2 ;------------------------------------------------------------3 ;------------------------------------------------------------4 1 ;+ 5 ; 6 ; PURPOSE:fonction de lecture pour fichier net_cdf. 7 ; Ce programme, est moins universel que ncdf_lec (il fait appelle au 8 ; variables declarees dans common.pro) mais il est du cop bcp plus 9 ; facile d''utilisation. Il prend en compte la declaration des 10 ; differents zoom qui ont ete definis (ixminmesh...premierx...) la 11 ; declaration de la variable key_shift... bref le resultat de 12 ; read_ncdf peut dorectement etre utilise dans plt... 13 ; C''est aussi ce programme qui est utilise par defaut dans mes 14 ; widgets pour la partie lecture. 15 ; 16 ; CATEGORY:lecture de fichiers NetCdf 17 ; 18 ; CALLING SEQUENCE:res = read_ncdf(name,debut[,fin]) 19 ; 20 ; INPUTS: name: un string definissant le champ a lire. 21 ; debut et fin: sont relatifs a l''axe des temps. Ce peut etre 22 ; - 2 dates du type yyyymmdd et ds ce cas on selectionne les 23 ; dates qui sont comprisent entre ces 2 dates. 24 ; - 2 indices qui definissent entre quel et quel pas de temps 25 ; on doit extraire la dimension temporelle. 26 ; exp: ne sert a rien! 27 ; 28 ; KEYWORD PARAMETERS: utilisables hors du contexte des widgets 29 ; 30 ; BOXZOOM: contient la boxzoom sur laquelle on doit faire la 31 ; lecture 32 ; FILENAME: string contennant le nom du fichier 33 ; /INIT; to call automatically initncdf, filename and thus 34 ; redefine all the grid parameters 35 ; GRID='[UTVWF]' to specify the type of grid. Defaut is (1) 36 ; based on the name of the file if the file ends by 37 ; GRID[._][TUVFW].NC (not case sensible) or (2) T if case (1) 38 ; is not found. 39 ; IODIRECTORY;a string giving the name of iodirectory (see 40 ; isafile.pro for all possibilities). default value is common 41 ; variable iodir 42 ; TIMESTEP:activer pour specifier que debut et fin font 43 ; reference a des indices de l''axe du temps et non pas a des 44 ; dates. 45 ; TOUT: activer si on veut lire le ficher sur l''ensemble du 46 ; domaine sans tenir compte du sous domaine definit par boxzoom 47 ; ou lon1,lon2,lat1,lat2,vert1,vert2. 48 ; NOSTRUCT: activer si on ne veut pas que read_ncdf reourne 49 ; une structure mais uniquement le tableau se rapportant au 50 ; champ. 51 ; TIMEVAR: a string to define the name of the variable that 52 ; contains the time axis. This keyword can be usefull if there 53 ; is no unlimited dimension or if the time axis selected by defaut 54 ; (the first 1D array with unlimited dimension) is not the good one 55 ; 56 ; 57 ; OUTPUTS:une stucture lisible par litchamp.pro ou un simple tableau 58 ; si /NOSTRUCT est active 59 ; 60 ; COMMON BLOCKS:common.pro 61 ; 62 ; SIDE EFFECTS: 63 ; 64 ; RESTRICTIONS:le champ doit avoir une dimension temporelle 65 ; 66 ; EXAMPLE: 67 ; 68 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) 69 ; 15/10/1999 2 ; @file_comments 3 ; Reading function for the file net_cdf. 4 ; This program is less universal than ncdf_lec (it appeal to declarated 5 ; variables in common.pro) but it is very easier to be used. It considerate 6 ; the declaration of the different zooms which have been defined 7 ; (ixminmesh...premierx...), the declaration of the variable key_shift... 8 ; To put it in a nutshell, the result of read_ncdf can be directly used in plt... 9 ; This is also this program which is used by default inour reading widgets. 10 ; 11 ; @categories 12 ; reading 13 ; 14 ; 15 ; @param NAME {in}{required} 16 ; It is a string defining the field to be read. 17 ; 18 ; @param BEGINNING {in}{required} 19 ; Relative with the time axis. 20 ; These can be 21 ; - 2 date of the type yyyymmdd and in this case, we select dates 22 ; which are included between these two dates. 23 ; - 2 indexes which define between which and which time step we have 24 ; to extract the telporal dimension. 25 ; 26 ; @param ENDING {in}{required} 27 ; Relative with the time axis. 28 ; See BEGINNING. 29 ; 30 ; @param COMPATIBILITY {in}{required} 31 ; Useless 32 ; 33 ; @keyword BOXZOOM 34 ; Contain the boxzoom on which we have to do the reading 35 ; 36 ; @keyword FILENAME 37 ; It is a string containing the file's name. 38 ; 39 ; @keyword INIT 40 ; To call automatically initncdf, filename and thus 41 ; redefine all the grid parameters 42 ; 43 ; @keyword GRID 44 ; ='[UTVWF]' to specify the type of grid. Defaut is (1) 45 ; based on the name of the file if the file ends by 46 ; GRID[._][TUVFW].NC (not case sensible) or (2) T if case (1) 47 ; is not found. 48 ; 49 ; @keyword IODIRECTORY 50 ; It isa string giving the name of iodirectory (see isafile.pro 51 ; for all possibilities). default value is common variable iodir. 52 ; 53 ; @keyword TIMESTEP 54 ; We activate to specify that BEGINNING and ENDING refer to indexes 55 ; of the time axis and not to dates 56 ; 57 ; @keyword TOUT 58 ; We activate it if we want to read the file on the whole domain without 59 ; considerate the sub-domain defined by the boxzoom or 60 ; lon1,lon2,lat1,lat2,vert1,vert2. 61 ; 62 ; @keyword NOSTRUCT 63 ; We activate it if we do not want that read_ncdf send back a structure 64 ; but only the array refering to the field. 65 ; 66 ; @keyword TIMEVAR 67 ; It is a string which define the name of the variable that 68 ; contains the time axis. This keyword can be usefull if there 69 ; is no unlimited dimension or if the time axis selected by defaut 70 ; (the first 1D array with unlimited dimension) is not the good one. 71 ; 72 ; @keyword _EXTRA 73 ; Used to pass your keywords 74 ; 75 ; @returns 76 ; Structure readable by litchamp.pro or an array if NOSRUCT is activated. 77 ; 78 ; @uses 79 ; common.pro 80 ; 81 ; @restrictions 82 ; The field must have a temporal dimension. 83 ; 84 ; @history 85 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 86 ; 15/10/1999 87 ; 88 ; @version 89 ; $Id$ 70 90 ;- 71 ;------------------------------------------------------------ 72 ;------------------------------------------------------------ 73 ;------------------------------------------------------------ 74 FUNCTION read_ncdf, name, debut, fin, pour_etre_compatible, BOXZOOM = boxzoom, FILENAME = filename $ 91 ;--------------------------------------------------------- 92 ;--------------------------------------------------------- 93 ;--------------------------------------------------------- 94 95 FUNCTION read_ncdf, name, beginning, ending, compatibility, BOXZOOM = boxzoom, FILENAME = filename $ 75 96 , PARENTIN = parentin, TIMESTEP = timestep, TIMEVAR = timevar $ 76 97 , TOUT = tout, NOSTRUCT = nostruct, CONT_NOFILL = CONT_NOFILL, INIT = init $ … … 98 119 filename = isafile(filename = filename, IODIRECTORY = iodir, _EXTRA = ex) 99 120 ;------------------------------------------------------------ 100 ; ouverture du fichier nom121 ; Opening of the name file 101 122 ;------------------------------------------------------------ 102 123 if size(filename, /type) NE 7 then $ … … 118 139 if keyword_set(init) THEN initncdf, filename, _extra = ex 119 140 ;------------------------------------------------------------ 120 ; check the time axis and the debut and findates121 ;------------------------------------------------------------ 122 if n_elements( debut) EQ 0 then begin123 debut= 0141 ; check the time axis and the debut and ending dates 142 ;------------------------------------------------------------ 143 if n_elements(beginning) EQ 0 then begin 144 beginning = 0 124 145 timestep = 1 125 146 endif 126 147 if keyword_set(timestep) then begin 127 firsttps = debut[0]128 if n_elements( fin) NE 0 then lasttps = fin[0] ELSE lasttps = firsttps148 firsttps = beginning[0] 149 if n_elements(ending) NE 0 then lasttps = ending[0] ELSE lasttps = firsttps 129 150 jpt = lasttps-firsttps+1 130 151 time = julday(1, 1, 1) + lindgen(jpt) … … 136 157 currentfile = (where(filelist EQ filename))[0] 137 158 time = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).time_counter 138 date1 = date2jul( debut[0])139 if n_elements( fin) NE 0 then date2 = date2jul(fin[0]) ELSE date2 = date1159 date1 = date2jul(beginning[0]) 160 if n_elements(ending) NE 0 then date2 = date2jul(ending[0]) ELSE date2 = date1 140 161 firsttps = where(time EQ date1) & firsttps = firsttps[0] 141 162 lasttps = where(time EQ date2) & lasttps = lasttps[0] … … 159 180 ; we find the FIRST time axis 160 181 timeid = 0 161 repeat BEGIN ; tant que l''on a pas trouve une variable qui n''a qu'' 162 ; une dimension: la dimension infinie 163 timecontient = ncdf_varinq(cdfid, timeid) ; que contient la variable 182 repeat BEGIN ; As long as we have not find a variable having only one dimension: the infinite one 183 timecontient = ncdf_varinq(cdfid, timeid) ; that the variable contain. 164 184 timeid = timeid+1 165 185 endrep until (n_elements(timecontient.dim) EQ 1 $ … … 188 208 ; 189 209 ; now we try to find the attribut called calendar... 190 ; the theattribute "calendar" exists?210 ; the attribute "calendar" exists? 191 211 ; If no, we suppose that the calendar is gregorian calendar 192 212 ; … … 248 268 end 249 269 ENDCASE 250 date1 = date2jul( debut[0])251 if n_elements( fin) NE 0 then date2 = date2jul(fin[0]) ELSE date2 = date1270 date1 = date2jul(beginning[0]) 271 if n_elements(ending) NE 0 then date2 = date2jul(ending[0]) ELSE date2 = date1 252 272 time = double(time) 253 273 firsttps = where(time GE date1) & firsttps = firsttps[0] … … 271 291 ENDELSE 272 292 ;------------------------------------------------------------ 273 ; nom de la grille a laquelle se rapporte le champ293 ; Name of the grid on which the field refer to. 274 294 ;------------------------------------------------------------ 275 295 IF keyword_set(grid) THEN vargrid = strupcase(grid) ELSE BEGIN … … 294 314 295 315 ;--------------------------------------------------------------- 296 ; redefinition du domaine316 ; redefinition of the domain 297 317 ;--------------------------------------------------------------- 298 318 if keyword_set(tout) then begin … … 331 351 ENDIF 332 352 grille, mask, glam, gphi, gdep, nx, ny, nz, firstx, firsty, firstz, lastx, lasty, lastz 333 undefine, glam & undefine, gphi & ; on libere un peu de memoire!353 undefine, glam & undefine, gphi & ; We liberate some memoty! 334 354 ENDELSE 335 355 ;--------------------------------------------------------------------- 336 ; on initialise les ixmindta, iymindta au besoin356 ; We initializate ixmindta, iymindta if needed 337 357 ;--------------------------------------------------------------------- 338 358 if n_elements(jpidta) EQ 0 THEN jpidta = jpiglo … … 352 372 IF izmaxdta EQ -1 then izmaxdta = jpkdta-1 353 373 ;---------------------------------------------------------------- 354 ; on va lire le fichier374 ; We will read the file 355 375 ;--------------------------------------------------------------- 356 376 if n_elements(key_stride) LE 2 then key_stride = [1, 1, 1] … … 401 421 AND (strupcase(vargrid) EQ 'U' OR strupcase(vargrid) EQ 'F') THEN key_shift = key_shift+1 402 422 ;--------------------------------------------------------------------- 403 ; on definit les variables globales rattachees a la variable423 ; We define global variable joined with the variable. 404 424 ;--------------------------------------------------------------------- 405 425 ; varname … … 434 454 ENDELSE 435 455 ; vardate 436 ; on construit une belle date lisible en fonction du langage specifie !!!437 year = long( debut[0])/10000438 month = (long( debut[0])/100) MOD 100439 day = (long( debut[0]) MOD 100)456 ; We make a legible date in function of the specified language. 457 year = long(beginning[0])/10000 458 month = (long(beginning[0])/100) MOD 100 459 day = (long(beginning[0]) MOD 100) 440 460 vardate = string(format = '(C(CMoA))', 31*(month-1))+' '+strtrim(day, 1)+', '+strtrim(year, 1) 441 461 varexp = file_basename(filename) … … 446 466 if keyword_set(key_zreverse) AND (size(res))[0] EQ 4 THEN res = reverse(temporary(res), 3) 447 467 448 ; on applique la valeur valmask sur les points terre468 ; We apply the value valmask on land points. 449 469 if NOT keyword_set(cont_nofill) then begin 450 470 valmask = 1e20 … … 482 502 ; ENDIF ELSE missing = -1 483 503 ENDIF ELSE missing = -1 484 ; on applique les add_offset, scale_factor et missing_value504 ; we apply add_offset, scale_factor and missing_value 485 505 if scale_factor NE 1 then res = temporary(res)*scale_factor 486 506 if add_offset NE 0 then res = temporary(res)+add_offset -
trunk/SRC/ToBeReviewed/LECTURE/xncdf_lec.pro
r134 r150 1 ;------------------------------------------------------------ 2 ;------------------------------------------------------------ 3 ;------------------------------------------------------------ 4 ;+ 5 ; 6 ; @file_comments 7 ; Reading of a Net Cdf file with widgets ! 8 ; 9 ; @categories 10 ; widget 11 ; 12 ; @param NAME {in}{optional} 13 ; It is a string giving the name of the file to be opened. If NAME 14 ; does not contain the separating character of directories ('/' under 15 ; unix for example), the file will be looked for in the current directory. 16 ; 17 ; @keyword IODIR 18 ; It is a string containing the directory where to go look for the file to be read. 19 ; If NAME does not contain the separating character of directories ('/' under 20 ; unix for example), the file will be called iodir+nom_fichier. 21 ; 22 ; @keyword COUNT 23 ; An optional vector containing the counts to be used in 24 ; reading Value. COUNT is a 1-based vector with an element for 25 ; each dimension of the data to be written.The default matches 26 ; the size of the variable so that all data is written out. 27 ; 28 ; @keyword GROUP 29 ; The widget ID of the widget that calls XNCDF_LEC. When 30 ; this ID is specified, a death of the caller results in a death 31 ; of XNCDF_LEC. 32 ; 33 ; @keyword OFFSET 34 ; An optional vector containing the starting position 35 ; for the read. The default start position is [0, 0, ...]. 36 ; 37 ; @keyword SHIFT 38 ; A vector of integers, specifing for each dimension how much we have to shift it. 39 ; By default, it is [0,0,...]. See the function shift for more explanations. BEWARE, 40 ; the shift is done on the biggest array before a possible reduction determinated 41 ; by OFFSET and COUNT. On the other hand, it is done after the possible extraction 42 ; created by the STRIDE. 43 ; 44 ; @keyword STRIDE 45 ; An optional vector containing the strides, or sampling 46 ; intervals, between accessed values of the netCDF variable. The 47 ; default stride vector is that for a contiguous read, [1, 1,...]. 48 ; 49 ; @returns 50 ; 2 different cases: 51 ; 1) None attribute has been selected. In this case, res is the array we 52 ; wanted to read. 53 ; 2) Some attributes has been selected. In this case, res is a structure 54 ; whose the first element having the name of the variable is the values 55 ; array and the other arguments are the select arguments. 56 ; 57 ; @uses 58 ; wididbase, infovariable, resultat, motcle 59 ; 60 ; @examples 61 ; help, xncdf_lec() 62 ; 63 ; @history 64 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 65 ; 24/8/1999 66 ; 67 ; @version 68 ; $Id$ 69 ;- 70 ;------------------------------------------------------------ 71 ;------------------------------------------------------------ 72 ;------------------------------------------------------------ 73 FUNCTION xncdf_lec, name, ATT = att, COUNT = count, GROUP = group, OFFSET = offset, IODIR = iodir, SHIFT = shift, STRIDE = stride, VAR = var 74 ; 75 compile_opt idl2, strictarrsubs 76 ; 77 COMMON wididbase, base 78 COMMON infovariable, cdfid, listename, contient, nomdim, tailledim, varid, varcontient 79 COMMON resultat, res 80 COMMON motcle, mcatt, mccount, mcoffset, mciodir, mcshift, mcstride, mcvar 81 ;------------------------------------------------------------ 82 ; Trick for using keywords (we pass by variables declarated in a common) 83 ;------------------------------------------------------------ 84 res = -1 85 if keyword_set(att) then mcatt = att ELSE mcatt = 0 86 if keyword_set(count) then mccount =count ELSE mccount = 0 87 if keyword_set(offset) then mcoffset = offset ELSE mcoffset = 0 88 if keyword_set(shift) then mcshift = shift ELSE mcshift = 0 89 if keyword_set(stride) then mcstride = stride ELSE mcstride = 0 90 if keyword_set(var) then mcvar = var ELSE mcvar = 0 91 ;------------------------------------------------------------ 92 ; choice of the file's name 93 ;------------------------------------------------------------ 94 ; What type of machine is used 95 thisOS = strupcase(strmid(!version.os_family, 0, 3)) 96 CASE thisOS of 97 'MAC':sep = ':' 98 'WIN':sep = '\' 99 ELSE: sep = '/' 100 ENDCASE 101 ; If IODIR is not defined, we initialize it at the current directory 102 if NOT keyword_set(iodir) then cd, current = iodir 103 mciodir = iodir 104 ; We complete IODIR with a separating character if needed. 105 IF rstrpos(iodir, sep) NE strlen(iodir)-1 THEN iodir = iodir+sep 106 if n_elements(name) EQ 0 then BEGIN ; If NAME is not defined, we find one thanks to the program dialog_pickfile. 107 name = dialog_pickfile(filter = iodir+'*.nc') 108 if name[0] EQ '' then return, -1 ;If we do not have find anything, we go out. 109 ;We complete NAME by IODIR if NAME does not contain any directory separating character. 110 ENDIF ELSE if strpos(name, sep) EQ -1 then name = iodir+name 111 test = findfile(name) ; Does the name looked for correspond to a file? 112 while test[0] EQ '' OR n_elements(test) GT 1 do BEGIN ; We look for one as long as it correspond to nothing! 113 test = test[0] 114 name = dialog_pickfile(filter = iodir+'*.nc') 115 if name EQ '' then return, -1 116 test = findfile(name) 117 endwhile 118 ;------------------------------------------------------------ 119 ; Opening of the file name. 120 ;------------------------------------------------------------ 121 cdfid=ncdf_open(name) 122 contient=ncdf_inquire(cdfid) 123 ;------------------------------------------------------------ 124 ; What does this file contain?? 125 ;------------------------------------------------------------ 126 ; Opening of the base window as columns 127 if n_elements(group) EQ 0 then base = widget_base(/column, title='Fichier: '+name, /align_left) $ 128 ELSE base = widget_base(/column, title='Fichier: '+name, /align_left, GROUP_LEADER = group) 129 ; Opening of base sub-windows ; 130 ;------------------------------------------------------------ 131 ; base 1 title having the file's name 132 ;------------------------------------------------------------ 133 base1 = widget_base(base, /column, /align_center) 134 rien = widget_label(base1, value = 'Net Cdf filename', /align_center) 135 rien = widget_text(base1, value = name, /align_center, uvalue=1, /editable) ;File's name we can change 136 rien = widget_label(base1, value = ' ') ; We jump a line 137 ;------------------------------------------------------------ 138 ; base 2 General informations on the file 139 ;------------------------------------------------------------ 140 base2 = widget_base(base, /column) 141 ;------------------------------------------------------------ 142 ; Informations on global attributes 143 ;------------------------------------------------------------ 144 if contient.ngatts NE -1 then begin 145 rien = widget_label(base2, value = 'Nombre de attributs globaux: '+ strtrim(contient.ngatts,1), /align_left) 146 for attiq=0,contient.ngatts-1 do BEGIN ; Loop on the number of global attributes 147 name=ncdf_attname(cdfid,attiq,/global) ;Attribute's name 148 ncdf_attget,cdfid,name,value,/global ;Attribute's value 149 rien = widget_text(base2, value = name+': '+strtrim(string(value),1), xsize = 60, /scroll, /wrap, /align_right) 150 endfor 151 rien = widget_label(base2, value = ' ') 152 endif 153 ;------------------------------------------------------------ 154 ; Informations on dimensions 155 ;------------------------------------------------------------ 156 rien = widget_label(base2, value = 'Nombre de dimensions: '+strtrim(contient.ndims,1), /align_left) 157 if contient.recdim NE -1 then begin ; Loop on the number of global attributes 158 ncdf_diminq,cdfid,contient.recdim,name,value ; Name and value of the dimension 159 rien = widget_label(base2, value = 'name de la dimension infinie: '+name, /align_left) 160 endif 161 ; 162 nomdim =strarr(contient.ndims) ; Vector containing dimensions's name 163 tailledim=lonarr(contient.ndims) ; Vector containing dimensions's value 164 for dimiq=0,contient.ndims-1 do begin ; Loop on the number of dimensions 165 ncdf_diminq,cdfid,dimiq,name,value ; Name and value of the dimension 166 nomdim[dimiq]=name 167 tailledim[dimiq]=value 168 rien = widget_label(base2, value = name+' de taille: '+strtrim(value,1), /align_right) 169 ENDFOR 170 rien = widget_label(base2, value = ' ') ; We jump a line 171 ;------------------------------------------------------------ 172 ; base 3 choice of the variable 173 ;------------------------------------------------------------ 174 base3 = widget_base(base, /column) 175 rien = widget_label(base3, value = 'Nombre de variables: '+strtrim(contient.nvars,1), /align_left) 176 base31 = widget_base(base3, /row, /align_center) 177 ;Creation of a listename containing the name of all file's variables 178 listename = strarr(contient.nvars) 179 for varid=0,contient.nvars-1 do begin 180 varcontient=ncdf_varinq(cdfid,varid) ; that the variable contain 181 listename[varid] = varcontient.name 182 endfor 183 rien= widget_label(base31, value = 'variable') 184 ; Creation of a button with a pop-up menu. 185 base311=widget_droplist(base31,value=listename, uvalue=2) 186 rien = widget_label(base3, value = '') 187 ;------------------------------------------------------------ 188 ; base 4 button done 189 ;------------------------------------------------------------ 190 base4 = widget_base(base, /row) 191 base42=widget_button(base4,value='done', uvalue=3, /align_right) 192 ;Execution of the base window and of sub-windows 193 widget_control,base,/realize 194 ;------------------------------------------------------------ 195 xmanager,'xncdf_lec',base 196 ;------------------------------------------------------------ 197 ;------------------------------------------------------------ 198 ;------------------------------------------------------------ 199 return, res 200 end 201 ; 1 202 ; La lecture de ce programme se fait de bas en haut: 2 203 ; 1) xncdf_lec … … 5 206 ; --> wid_var_event 6 207 ; 208 ;+ 209 ; @file_comments 210 ; Procedure called by xmanager when we press on a button of a second widget created by wid_var. 211 ; 212 ; @param EVENT {in}{required} 213 ; A structure caracterizing the type of event which arrive to a widget number1 2 214 ; 215 ; @uses 216 ; wididbase,resultat,infovariable,indicewid,motcle 217 ; 218 ; @version 219 ; $Id$ 220 ;- 221 ;------------------------------------------------------------ 222 ;------------------------------------------------------------ 223 ;------------------------------------------------------------ 7 224 pro wid_var_event, event 8 ; NAME:wid_var_event9 ;10 ; PURPOSE:procedure appele par xmanager qd on appuie sur un bouton du11 ; 2eme widget cree par wid_var12 ;13 ; INPUTS: event, une structure caracterisant le type d''evenement qui14 ; arrive au widget numero1 215 ;16 ; COMMON BLOCKS:wididbase,resultat,infovariable,indicewid,motcle17 ;------------------------------------------------------------18 ;------------------------------------------------------------19 ;------------------------------------------------------------20 225 ; 21 226 compile_opt idl2, strictarrsubs … … 27 232 COMMON motcle, mcatt, mccount, mcoffset, mciodir, mcshift, mcstride, mcvar 28 233 ; 29 ; quel est le type d''evenement?234 ; What is the type of event? 30 235 widget_control, event.id, get_uvalue=uval 31 236 tailledimvar = tailledim[varcontient.dim] 32 237 if n_elements(uval) EQ 0 then return 33 ; case sur le type d''evenement238 ; case on the type of event. 34 239 case uval OF 35 1:BEGIN ; on change des valeurs dans le tableau 36 ; on controle que les valeurs mises dans le tableau ne sont pas 37 ; completement fausses 240 1:BEGIN ; We change values in the array 241 ; We check that values put in the array are not totally false. 38 242 widget_control, widbase1, get_value = table 39 ; agument du bon type ? 40 ; si le type est mauvais on change automatiquement par des valeurs par 41 ; defaut 243 ; Is it the good type of argument? 244 ; If the type is wrong, we automatically change it by default values. 42 245 if event.x GT (size(table))[1] then return 43 246 if event.y GT (size(table))[2] then return … … 50 253 , use_table_select = [event.x, event.y, event.x, event.y], set_value = 0 51 254 endif 52 ; agument avec une valeur nom debile?255 ; Argument with a wrong name value? 53 256 table = fix(table) 54 257 case event.x of 55 0:BEGIN ; on a touche a l''offset:258 0:BEGIN ; We touched the offset 56 259 if table[0, event.y] LT 0 then BEGIN 57 260 table[0, event.y] = 0 58 261 widget_control, widbase1, use_table_select = [0, event.y, 0, event.y] $ 59 262 , set_value = 0 60 61 ; si il depasse la dim du tableau on le met au max et le cont a 1263 endif 264 ; If it exceed the dimension of the array, we put it at the max and the cont at 1. 62 265 if table[0, event.y] GT tailledimvar[event.y]/table[3, event.y] then begin 63 266 widget_control, widbase1, use_table_select = [0, event.y,1, event.y] $ 64 267 , set_value = [tailledimvar[event.y]/table[3, event.y], 1] 65 ENDIF ELSE BEGIN 66 ; si avec le nouvel offset le count est trop grand, on le diminue juste 67 ; de ce qu''il faut! 268 ENDIF ELSE BEGIN 269 ; If, with the new offset, the cont is too big, we reduce it until it goes well! 68 270 if table[1, event.y] GT $ 69 271 (tailledimvar[event.y]/table[3, event.y])-table[0, event.y] then begin … … 73 275 ENDELSE 74 276 END 75 1:BEGIN ; on a touche au count277 1:BEGIN ;We touched the cont. 76 278 if table[1, event.y] LT 1 then BEGIN 77 279 table[1, event.y] = 1 … … 79 281 , set_value = 1 80 282 endif 81 ; si il est trop grand, on le diminue juste de ce qu''il faut!283 ; If it is too big, we reduce it until it goes well! 82 284 if table[1, event.y] GT $ 83 285 (tailledimvar[event.y]/table[3, event.y])-table[0, event.y] then BEGIN … … 86 288 endif 87 289 END 88 2:BEGIN ; on a touche au shift290 2:BEGIN ;We touched the shift. 89 291 widget_control, widbase1, use_table_select = [2, event.y, 2, event.y] $ 90 292 , set_value = table[2, event.y] MOD (tailledimvar[event.y]/table[3, event.y]) 91 293 END 92 3:BEGIN ; on touche au stride294 3:BEGIN ;We touched the stride. 93 295 if table[3, event.y] LT 1 then BEGIN 94 296 table[3, event.y] = 1 … … 96 298 , set_value = 1 97 299 endif 98 if table[3, event.y] EQ 0 then $ ; il ne doit pas etre nul300 if table[3, event.y] EQ 0 then $ ;It must not be null. 99 301 widget_control, widbase1, use_table_select = [3, event.y, 3, event.y] $ 100 302 , set_value = 1 101 ; il ne doit pas etre trop grand303 ; It must not be too big. 102 304 if table[3, event.y] GT tailledimvar[event.y] then $ 103 305 widget_control, widbase1, use_table_select = [0, event.y,3, event.y] $ … … 114 316 endcase 115 317 END 116 2111:BEGIN ;on a touche aux boutons oui/non 117 ; on actualise le vecteur selectatt a 0 ou 1 pour l''attribut concerne 118 ; (numero event.id) 318 2111:BEGIN ;We touched buttons yes/no 319 ; We update the vector selectatt at 0 or 1 for the concerned attribute (number event.id). 119 320 selectatt[where(widbase2111 EQ event.id)] = event.select 120 321 end 121 31:BEGIN ; on a appuye sur'get'322 31:BEGIN ;We pressed on 'get' 122 323 widget_control, widbase1, get_value = table 123 324 table = fix(table) … … 126 327 mccount = table[1, *] 127 328 mcstride = table[3, *] 128 if mcshift[0] NE -1 then BEGIN ; il y a des shifts129 ; on lit l''integralite des dimensions pour lesquelles il y a un shift329 if mcshift[0] NE -1 then BEGIN ; There are some shifts. 330 ; We read the wholeness of dimensions for which ones there is a shift. 130 331 mcoffset[mcshift] = 0 131 332 mccount[mcshift] = tailledimvar[mcshift] 132 ; on active pas stride qd il n''y en a pas besoin car ca fait ecrire a 133 ; l''ecran qqch de louche... 333 ; We do not activate stride when there is no need because it makes write something weird on the screen. 134 334 if total(mcstride) EQ n_elements(mcstride) then $ 135 335 ncdf_varget, cdfid, varid, res, OFFSET = mcoffset, COUNT = mccount $ 136 336 ELSE $ 137 337 ncdf_varget, cdfid, varid, res, OFFSET = mcoffset, COUNT = mccount, STRIDE = mcstride 138 ; pour faire le shift338 ; To do the shift 139 339 mcshift = table[2, *] 140 340 mcoffset = table[0, *] 141 341 mccount = table[1, *] 142 ; on definit commende qui permet de faire un shift342 ; We define the command allowing to do a shift. 143 343 commande = 'res=shift(res' 144 344 for dim = 0, varcontient.ndims-1 do commande = commande+','+string(table[2,dim]) 145 345 commande = commande+')' 146 346 rien = execute(commande) 147 ; on redefinit commnade qui permet de couper les dimensions qui n''ont 148 ; pas ete encore coupees (c''est celles que l''on shift) 149 commande = 'res=res[' ; initialisation de la commende 347 ; We redefine the command allowing to cut dimensions which has not been cut yet (ones we shift). 348 commande = 'res=res[' ; initialization of the command 150 349 for dim = 0, varcontient.ndims-1 do BEGIN 151 350 if mcshift[dim] EQ 0 then commande = commande+'*,' $ … … 154 353 commande = strmid(commande, 0, strlen(commande)-1)+']' 155 354 rien = execute(commande) 156 ; cas sans shift, on lit directement le bon bout de tableau355 ; Case without shift, we read directly the good part of the array. 157 356 ENDIF ELSE BEGIN 158 357 if total(mcstride) EQ n_elements(mcstride) then $ … … 161 360 ncdf_varget, cdfid, varid, res, OFFSET = mcoffset, COUNT = mccount, STRIDE = mcstride 162 361 ENDELSE 163 ; faut-il constituer une structure avec les attributs qui on ete selectionnes164 if total(selectatt) NE 0 then BEGIN ; il y a des attributs selectionnes165 res = create_struct(varcontient.name, res) ; on cree lastructure166 selectatt = where(selectatt EQ 1) ; on trouve les attributs selectiones167 for attid = 0, n_elements(selectatt)-1 do BEGIN ; pour lesquels on prend168 widget_control, widbase212[selectatt[attid]], get_value = attname ; le nom169 widget_control, widbase213[selectatt[attid]], get_value = attvalue ; la valeur170 res = create_struct(res, attname[0], attvalue[0]) ; on concatene la structe362 ; Do we have to constitute a structure with selected attributes. 363 if total(selectatt) NE 0 then BEGIN ; There are selected attributes 364 res = create_struct(varcontient.name, res) ; We create the structure 365 selectatt = where(selectatt EQ 1) ; We find selected attributes 366 for attid = 0, n_elements(selectatt)-1 do BEGIN ; for which we take 367 widget_control, widbase212[selectatt[attid]], get_value = attname ; the name 368 widget_control, widbase213[selectatt[attid]], get_value = attvalue ; the value 369 res = create_struct(res, attname[0], attvalue[0]) ; We concatenate the structure 171 370 endfor 172 371 endif 173 widget_control, event.top, /destroy ; on ferme le 2eme widget174 widget_control, base, /destroy ; on ferme le 1eme widget372 widget_control, event.top, /destroy ;We shut the second widget. 373 widget_control, base, /destroy ;We shut the first widget. 175 374 ncdf_close,cdfid 176 375 END 177 32: ; cas de l''affichage d''un held (avecxdisplayfile)178 33:widget_control, event.top, /destroy ; on ferme le 2eme widget376 32: ;Case of the display of a held (with xdisplayfile) 377 33:widget_control, event.top, /destroy ;We shut the second widget. 179 378 ELSE: 180 379 endcase … … 183 382 ;------------------------------------------------------------ 184 383 ;------------------------------------------------------------ 384 ;------------------------------------------------------------ 385 ;+ 386 ; @file_comments 387 ; This procedure manage the second created whiget when we call xncdf_lec. 388 ; This widget concern the reading of the variable. 389 ; 390 ; @param WIDID_PERE {in}{required} 391 ; It is a scalar containing the identity of the father widget which was 392 ; created by xncdf_lec and which has allowed to select the variable to be read. 393 ; 394 ; OUTPUTS: indirectement res (le tableau ou la structure resultat) 395 ; 396 ; @uses 397 ; resultat,infovariable,indicewid_var,motcle 398 ; 399 ; @version 400 ; $Id$ 401 ;- 402 ;------------------------------------------------------------ 403 ;------------------------------------------------------------ 404 ;------------------------------------------------------------ 185 405 PRO wid_var, widid_pere 186 ;------------------------------------------------------------187 ;------------------------------------------------------------188 ;------------------------------------------------------------189 ; NAME: wid_var190 ;191 ; PURPOSE: cette procedure gere le 2eme widget cree qd on appelle192 ; xncdf_lec. ce widget concerne la lecture de la variable193 ;194 ; INPUTS: widid_pere: un scalere contenant l'identite du widget pere195 ; qui a etait cree par xncdf_lec et qui a permis de selectionner la196 ; variable a lire.197 ;198 ; OUTPUTS: indirectement res (le tableau ou la structure resultat)199 ;200 ; COMMON BLOCKS:resultat,infovariable,indicewid_var,motcle201 ;202 ;------------------------------------------------------------203 ;------------------------------------------------------------204 ;------------------------------------------------------------205 406 ; 206 407 compile_opt idl2, strictarrsubs … … 212 413 res = -1 213 414 ;------------------------------------------------------------ 214 ; ouverture de la fenetre de base sous forme de colonnes 215 ;------------------------------------------------------------ 415 ; Opening of the base window as columns. 216 416 widbase = widget_base(/column, title='variable: '+varcontient.name, /align_center, group_leader = widid_pere) 217 417 ;------------------------------------------------------------ 218 ; ouverture de sous-fenetres de base ;219 ;------------------------------------------------------------ 220 ; widbase1 tableau desoffsets221 ;------------------------------------------------------------ 222 rien = widget_label(widbase, value = ' ') ; on saute une ligne223 ; defintion des lables des lignes du tableau418 ; Opening of the base subwindow 419 ;------------------------------------------------------------ 420 ; widbase1 array of offsets 421 ;------------------------------------------------------------ 422 rien = widget_label(widbase, value = ' ') ; We jump a line 423 ; Definition of labels of lines of the array 224 424 rowlab = string(tailledim[varcontient.dim]) 225 425 for i = 0, n_elements(rowlab)-1 do rowlab[i] = strtrim(rowlab[i], 1) 226 426 rowlab = nomdim[varcontient.dim]+replicate(': ', n_elements(varcontient.dim))+rowlab 227 ; definition des valeurs initiales du tableau427 ; Definition of array's initial values 228 428 valinit = lonarr(4, n_elements(varcontient.dim)) 229 ; col onne 0 : les offset429 ; column 0 : offsets 230 430 if keyword_set(mcoffset) AND n_elements(mcoffset) EQ varcontient.ndims THEN $ 231 431 valinit[0,*]=mcoffset ELSE valinit[0, *] = 0 232 ; colo nne 1 : lescounts432 ; colomn 1 : counts 233 433 if keyword_set(mccount) AND n_elements(mccount) EQ varcontient.ndims THEN $ 234 434 valinit[1,*]=mccount ELSE valinit[1, *] = tailledim[varcontient.dim] 235 ; col onne 2 : lesshifts435 ; column 2 : shifts 236 436 if keyword_set(mcshift) AND n_elements(mcshift) EQ varcontient.ndims THEN $ 237 437 valinit[2,*]=mcshift ELSE valinit[2, *] = 0 238 ; col onne 3 : lesstrides438 ; column 3 : strides 239 439 if keyword_set(mcstride) AND n_elements(mcstride) EQ varcontient.ndims THEN $ 240 440 valinit[3,*]=mcstride ELSE valinit[3, *] = 1 241 ; test des valeurs initiales du tableau441 ; test of initial values of the array 242 442 valinit = fix(valinit) 243 valinit[3, *] = 1 > valinit[3, *] < tailledim[varcontient.dim] ; test desstrides244 valinit[0, *] = 0 > valinit[0, *] < tailledim[varcontient.dim] ; test desoffsets245 ; test descounts443 valinit[3, *] = 1 > valinit[3, *] < tailledim[varcontient.dim] ; test of strides 444 valinit[0, *] = 0 > valinit[0, *] < tailledim[varcontient.dim] ; test of offsets 445 ; test of counts 246 446 valinit[1, *] = 1 > valinit[1, *] < ((tailledim[varcontient.dim]/valinit[3, *])-valinit[0, *]) 247 valinit[2, *] = valinit[2, *] MOD (tailledim[varcontient.dim]/valinit[3, *]) ; test desshifts248 ; declaration du tableau447 valinit[2, *] = valinit[2, *] MOD (tailledim[varcontient.dim]/valinit[3, *]) ; test of shifts 448 ; declaration of the array 249 449 widbase1 = widget_table(widbase, row_labels = rowlab, value = valinit, /editable $ 250 450 , column_labels = ['Offset', 'Count', 'Shift', 'Stride'], uvalue = 1) … … 253 453 rien = widget_label(widbase, value = 'du tableau ou des textes soient bien prises en compte', /align_center) 254 454 ;------------------------------------------------------------ 255 ; widbase2 choi x des attributs256 ;------------------------------------------------------------ 257 rien = widget_label(widbase, value = ' ') ; on saute une ligne455 ; widbase2 choice of attributes 456 ;------------------------------------------------------------ 457 rien = widget_label(widbase, value = ' ') ; We jump a line 258 458 widbase2 = widget_base(widbase, /column) 259 ; pour chaque attribut, on cree un widget (widbase21) qui contient en ligne un260 ; bouton oui/non (widbase211), et deux wigdet text (widbase212,261 ; widbase213)comportant le nom et la valeur de l''attribut.459 ; To each attribute, we created a widget (widbase21) containing in line a button 460 ; yes/no (widbase211), and two wigdet text (widbase212, widbase213) comprising the 461 ; name and the value of the attribute. 262 462 widbase21 = lonarr(varcontient.natts) 263 463 widbase211 = lonarr(varcontient.natts) 264 464 widbase2111 = lonarr(varcontient.natts) 265 ; vecteur qui serviera a savoir quels boutons oui/non sont 266 ; selectiones. cf. wid_var_event 465 ; Vector which will serve to know which yes/no are selected. see. wid_var_event 267 466 selectatt = lonarr(varcontient.natts) 268 467 selectatt[*] = 0 269 468 widbase212 = lonarr(varcontient.natts) 270 469 widbase213 = lonarr(varcontient.natts) 271 for attid = 0, varcontient.natts-1 do BEGIN ; boucle sur le nombre d''attributs470 for attid = 0, varcontient.natts-1 do BEGIN ;Lop on the number of attribute. 272 471 widbase21[attid] = widget_base(widbase2, /row) 273 472 name=ncdf_attname(cdfid,varid,attid) … … 279 478 endfor 280 479 ;------------------------------------------------------------ 281 ; widbase3 b outons du bas480 ; widbase3 buttons of the bottom. 282 481 ;------------------------------------------------------------ 283 482 widbase3 = widget_base(widbase, /row,/align_center) … … 286 485 widbase33=widget_button(widbase3,value='DONE', uvalue=33) 287 486 ;------------------------------------------------------------ 288 ;execution de la fentre de base et des sous-fenetres487 ;execution of the base window and of sub-window. 289 488 ;------------------------------------------------------------ 290 489 widget_control,widbase,/realize … … 295 494 ;------------------------------------------------------------ 296 495 496 ;------------------------------------------------------------ 497 ;------------------------------------------------------------ 498 ;------------------------------------------------------------ 499 ;+ 500 ; @file_comments 501 ; Procedure called by xmanager when we press a button of the first widget 502 ; created by par xncdf_lec 503 ; 504 ; @param EVENT 505 ; A structure caracterising the event type which arrive at the widget number 1. 506 ; 507 ; @uses 508 ; resultat, infovariable, motcle 509 ; 510 ; @version 511 ; $Id$ 512 ;- 513 ;------------------------------------------------------------ 514 ;------------------------------------------------------------ 515 ;------------------------------------------------------------ 297 516 PRO xncdf_lec_event, event 298 ;------------------------------------------------------------299 ;------------------------------------------------------------300 ;------------------------------------------------------------301 ; NAME:xncdf_lec_event302 ;303 ; PURPOSE: procedure appele par xmanager qd on appuie sur un bouton du304 ; 1ere widget cree par xncdf_lec305 ;306 ; INPUTS: event, une structure caracterisant le type d''evenement qui307 ; arrive au widget numero1308 ;309 ; COMMON BLOCKS:resultat, infovariable, motcle310 ;311 ;------------------------------------------------------------312 ;------------------------------------------------------------313 ;------------------------------------------------------------314 517 ; 315 518 compile_opt idl2, strictarrsubs … … 318 521 COMMON infovariable, cdfid, listename, contient, nomdim, tailledim, varid, varcontient 319 522 COMMON motcle, mcatt, mccount, mcoffset, mciodir, mcshift, mcstride, mcvar 320 ; quel est le type d''evenement?523 ; What is the type of event? 321 524 widget_control, event.id, get_uvalue=uval 322 ; case sur le type d''evenement525 ; case on the type of event. 323 526 case uval of 324 1:BEGIN ; on veut lire un autre fichier325 widget_control, event.id, get_value = nom ; on recupere le nom326 widget_control, event.top, /destroy ; on ferme le widget327 ncdf_close,cdfid ; on ferme le mauvais fichier qui a ete ouvert328 ; on reapellexncdf_lec527 1:BEGIN ; We want to read an other file 528 widget_control, event.id, get_value = nom ; We recuperate the name. 529 widget_control, event.top, /destroy ;We shut the widget. 530 ncdf_close,cdfid ;We shut the wrong file which has been opened. 531 ;We call back xncdf_lec 329 532 res = xncdf_lec(nom[0], ATT = mcatt, COUNT = mccount, OFFSET = mcoffset, IODIR = mciodir $ 330 533 , SHIFT = mcshift, STRIDE = mcstride, VAR = mcvar) 331 534 return 332 535 END 333 2:BEGIN ; une variable est selectionee334 varid = event.index ; on recupere son numero ds le fichierNetcdf536 2:BEGIN ; A variable is selected. 537 varid = event.index ; We recuperat its number in the file Netcdf 335 538 varcontient = ncdf_varinq(cdfid,varid) 336 wid_var, event.top ; on appelle le programme qui lance le 2eme widget. cf. + haut539 wid_var, event.top ; We call the program which launch the second widget. See sooner. 337 540 END 338 3:BEGIN ; b outon done339 widget_control, event.top, /destroy ; on tue le widget340 ncdf_close,cdfid ; on ferme le fichier541 3:BEGIN ; button done 542 widget_control, event.top, /destroy ; We delete the widget 543 ncdf_close,cdfid ; We shut the file. 341 544 END 342 545 ELSE: … … 344 547 return 345 548 end 346 ;------------------------------------------------------------347 ;------------------------------------------------------------348 ;------------------------------------------------------------349 ;+350 ; NAME: xncdf_lec351 ;352 ; PURPOSE: lecture d''un fichier Net Cdf avec des widgets !353 ;354 ; CATEGORY: lecture de fichiers avec widgets355 ;356 ; CALLING SEQUENCE: res=xncdf_lec([nom_fichier])357 ;358 ; INPUTS:359 ; OPTIONNEL, nom_fichier: c''est un string qui donne le nom du360 ; fichier a ouvrir.Si nomfichier ne contient pas le caractere361 ; separateur de repertoirte ('/' sous unix par ex), Le fichier362 ; sera cherche ds le repertoire courant363 ;364 ; KEYWORD PARAMETERS:365 ;366 ; IODIR: string contenant le repertoire ou aller chercher le367 ; fichier a lire. Si nomfichier ne contient pas le caractere368 ; separateur de repertoirte ('/' sous unix par ex), Le fichier369 ; cherche s''appelera iodir+nom_fichier.370 ;371 ; COUNT: An optional vector containing the counts to be used in372 ; reading Value. COUNT is a 1-based vector with an element for373 ; each dimension of the data to be written.The default matches374 ; the size of the variable so that all data is written out.375 ;376 ; GROUP: The widget ID of the widget that calls XNCDF_LEC. When377 ; this ID is specified, a death of the caller results in a death378 ; of XNCDF_LEC.379 ;380 ; OFFSET: An optional vector containing the starting position381 ; for the read. The default start position is [0, 0, ...].382 ;383 ; SHIFT: un vecteur d''entiers, specifiant pour chaque dimension384 ; de combien il faut la shifter. Par defaut c''est385 ; [0,0,...]. cf. la fonction shift pour +386 ; d''explications. ATTENTION, le shift est effectue sur le387 ; tableau de taille maximum avant la reduction eventuelle388 ; determinee par OFFSET et COUNT. Par contre il est effectue389 ; apres l''extraction eventuelle cree par le STRIDE.390 ;391 ; STRIDE: An optional vector containing the strides, or sampling392 ; intervals, between accessed values of the netCDF variable. The393 ; default stride vector is that for a contiguous read, [1, 1,394 ; ...].395 ;396 ; OUTPUTS: 2 cas possibles:397 ; 1) aucun attributs n''a ete selectionne. Dans ce cas res est398 ; le tableau que l''on voulait lire.399 ; 2) Des attributs ont ete selectionnes. Dans ce cas res est une400 ; structre dont le premier element portant le nom de la variable401 ; est le tableau de valeurs et les autre auguments sont les402 ; arguments selectiones403 ;404 ; COMMON BLOCKS: wididbase, infovariable, resultat, motcle405 ;406 ; SIDE EFFECTS:407 ;408 ; RESTRICTIONS:409 ;410 ; EXAMPLE: help, xncdf_lec()411 ;412 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)413 ; 24/8/1999414 ;-415 ;------------------------------------------------------------416 ;------------------------------------------------------------417 ;------------------------------------------------------------418 FUNCTION xncdf_lec, nom, ATT = att, COUNT = count, GROUP = group, OFFSET = offset, IODIR = iodir, SHIFT = shift, STRIDE = stride, VAR = var419 ;420 compile_opt idl2, strictarrsubs421 ;422 COMMON wididbase, base423 COMMON infovariable, cdfid, listename, contient, nomdim, tailledim, varid, varcontient424 COMMON resultat, res425 COMMON motcle, mcatt, mccount, mcoffset, mciodir, mcshift, mcstride, mcvar426 ;------------------------------------------------------------427 ; bidouille pour utiliser les mots cles (on passe par des variables428 ; declarees ds un common)429 ;------------------------------------------------------------430 res = -1431 if keyword_set(att) then mcatt = att ELSE mcatt = 0432 if keyword_set(count) then mccount =count ELSE mccount = 0433 if keyword_set(offset) then mcoffset = offset ELSE mcoffset = 0434 if keyword_set(shift) then mcshift = shift ELSE mcshift = 0435 if keyword_set(stride) then mcstride = stride ELSE mcstride = 0436 if keyword_set(var) then mcvar = var ELSE mcvar = 0437 ;------------------------------------------------------------438 ; choix du nom du fichier439 ;------------------------------------------------------------440 ; Quel type de machine est utiliee441 thisOS = strupcase(strmid(!version.os_family, 0, 3))442 CASE thisOS of443 'MAC':sep = ':'444 'WIN':sep = '\'445 ELSE: sep = '/'446 ENDCASE447 ; si iodir n''est pas definit on l''initialise au repertoire courant448 if NOT keyword_set(iodir) then cd, current = iodir449 mciodir = iodir450 ; on complete iodir d''un caractere separateur de repertoire si besoin451 ; est.452 IF rstrpos(iodir, sep) NE strlen(iodir)-1 THEN iodir = iodir+sep453 if n_elements(nom) EQ 0 then BEGIN ; si nom n''est pas definit454 ; on en trouve un grace au programme dialog_pickfile455 nom = dialog_pickfile(filter = iodir+'*.nc')456 if nom[0] EQ '' then return, -1 ; si on a rien trouve on sort457 ;on complete nom par iodir si nom ne contient pas de caractere458 ;separateur derepertoire459 ENDIF ELSE if strpos(nom, sep) EQ -1 then nom = iodir+nom460 test = findfile(nom) ; le nom cherche correspond bien a un fichier?461 while test[0] EQ '' OR n_elements(test) GT 1 do BEGIN ; on en cherche un tant qu''il ne correspond a rien!462 test = test[0]463 nom = dialog_pickfile(filter = iodir+'*.nc')464 if nom EQ '' then return, -1465 test = findfile(nom)466 endwhile467 ;------------------------------------------------------------468 ; ouverture du fichier nom469 ;------------------------------------------------------------470 cdfid=ncdf_open(nom)471 contient=ncdf_inquire(cdfid)472 ;------------------------------------------------------------473 ; que contient le fichier??474 ;------------------------------------------------------------475 ; ouverture de la fenetre de base sous forme de colonnes476 if n_elements(group) EQ 0 then base = widget_base(/column, title='Fichier: '+nom, /align_left) $477 ELSE base = widget_base(/column, title='Fichier: '+nom, /align_left, GROUP_LEADER = group)478 ; ouverture de sous-fenetres de base ;479 ;------------------------------------------------------------480 ; base 1 titre portant le nom du fichier481 ;------------------------------------------------------------482 base1 = widget_base(base, /column, /align_center)483 rien = widget_label(base1, value = 'Net Cdf filename', /align_center) ; blabla484 rien = widget_text(base1, value = nom, /align_center, uvalue=1, /editable) ;nom du fichier que l''on peut changer485 rien = widget_label(base1, value = ' ') ; on saute une ligne486 ;------------------------------------------------------------487 ; base 2 informations generales sur le fichier488 ;------------------------------------------------------------489 base2 = widget_base(base, /column)490 ;------------------------------------------------------------491 ; informations sur les attributs globaux492 ;------------------------------------------------------------493 if contient.ngatts NE -1 then begin494 rien = widget_label(base2, value = 'Nombre de attributs globaux: '+ strtrim(contient.ngatts,1), /align_left)495 for attiq=0,contient.ngatts-1 do BEGIN ; bouble sur le nombre d'attributs globaux496 name=ncdf_attname(cdfid,attiq,/global) ;nom de l''atribut497 ncdf_attget,cdfid,name,value,/global ;valeur de l''atribut498 rien = widget_text(base2, value = name+': '+strtrim(string(value),1), xsize = 60, /scroll, /wrap, /align_right)499 endfor500 rien = widget_label(base2, value = ' ')501 endif502 ;------------------------------------------------------------503 ; informations sur les dimensions504 ;------------------------------------------------------------505 rien = widget_label(base2, value = 'Nombre de dimensions: '+strtrim(contient.ndims,1), /align_left)506 if contient.recdim NE -1 then begin ; bouble sur le nombre de dimensions507 ncdf_diminq,cdfid,contient.recdim,name,value ; nom et valeur de la dimension508 rien = widget_label(base2, value = 'nom de la dimension infinie: '+name, /align_left)509 endif510 ;511 nomdim =strarr(contient.ndims) ; vecteur contenant le nom des dimensions512 tailledim=lonarr(contient.ndims) ; vecteur contenant la valeur des dimensions513 for dimiq=0,contient.ndims-1 do begin ; bouble sur le nombre de dimensions514 ncdf_diminq,cdfid,dimiq,name,value ; nom et valeur de la dimension515 nomdim[dimiq]=name516 tailledim[dimiq]=value517 rien = widget_label(base2, value = name+' de taille: '+strtrim(value,1), /align_right)518 ENDFOR519 rien = widget_label(base2, value = ' ') ; on saute une ligne520 ;------------------------------------------------------------521 ; base 3 choix de la variable522 ;------------------------------------------------------------523 base3 = widget_base(base, /column)524 rien = widget_label(base3, value = 'Nombre de variables: '+strtrim(contient.nvars,1), /align_left)525 base31 = widget_base(base3, /row, /align_center)526 ;creation d'un vecteur listename contenant le nom de toutes les527 ;variables du fichier528 listename = strarr(contient.nvars)529 for varid=0,contient.nvars-1 do begin530 varcontient=ncdf_varinq(cdfid,varid) ; que contient la variable531 listename[varid] = varcontient.name532 endfor533 rien= widget_label(base31, value = 'variable')534 ; creation d''un bouton a menu deroulant535 base311=widget_droplist(base31,value=listename, uvalue=2)536 rien = widget_label(base3, value = '')537 ;------------------------------------------------------------538 ; base 4 bouton done539 ;------------------------------------------------------------540 base4 = widget_base(base, /row)541 base42=widget_button(base4,value='done', uvalue=3, /align_right)542 ;execution de la fentre de base et des sous-fenetres543 widget_control,base,/realize544 ;------------------------------------------------------------545 xmanager,'xncdf_lec',base546 ;------------------------------------------------------------547 ;------------------------------------------------------------548 ;------------------------------------------------------------549 return, res550 end -
trunk/SRC/ToBeReviewed/POSTSCRIPT/calibre.pro
r134 r150 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME: calibre 6 ; 7 ; PURPOSE:a partir d''un rapport d''aspect et des valeurs (en ligne de 8 ; characteres) des differentes marges, calcul posfenetre et posbar qui 9 ; servent a placer le dessin et la barre de couleur grace a 10 ; !p.position sur une feuille ou 11 ; sur une sortie ecran dont la fenetre a les memes proportions 12 ; 13 ; CATEGORY: positionnement du graphe 14 ; 15 ; CALLING SEQUENCE: 16 ; calibre, rapportyx,marge,margebar, smalldraw,posfenetre, posbar 17 ; 18 ; INPUTS: 19 ; rapportyx: rapport d''echelle entre la longueur de l''axe des 20 ; y et celle des x. par ex pour une carte xy, 21 ; rapportyx=(lat2-lat1)/(lon2-lon1) 22 ; 23 ; marge: vecteur de 4 elements contenant la taille des marges a gauche, 24 ; a droite, en bas et en haut devant entourer le graphe. tout est 25 ; mesure en lignes de characteres 26 ; 27 ; margebar: vecteur de 4 elements contenant la taille des marges a gauche, 28 ; a droite, en bas et -ATTENTION- le dernier element est cette fois-ci 29 ; la position de coin en haut a droite, devant entourer la barre de 30 ; couleur. tout est mesure en lignes de characteres 31 ; 32 ; smalldraw: 2 possiblites 33 ; un vecteur de 4 elements donnant (en portrait ou 34 ; en landscape) la position de cadre ds lequel doit rentrer le 35 ; dessin. cette position est donne par les coordonnes des 2 coins du 36 ; cadre: en bas a gauche et en haut a droite. elle s''exprime tjs 37 ; (pour un postscript ou une sortie ecran) en cm, l''origine etant le 38 ; coin en bas a gauche. 39 ; un vecteur de 3 elements donnant le nombre de colonnes a 40 ; faire de le dessin, le nombre de lignes et enfin le numero de la 41 ; case que doit occuper le dessin (cf matlab). par ex pour faire 6 42 ; dessin en 2 colonnes et 3 lignes et occuper la 4 eme case, small=[2,3,4] 43 ; 44 ; KEYWORD PARAMETERS: 45 ; 46 ; /REMPLI:oblige le dessin a occuper l'espace maximum definit 47 ; par smalldraw sans resperter le rapport y sur x. 48 ; 49 ; YXASPECT: force le rapport y sur x a prendre la valeur 50 ; rapportyx*yxaspect. ce mot cle est utile ds deux cas: 51 ; 1) yxaspect=1 : oblige rapportyx a etre bien respecte sinon 52 ; calibre se reserve le droit de changer un peu celui-ci dans 53 ; le cas ou le rapport d''aspect de small dessin est trop 54 ; different de celui de smalldraw. 55 ; 2) yxaspect=n : multiplie par n le rapport d''aspect donne par 56 ; defaut.par ex ds plt, rapportyx est calcule pour que le 57 ; repere soit orthonorme, pour avoir un repere ou l''axe des y 58 ; est 2 fois plus dilate que celui des y YXASPECT=2 5 ; @file_comments 6 ; From a rapport of aspect and values (in line of character) of different margins, 7 ; it calculate POSFENETRE and POSBAR which serve to place the drawing and the color 8 ; bar thanks to !p.position on a leaf or a screen output whose the window has the same 9 ; proportion. 10 ; 11 ; @categories 12 ; graphics 13 ; 14 ; 15 ; @param RAPPORTYX {in}{required} 16 ; Scale rapport between the lenght of the y axis and the x one. For example, 17 ; for an xy map: RAPPORTYX=(lat2-lat1)/(lon2-lon1) 18 ; 19 ; @param MARGE {in}{required} 20 ; Vector made of 4 elements containing the size of the left, right, up and 21 ; bottom margin having to surround the graph. All is measured in lines of characters. 22 ; 23 ; @param MARGEBAR {in}{required} 24 ; Vector made of 4 elements containing the size of the left, right and bottom 25 ; margin and -BEWARE- the last element is this time the positio of the right up 26 ; corner, having to surround the color bar. All is measured in lines of characters. 27 ; 28 ; @param SMALLDRAW {in}{required} 29 ; 2 possibilities: 30 ; It is vector made of 4 elements giving (in portrait or landscape) the position 31 ; of the frame in which the drawing must go in. This position is given by coordinates 32 ; of the 2 corners of the frame: in the left bottom and the right up. It is always 33 ; (for a postscript or a screen output) express in cm, the origin being the 34 ; left bottom corner. 35 ; It is a vector made of 3 elements giving the number of column to be done in the 36 ; drawing, the number of line and the number of the case the number have to occupy 37 ; (see matlab). For example, to do 6 drawing in 3 columns and 2 lines and occupy 38 ; the 4th case, small=[2,3,4] 39 ; 40 ; @keyword REMPLI 41 ; Force the drawing to occupy the biggest possible place defined by 42 ; SMALLDRAW without respect the rapport y on x. 43 ; 44 ; @keyword YXASPECT 45 ; Force the rapport y on x to take the value RAPPORTYX*YXASPECT. 46 ; This keyword can be used in 2 cases: 47 ; 1) YXASPECT=1 : force RAPPORTYX to be respected otherwise, Calibre take the 48 ; initiative to change it a little inthe case of the aspect rapport of SMALL 49 ; is too different of the one of SMALLDRAW. 50 ; 2) YXASPECT=n : multiply by n the aspect rapport given by default. 51 ; For example in plt, RAPPORTYX is calculated to the reference be orthonormal, 52 ; to have a reference where the y axis is 2 time bigger than the x one, YXASPECT=2. 59 53 ; 60 ; PORTRAIT et LANDSCAPE: mots cles plus utilises mais tjs fonctionnels 61 ; 62 ; OUTPUTS: 63 ; posfenetre: un vecteur de 4 elements contenant la position de 64 ; cadre contenant les legendes + le graphe en coordonnes 65 ; normalises. Rq: pour positionner le dessin il faut apres 66 ; l''appelle de calibre faire !p.position=posfenetre 67 ; 68 ; posbar: cf posfentre mais pour la barre de couleur. meme 69 ; remarque pour positionner la barre de couleur, !p.position=posbar 70 ; 71 ; COMMON BLOCKS: 72 ; common.pro 73 ; 74 ; SIDE EFFECTS: 75 ; 76 ; RESTRICTIONS: 77 ; 78 ; EXAMPLE: 79 ; 80 ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr) 54 ; @keyword PORTRAIT 55 ; Force the page or the window to be in standing position. 56 ; 57 ; @keyword LANDSCAPE 58 ; Force the page or the window on the screen to be in lenthened position. 59 ; 60 ; @keyword _EXTRA 61 ; Used to pass your keywords 62 ; 63 ; @param POSFENETRE 64 ; It is a vector made of 4 elements containing the position of the frame 65 ; containing captions + the graph in normalized coordinates. 66 ; Comment: to position the drawing, we have to do !p.position=POSFENETRE 67 ; after the call of calibre. 68 ; 69 ; @param POSBAR 70 ; See POSFENTRE but for the color bar. Same comment to position the color bar, !p.position=POSBAR 71 ; 72 ; @uses 73 ; common.pro 74 ; 75 ; @history 76 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 81 77 ; 11/12/98 78 ; 79 ; @version 80 ; $Id$ 82 81 ;- 83 82 ;------------------------------------------------------------ … … 98 97 ;--------------------------------------------------------- 99 98 ;------------------------------------------------------------ 100 tempsun = systime(1) ; pour key_performance99 tempsun = systime(1) ; For key_performance 101 100 ;------------------------------------------------------------- 102 101 if keyword_set(portrait) then key_portrait=1 … … 112 111 mipgsz = min(page_size, max = mapgsz) 113 112 ;------------------------------------------------------------ 114 ; choi x de Landscape ouPortrait113 ; choice of Landscape or Portrait 115 114 ;------------------------------------------------------------ 116 115 if n_elements(key_portrait) eq 0 then begin … … 119 118 endif 120 119 ;------------------------------------------------------------- 121 ; si smalldraw est compte comme dsmatlab120 ; If smalldraw is count like in matlab 122 121 ;------------------------------------------------------------- 123 122 if n_elements(smalldraw) EQ 3 then begin … … 136 135 endif 137 136 ;------------------------------------------------------------ 138 ; determination de la taille des characteres (!p.charsize)137 ; determination of the size of characters (!p.charsize) 139 138 ;------------------------------------------------------------ 140 139 nombre_de_mots_ds_titre = 60. … … 143 142 if !p.charsize gt 1 then !p.charsize=1 144 143 ;------------------------------------------------------------ 145 ; transfert de marge en cm144 ; transfert of margin in cm 146 145 ;------------------------------------------------------------ 147 146 cm=1.*!d.x_px_cm … … 149 148 margebar=1.* margebar * !d.y_ch_size * !p.charsize / cm 150 149 ;------------------------------------------------------------ 151 ; definition de la portion de feuille ou on dessine150 ; definition of the part of the leaf where we draw 152 151 ;------------------------------------------------------------ 153 152 if key_portrait eq 0 then begin … … 162 161 else rapportmax=1.*(small-marge[2]-marge[0])/(big-marge[3]-marge[1]) 163 162 ;------------------------------------------------------------ 164 ; si yxaspect n'est pas specifie on modifie la valeur de rapportyx pour que165 ; ca colle un peu plus aux proportions de la feuille163 ; If YXASPECT is not specified, we modify the value of RAPPORTYX 164 ; to it match better with the leaf's proportions. 166 165 ;------------------------------------------------------------ 167 166 if rapportyx le rapportmax then begin … … 183 182 endelse 184 183 ;------------------------------------------------------------ 185 ; dans le cas ou on fait unLandscape:184 ; in the case where we do a Landscape: 186 185 ;------------------------------------------------------------ 187 186 if key_portrait eq 0 then begin … … 214 213 endif $ 215 214 ;------------------------------------------------------------ 216 ; dans le cas ou on fait unportrait:215 ; In the case where we do a portrait: 217 216 ;------------------------------------------------------------ 218 217 else begin -
trunk/SRC/ToBeReviewed/POSTSCRIPT/ps.pro
r134 r150 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:ps 5 ; @file_comments 6 ; Redirect the content of the graphic window in a postscript, 7 ; by redoing commands in the postscript's environment. 6 8 ; 7 ; PURPOSE:redirige le contenu de la fenetre graphique ds un postcript, 8 ; en reeffectuant les commandes ds l''environnement postscript. 9 ; @categories 10 ; utilities 11 ; 12 ; @restrictions 13 ; We use journal which allows to stock commands we pass. 9 14 ; 10 ; CATEGORY:pour faire un ps 15 ; @restrictions 16 ; Can break down if some wierd commands are passed... 17 ; Comment: we erase Syntax error, Illegal characters, comapatible 18 ; with oups, text_box... 11 19 ; 12 ; CALLING SEQUENCE:@ps 13 ; 14 ; INPUTS: 15 ; 16 ; KEYWORD PARAMETERS: 17 ;; 18 ; OUTPUTS: 19 ; 20 ; COMMON BLOCKS: 21 ; 22 ; SIDE EFFECTS: on utilise journal qui perment de stoker les commandes 23 ; que l''on passe. 24 ; 25 ; RESTRICTIONS:peut planter si des commandes bizarres sont passees... 26 ; rq: on efface les Syntax error, les Illegal character, commapatible 27 ; avec oups, text_box... 28 ; 29 ; EXAMPLE: 30 ; 31 ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr) 20 ; @history 21 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 32 22 ; 5/3/1999 33 23 ;- … … 36 26 ;------------------------------------------------------------ 37 27 ;------------------------------------------------------------ 38 ; il faut fermer le journal!28 ; We have to close the journal! 39 29 ;------------------------------------------------------------ 40 ;if !journal EQ 0 then begin41 ;print, 'Il n''y a pas de journal ouvert !!'42 ;GOTO, sortie30 if !journal EQ 0 then begin 31 print, 'Il n''y a pas de journal ouvert !!' 32 GOTO, sortie 43 33 journal 44 34 ;------------------------------------------------------------ 45 ; on complete le journal ...35 ; we complete the journal ... 46 36 ;------------------------------------------------------------ 47 ; on recupere le journal sous la forme d''un vecteur de string:37 ; We recuperate the journal as a vector of string : 48 38 vectjournal = getfile(myuniquetmpdir+'idlsave.pro') 49 ;FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]39 FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] 50 40 ;------------------------------------------------------------ 51 ; on coupe la derniere ligne qui est@ps41 ; We cut the last line which is \@ps 52 42 ;------------------------------------------------------------ 53 43 IF strpos(vectjournal[n_elements(vectjournal)-1],'@ps') ne -1 then $ 54 44 vectjournal = vectjournal[0:n_elements(vectjournal)-2 ] 55 45 ;------------------------------------------------------------ 56 ; on le corrige si besoin est...46 ; We correct it if needed... 57 47 ;------------------------------------------------------------ 58 48 for i = 0, n_elements(vectjournal)-1 do $ 59 49 if strpos(vectjournal[i],'text_box' ) EQ -1 then $ 60 50 vectjournal[i] = strtrim(strcompress(vectjournal[i]), 2) 61 ;FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]62 ;2 li gnes sont identiques??51 FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] 52 ;2 lines are identical ?? 63 53 for i = 0, n_elements(vectjournal)-2 do $ 64 54 if vectjournal[i] EQ vectjournal[i+1] then vectjournal[i] = ' ' 65 ;FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]66 55 FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] 56 ; 67 57 for i = 0, n_elements(vectjournal)-1 do BEGIN & $ 68 58 if strpos(vectjournal[i],'oups' ) NE -1 $ … … 70 60 OR strpos(vectjournal[i],'Illegal character' ) NE -1 $ 71 61 then BEGIN vectjournal[i] = ' ' & vectjournal[i-1] = ' ' & endif & endfor 72 ;FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]62 FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] 73 63 for i = 0, n_elements(vectjournal)-1 do BEGIN & $ 74 64 if strpos(strtrim(vectjournal[i], 1),'retall' ) EQ 0 $ … … 79 69 OR strpos(vectjournal[i],'print' ) NE -1 $ 80 70 then vectjournal[i] = ' ' & endfor 81 ;FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]71 FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] 82 72 for i = 0, n_elements(vectjournal)-1 do BEGIN & $ 83 73 if strpos(strtrim(vectjournal[i], 1),'plt' ) NE -1 THEN BEGIN & $ … … 86 76 vectjournal[i] = vectjournal[i]+',/noerase' & $ 87 77 ENDIF & endfor 88 ;FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]78 FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] 89 79 for i = 0, n_elements(vectjournal)-1 do BEGIN & $ 90 80 if strpos(vectjournal[i],'text_box' ) NE -1 then $ … … 92 82 vectjournal[i] = vectjournal[i]+strmid(vectjournal[i+1], 1) & endfor 93 83 94 ; on le complete pour le transformer en une procedure equivalente aplein2dessin95 ;vectjournal = ['reinitplt, /z,/invert' $84 ; We complete it to transform it in a procedure equivalent to plein2dessin 85 vectjournal = ['reinitplt, /z,/invert' $ 96 86 vectjournal = ['openps, infowidget= infowidget' $ 97 87 , vectjournal $ 98 88 ,'closeps, infowidget= infowidget' $ 99 89 ,'printps' ] 100 ;FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]101 ; on reecritidlsave.pro90 FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] 91 ; We rewrite idlsave.pro 102 92 putfile, myuniquetmpdir+'idlsave.pro', vectjournal 103 ; appl iqueidlsave93 ; apply idlsave 104 94 cd, current = curdir 105 95 cd, myuniquetmpdir 106 96 @idlsave 107 97 cd, curdir 108 ; on reouvre le journal et on y met les elements de 109 ; vectjournal sauf les 2 premieres lignes et les 3 dernieres lignes 98 ; We reopen the journal and we put in it all elements of vectjournal but the 2 first and the 3 last line. 110 99 journal, myuniquetmpdir+'idlsave.pro' 111 100 for i = 2, n_elements(vectjournal)-3 DO $ -
trunk/SRC/ToBeReviewed/STATISTICS/a_correlate2d.pro
r134 r150 1 ;+2 ; NAME:3 ; A_CORRELATE2d4 ;5 ; PURPOSE:6 ;7 ; This function computes the autocorrelation Px(K,L) or8 ; autocovariance Rx(K,L) of a sample population X[nx,ny] as a9 ; function of the lag (K,L).10 ;11 ; CATEGORY:12 ; Statistics.13 ;14 ; CALLING SEQUENCE:15 ; Result = a_correlate2d(X, Lag)16 ;17 ; INPUTS:18 ; X: an 2 dimension Array [nx,ny]19 ;20 ; LAG: 2-element vector, in the intervals [-(nx-2), (nx-2)],[-(ny-2), (ny-2)],21 ; of type integer that specifies the absolute distance(s) between22 ; indexed elements of X.23 ;24 ; KEYWORD PARAMETERS:25 ; COVARIANCE: If set to a non-zero value, the sample autocovariance26 ; is computed.27 ;28 ; DOUBLE: If set to a non-zero value, computations are done in29 ; double precision arithmetic.30 ;31 ; EXAMPLE:32 ;33 ; PROCEDURE:34 ;35 ;36 ; nx-k-1 ny-l-137 ; sigma sigma (X[i,j]-Xmean)(X[i+k,j+l]-Ymean)38 ; i=0 j=039 ; correlation(X,[k,l])=------------------------------------------------------40 ; nx-1 ny-141 ; sigma sigma (X[i,j]-Xmean)^2)42 ; i=0 j=043 ;44 ;45 ; nx-k-1 ny-l-146 ; sigma sigma (X[i,j]-Xmean)(Y[i+k,j+l]-Ymean)47 ; i=0 j=048 ; covariance(X,[k,l])=------------------------------------------------------49 ; nx*ny50 ;51 ; Where Xmean is the mens of the sample population52 ; x=(x[0,0],x[1,0],...,x[nx-1,ny-1]).53 ;54 ;55 ; REFERENCE:56 ;57 ; MODIFICATION HISTORY:58 ; 28/2/2000 Sebastien Masson (smasson@lodyc.jussieu.fr)59 ; Based on the A_CORRELATE procedure of IDL60 ;-61 1 62 2 FUNCTION Auto_Cov2d, X, Lag, Double = Double, zero2nan = zero2nan … … 77 17 78 18 END 19 ;+ 20 ; 21 ; @file_comments 22 ; This function computes the autocorrelation Px(K,L) or 23 ; autocovariance Rx(K,L) of a sample population X[nx,ny] as a 24 ; function of the lag (K,L). 25 ; 26 ; @categories 27 ; Statistics. 28 ; 29 ; @param X {in}{required} 30 ; An 2 dimension Array [nx,ny] 31 ; 32 ; @param LAG {in}{required} 33 ; 2-element vector, in the intervals [-(nx-2), (nx-2)],[-(ny-2), (ny-2)], 34 ; of type integer that specifies the absolute distance(s) between 35 ; indexed elements of X. 36 ; 37 ; @keyword COVARIANCE 38 ; If set to a non-zero value, the sample autocovariance is computed. 39 ; 40 ; @keyword DOUBLE 41 ; If set to a non-zero value, computations are done in double precision arithmetic. 42 ; 43 ; @history 44 ; 28/2/2000 Sebastien Masson (smasson@lodyc.jussieu.fr) 45 ; Based on the A_CORRELATE procedure of IDL 46 ; 47 ; @version 48 ; $Id$ 49 ; 50 ;- 51 79 52 80 53 FUNCTION A_Correlate2d, X, Lag, Covariance = Covariance, Double = Double -
trunk/SRC/ToBeReviewed/STATISTICS/a_timecorrelate.pro
r134 r150 1 ;+2 ; NAME:3 ; A_TIMECORRELATE4 ;5 ; PURPOSE:6 ; Same function as A_CORRELATE but accept array (until 47 ; dimension) for input and do the autocorrelation or the8 ; autocovariance along the time dimension which must be the last9 ; one of the input array.10 ;11 ; This function computes the autocorrelation Px(L) or autocovariance12 ; Rx(L) of a sample population X as a function of the lag (L).13 ;14 ; CATEGORY:15 ; Statistics.16 ;17 ; CALLING SEQUENCE:18 ; Result = a_timecorrelate(X, Lag)19 ;20 ; INPUTS:21 ; X: an Array which last dimension is the time dimension os22 ; size n.23 ;24 ; LAG: A scalar or n-element vector, in the interval [-(n-2), (n-2)],25 ; of type integer that specifies the absolute distance(s) between26 ; indexed elements of X.27 ;28 ; KEYWORD PARAMETERS:29 ; COVARIANCE: If set to a non-zero value, the sample autocovariance30 ; is computed.31 ;32 ; DOUBLE: If set to a non-zero value, computations are done in33 ; double precision arithmetic.34 ;35 ; EXAMPLE36 ; Define an n-element sample population.37 ; x = [3.73, 3.67, 3.77, 3.83, 4.67, 5.87, 6.70, 6.97, 6.40, 5.57]38 ;39 ; Compute the autocorrelation of X for LAG = -3, 0, 1, 3, 4, 840 ; lag = [-3, 0, 1, 3, 4, 8]41 ; result = a_correlate(x, lag)42 ;43 ; The result should be:44 ; [0.0146185, 1.00000, 0.810879, 0.0146185, -0.325279, -0.151684]45 ;46 ; PROCEDURE:47 ;48 ;49 ; n-L-150 ; sigma (X[k]-Xmean)(X[k+L]-Xmean)51 ; k=052 ; correlation(X,L)=----------------------------------------53 ; n-154 ; sigma (X[k]-Xmean)^255 ; k=056 ;57 ;58 ;59 ; n-L-160 ; sigma (X[k]-Xmean)(X[k+L]-Xmean)61 ; k=062 ; covariance(X,L)=-------------------------------------------63 ; n64 ;65 ; Where Xmean is the Time mean of the sample population66 ; x=(x[t=0],x[t=1],...,x[t=n-1])67 ;68 ;69 ; REFERENCE:70 ; INTRODUCTION TO STATISTICAL TIME SERIES71 ; Wayne A. Fuller72 ; ISBN 0-471-28715-673 ;74 ; MODIFICATION HISTORY:75 ; 24/2/2000 Sebastien Masson (smasson@lodyc.jussieu.fr)76 ; Based on the A_CORRELATE procedure of IDL77 ;-78 79 1 FUNCTION TimeAuto_Cov, X, M, nT, Double = Double, zero2nan = zero2nan 80 2 ;Sample autocovariance function … … 108 30 109 31 END 32 ;+ 33 ; @file_comments 34 ; Same function as A_CORRELATE but accept array (until 4 35 ; dimension) for input and do the autocorrelation or the 36 ; autocovariance along the time dimension which must be the last 37 ; one of the input array. 38 ; 39 ; This function computes the autocorrelation Px(L) or autocovariance 40 ; Rx(L) of a sample population X as a function of the lag (L). 41 ; 42 ; @categories 43 ; Statistics. 44 ; 45 ; @param X {in}{required} 46 ; An Array which last dimension is the time dimension os 47 ; size n. 48 ; 49 ; @param LAG {in}{required} 50 ; A scalar or n-element vector, in the interval [-(n-2), (n-2)], 51 ; of type integer that specifies the absolute distance(s) between 52 ; indexed elements of X. 53 ; 54 ; @keyword COVARIANCE 55 ; If set to a non-zero value, the sample autocovariance 56 ; is computed. 57 ; 58 ; @keyword DOUBLE 59 ; If set to a non-zero value, computations are done in 60 ; double precision arithmetic. 61 ; 62 ; @examples 63 ; Define an n-element sample population. 64 ; x = [3.73, 3.67, 3.77, 3.83, 4.67, 5.87, 6.70, 6.97, 6.40, 5.57] 65 ; 66 ; Compute the autocorrelation of X for LAG = -3, 0, 1, 3, 4, 8 67 ; lag = [-3, 0, 1, 3, 4, 8] 68 ; result = a_correlate(x, lag) 69 ; 70 ; The result should be: 71 ; [0.0146185, 1.00000, 0.810879, 0.0146185, -0.325279, -0.151684] 72 ; 73 ; @history 74 ; 24/2/2000 Sebastien Masson (smasson@lodyc.jussieu.fr) 75 ; 76 ; Based on the A_CORRELATE procedure of IDL 77 ; INTRODUCTION TO STATISTICAL TIME SERIES 78 ; Wayne A. Fuller 79 ; ISBN 0-471-28715-6 80 ; 81 ; @version 82 ; $Id$ 83 ; 84 ;- 110 85 111 86 FUNCTION A_TimeCorrelate, X, Lag, COVARIANCE = Covariance, DOUBLE = Double -
trunk/SRC/ToBeReviewed/STATISTICS/c_timecorrelate.pro
r134 r150 1 ;+2 ; NAME:3 ; C_TIMECORRELATE4 ;5 ; PURPOSE:6 ; This function computes the "time cross correlation" Pxy(L) or7 ; the "time cross covariance" between 2 arrays (this is some8 ; kind of c_correlate but for multidimenstionals arrays) as a9 ; function of the lag (L).10 ;11 ; CATEGORY:12 ; Statistics.13 ;14 ; CALLING SEQUENCE:15 ; Result = c_timecorrelate(X, Y, Lag)16 ;17 ; INPUTS:18 ; X: an Array which last dimension is the time dimension of19 ; size n, float or double.20 ;21 ; Y: an Array which last dimension is the time dimension of22 ; size n, float or double.23 ;24 ; LAG: A scalar or n-element vector, in the interval [-(n-2), (n-2)],25 ; of type integer that specifies the absolute distance(s) between26 ; indexed elements of X.27 ;28 ; KEYWORD PARAMETERS:29 ; COVARIANCE: If set to a non-zero value, the sample cross30 ; covariance is computed.31 ;32 ; DOUBLE: If set to a non-zero value, computations are done in33 ; double precision arithmetic.34 ;35 ; EXAMPLE36 ; Define two n-element sample populations.37 ; x = [3.73, 3.67, 3.77, 3.83, 4.67, 5.87, 6.70, 6.97, 6.40, 5.57]38 ; y = [2.31, 2.76, 3.02, 3.13, 3.72, 3.88, 3.97, 4.39, 4.34, 3.95]39 ;40 ; Compute the cross correlation of X and Y for LAG = -5, 0, 1, 5, 6, 741 ; lag = [-5, 0, 1, 5, 6, 7]42 ; result = c_timecorrelate(x, y, lag)43 ;44 ; The result should be:45 ; [-0.428246, 0.914755, 0.674547, -0.405140, -0.403100, -0.339685]46 ;47 ; PROCEDURE:48 ;49 ;50 ; FOR L>=051 ;52 ; n-L-153 ; sigma (X[k]-Xmean)(Y[k+L]-Ymean)54 ; k=055 ; correlation(X,Y,L)=------------------------------------------------------56 ; n-1 n-157 ; sqrt( (sigma (X[k]-Xmean)^2)*(sigma (Y[k]-Ymean)^2))58 ; k=0 k=059 ;60 ;61 ;62 ; n-L-163 ; sigma (X[k]-Xmean)(Y[k+L]-Ymean)64 ; k=065 ; covariance(X,Y,L)=------------------------------------------------------66 ; n67 ;68 ; FOR L<069 ;70 ;71 ; n-L-172 ; sigma (X[k+L]-Xmean)(Y[k]-Ymean)73 ; k=074 ; correlation(X,Y,L)=------------------------------------------------------75 ; n-1 n-176 ; sqrt( (sigma (X[k]-Xmean)^2)*(sigma (Y[k]-Ymean)^2))77 ; k=0 k=078 ;79 ;80 ;81 ; n-L-182 ; sigma (X[k+L]-Xmean)(Y[k]-Ymean)83 ; k=084 ; covariance(X,Y,L)=------------------------------------------------------85 ; n86 ;87 ; Where Xmean and Ymean are the time means of the sample populations88 ; x=(x[t=0],x[t=1],...,x[t=n-1]) and y=(y[t=0],y[t=1],...,y[t=n-1]),89 ; respectively.90 ;91 ;92 ;93 ; REFERENCE:94 ; INTRODUCTION TO STATISTICAL TIME SERIES95 ; Wayne A. Fuller96 ; ISBN 0-471-28715-697 ;98 ; MODIFICATION HISTORY:99 ; - 01/03/2000 Sebastien Masson (smasson@lodyc.jussieu.fr)100 ; Based on the C_CORRELATE procedure of IDL101 ; - August 2003 Sebastien Masson102 ; update according to the update made in C_CORRELATE by103 ; W. Biagiotti and available in IDL 5.5104 ;-105 106 1 FUNCTION TimeCross_Cov, Xd, Yd, M, nT, Ndim, Double = Double, ZERO2NAN = zero2nan 107 2 ;Sample cross covariance function. … … 127 22 128 23 END 129 24 ;+ 25 ; @file_comments 26 ; This function computes the "time cross correlation" Pxy(L) or 27 ; the "time cross covariance" between 2 arrays (this is some 28 ; kind of c_correlate but for multidimenstionals arrays) as a 29 ; function of the lag (L). 30 ; 31 ; @categories 32 ; Statistics. 33 ; 34 ; @param X {in}{required} 35 ; An Array which last dimension is the time dimension of 36 ; size n, float or double. 37 ; 38 ; @param Y {in}{required} 39 ; An Array which last dimension is the time dimension of 40 ; size n, float or double. 41 ; 42 ; @param LAG {in}{required} 43 ; A scalar or n-element vector, in the interval [-(n-2), (n-2)], 44 ; of type integer that specifies the absolute distance(s) between 45 ; indexed elements of X. 46 ; 47 ; @keyword COVARIANCE 48 ; If set to a non-zero value, the sample cross 49 ; covariance is computed. 50 ; 51 ; @keyword DOUBLE 52 ; If set to a non-zero value, computations are done in 53 ; double precision arithmetic. 54 ; 55 ; @examples 56 ; 57 ; Define two n-element sample populations. 58 ; x = [3.73, 3.67, 3.77, 3.83, 4.67, 5.87, 6.70, 6.97, 6.40, 5.57] 59 ; y = [2.31, 2.76, 3.02, 3.13, 3.72, 3.88, 3.97, 4.39, 4.34, 3.95] 60 ; 61 ; Compute the cross correlation of X and Y for LAG = -5, 0, 1, 5, 6, 7 62 ; lag = [-5, 0, 1, 5, 6, 7] 63 ; result = c_timecorrelate(x, y, lag) 64 ; 65 ; The result should be: 66 ; [-0.428246, 0.914755, 0.674547, -0.405140, -0.403100, -0.339685] 67 ; 68 ; @history 69 ; - 01/03/2000 Sebastien Masson (smasson@lodyc.jussieu.fr) 70 ; Based on the C_CORRELATE procedure of IDL 71 ; - August 2003 Sebastien Masson 72 ; update according to the update made in C_CORRELATE by 73 ; W. Biagiotti and available in IDL 5.5 74 ; 75 ; INTRODUCTION TO STATISTICAL TIME SERIES 76 ; Wayne A. Fuller 77 ; ISBN 0-471-28715-6 78 ; 79 ; @version 80 ; $Id$ 81 ; 82 ;- 130 83 FUNCTION C_Timecorrelate, X, Y, Lag, Covariance = Covariance, Double = Double 131 84 -
trunk/SRC/ToBeReviewed/STRUCTURE/chkstru.pro
r134 r150 1 ; $Id$2 1 ;------------------------------------------------------------- 3 2 ;+ 4 ; NAME: 5 ; CHKSTRU (function) 3 ; @file_comments 4 ; check validity of a structure and test if necessary 5 ; fields are contained 6 6 ; 7 ; PURPOSE: 8 ; check validity of a structure and test if necessary 9 ; fields are contained 7 ; @categories 8 ; tools 10 9 ; 11 ; CATEGORY: 12 ; tools 10 ; @param STRUCTURE {in}{required} 11 ; The structure to be tested. If STRUCTURE is 12 ; not of type structure, the function will return 0 13 13 ; 14 ; CALLING SEQUENCE: 15 ; res=CHKSTRU(STRUCTURE,FIELDS [,/VERBOSE]) 14 ; @param FIELDS {in}{required} 15 ; A string or string array with field names to 16 ; be contained in STRUCTURE. CHKSTRU returns 1 (true) 17 ; only if all field names are contained in STRUCTURE. 18 ; The entries of FIELDS may be upper or lowercase. 16 19 ; 17 ; INPUTS: 18 ; STRUCTURE --> the structure to be tested. If STRUCTURE is 19 ; not of type structure, the function will return 0 20 ; @keyword INDEX 21 ; A named variable that will contain the indices of 22 ; the required field names in the structure. They can then 23 ; be assessed through structure.(index[i]) . Index will 24 ; contain -1 for all fields entries that are not in the 25 ; structure. 20 26 ; 21 ; FIELDS --> a string or string array with field names to 22 ; be contained in STRUCTURE. CHKSTRU returns 1 (true) 23 ; only if all field names are contained in STRUCTURE. 24 ; The entries of FIELDS may be upper or lowercase. 27 ; @keyword VERBOSE 28 ; set this keyword to return an error message 29 ; in case of an error. 25 30 ; 26 ; KEYWORD PARAMETERS: 27 ; INDEX --> a named variable that will contain the indices of 28 ; the required field names in the structure. They can then 29 ; be assessed through structure.(index[i]) . Index will 30 ; contain -1 for all fields entries that are not in the 31 ; structure. 31 ; @keyword EXTRACT 32 ; set this keyword to extract a fields from the 33 ; structure. -1 is return is fields or structure. are 34 ; incorrect. 32 35 ; 33 ; /VERBOSE --> set this keyword to return an error message34 ; in case of an error.36 ; @returns 37 ; CHKSTRU returns 1 if successful, otherwise 0. 35 38 ; 36 ; /EXTRACT --> set this keyword to extract a fields from the 37 ; structure. -1 is return is fields or structure. are 38 ; incorrect. 39 ; 40 ; OUTPUTS: 41 ; CHKSTRU returns 1 if successful, otherwise 0. 42 ; 43 ; SUBROUTINES: 44 ; 45 ; REQUIREMENTS: 46 ; 47 ; NOTES: 48 ; 49 ; EXAMPLE: 39 ; @examples 50 40 ; test = { a:1, b:2, c:3 } 51 41 ; required = ['a','c'] … … 56 46 ; 2 57 47 ; 58 ; MODIFICATION HISTORY:48 ; @history 59 49 ; mgs, 02 Mar 1998: VERSION 1.00 60 50 ; mgs, 07 Apr 1998: - second parameter (FIELDS) now optional 61 51 ; 12 Jan 2001: EXTRACT keyword by S. Masson (smasson@lodyc.jussieu.fr) 52 ; 53 ; @version 54 ; $Id$ 62 55 ; 63 56 ;- -
trunk/SRC/ToBeReviewed/STRUCTURE/extractstru.pro
r134 r150 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:extractstru 5 ; @file_comments 6 ; extract elements of a structure to constitute a new structure. 6 7 ; 7 ; PURPOSE:extrait des elements d''une structure pour constituer une8 ; nouvelle structure8 ; @categories 9 ; utilities 9 10 ; 10 ; CATEGORY: dibouille sur les structures 11 ; @param STRU {in}{required} 12 ; A structure 11 13 ; 12 ; CALLING SEQUENCE: res = extractstru(stru, liste)13 ; 14 ; INPUTS:14 ; @param LISTE {in}{required} 15 ; A vector of string including names of STRU to be deleted 16 ; (by default) or to be kept (if KEEP is activated). 15 17 ; 16 ; stru: une structure 18 ; @keyword KEEP 19 ; Specify that the given liste concern elements of STRU to be kept. 17 20 ; 18 ; liste: un vecteur de string comportant les noms des elements de 19 ; stru a virer (par DEFAUT) ou a garder (si GARDE est active) 21 ; @keyword DELETE: 22 ; Specify that the given liste concern elements of STRU to be deleted. 23 ; This keyword is activated by default. 20 24 ; 21 ; KEYWORD PARAMETERS: 25 ; @returns 26 ; A structure or -1 in case of problem 22 27 ; 23 ; /GARDE: specifie que la liste donnee concerne les elements de 24 ; stru a garder 25 ; 26 ; /VIRE: specifie que la liste donnee concerne les elements de 27 ; stru a virer. Ce mot cle est active par defaut 28 ; 29 ; OUTPUTS:une stucture ou -1 en cas de pb 30 ; 31 ; COMMON BLOCKS: 32 ; 33 ; SIDE EFFECTS: 34 ; 35 ; RESTRICTIONS: none !!! 36 ; liste peut contenir des noms d''elements qui ne sont pas ds stru, 37 ; le programme se debrouille avec 38 ; 39 ; EXAMPLE: 28 ; @examples 40 29 ; 41 30 ; IDL> extra=get_extra(/ok, year=1999, age_capitaine=35 ) … … 48 37 ; ** Structure <831afac>, 1 tags, length=2, refs=1: 49 38 ; AGE_CAPITAINE INT 35 50 ; IDL> help, extractstru(extra,['ok','hhuihi','YEAR'],/ garde),/stru39 ; IDL> help, extractstru(extra,['ok','hhuihi','YEAR'],/keep),/stru 51 40 ; ** Structure <834bbc4>, 2 tags, length=4, refs=1: 52 41 ; OK INT 1 53 42 ; YEAR INT 1999 54 43 ; 55 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) 44 ; @history 45 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 56 46 ; 8/10/1999 47 ; 48 ; @version 49 ; $Id$ 50 ; 57 51 ;- 58 52 ;------------------------------------------------------------ 59 53 ;------------------------------------------------------------ 60 54 ;------------------------------------------------------------ 61 FUNCTION extractstru, stru, liste, GARDE = garde, VIRE = vire55 FUNCTION extractstru, stru, liste, KEEP = keep, DELETE = delete 62 56 ; 63 57 compile_opt idl2, strictarrsubs … … 65 59 if size(stru, /type) NE 8 then return, -1 66 60 if size(liste, /type) NE 7 then return, -1 67 ; cheking for gardeand vire keywords68 garde = keyword_set(garde)*(1-keyword_set(vire))69 vire = keyword_set(vire)*(1-keyword_set(garde)) +(keyword_set(vire) EQ garde)61 ; cheking for keep and vire keywords 62 keep = keyword_set(keep)*(1-keyword_set(delete)) 63 delete = keyword_set(delete)*(1-keyword_set(keep)) +(keyword_set(delete) EQ keep) 70 64 ; 71 65 tname = tag_names(stru) 72 66 index = make_selection(tname, strupcase(liste), /only_valid, /quiet) 73 67 ; 74 if garde then BEGIN ; on garde que la liste68 if keep then BEGIN ; We just keep the list 75 69 if index[0] EQ -1 then return, -1 76 70 if n_elements(index) EQ n_elements(tname) then return, stru … … 78 72 if n_elements(index) GT 1 then for i = 1, n_elements(index)-1 do $ 79 73 res = create_struct(res, tname[index[i]], stru.(index[i])) 80 ENDIF ELSE BEGIN ; on vire la liste74 ENDIF ELSE BEGIN ; We delete the list 81 75 if n_elements(index) EQ n_elements(tname) then return, -1 82 76 if index[0] EQ -1 then return, stru 83 ; on prend le complementaire de index pour obtenir les indices que 84 ; l''on garde 77 ; We take the complementary one of index to obtain indexes we keep. 85 78 index = different(indgen(n_elements(tname)), index) 86 79 res = create_struct(tname[index[0]], stru.(index[0])) -
trunk/SRC/ToBeReviewed/STRUCTURE/mixstru.pro
r134 r150 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME: mixstru6 5 ; 7 ; PURPOSE: concatene 2 structures ensemble. La difference avec 8 ; CREATE_STRUCT etant que si les 2 stuctures ont les memes noms 9 ; d''elements alors mixstru ne plante pas mais choisit pour valeur de 10 ; l''element commun celle specifiee par la premiere structure. 6 ; @file_comments 7 ; Concatenate 2 structures together. The difference with CREATE_STRUCT 8 ; is that if the 2 structure have same elements's name, then mixstru 9 ; do not break down but choose for the common element the value 10 ; specified by the first structure. 11 11 ; 12 ; CATEGORY: structure 12 ; @categories 13 ; structure 14 ; 15 ; @param STRU1 {in}{required} 16 ; Structure which can have same elements's name than 17 ; STRU2 but with a different value. 13 18 ; 14 ; CALLING SEQUENCE: rs=mixstru(stru1,stru2) 15 ; 16 ; INPUTS: stru1 et stu2 sont 2 structures qui peuvent avoir des 17 ; elements portant le meme nom mais avec une valeur differente. 19 ; @param STRU2 {in}{required} 20 ; Structure which can have same elements's name than 21 ; STRU1 but with a different value. 18 22 ; 19 ; KEYWORD PARAMETERS: none 23 ; @returns 24 ; A stucture 20 25 ; 21 ; OUTPUTS: une stucture 26 ; @restrictions 27 ; If STRU1 or STRU2 is not a structure, mixstru send back -1 22 28 ; 23 ; COMMON BLOCKS: 24 ; 25 ; SIDE EFFECTS: si stru1 ou stru2 ne sont pas des structures mixstru 26 ; renvoie -1 27 ; 28 ; RESTRICTIONS: 29 ; 30 ; EXAMPLE: 29 ; @examples 31 30 ; 32 31 ; IDL> a=get_extra(/toto,ok=123) … … 53 52 ; YEAR INT 1999 54 53 ; 55 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) 54 ; @history 55 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 56 56 ; 7/10/1999 57 ; 58 ; @version 59 ; $Id$ 60 ; 57 61 ;- 58 62 ;------------------------------------------------------------ -
trunk/SRC/ToBeReviewed/STRUCTURE/struct2string.pro
r134 r150 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:struct2string 5 ; 6 ; @file_comments 7 ; Convert a structure to an "executable string" 6 8 ; 7 ; PURPOSE:convert a structure to an "executable string" 9 ; @categories 10 ; utilities 11 ; 12 ; @param STRUCT {in}{required} 13 ; A structure 8 14 ; 9 ; CATEGORY:bidouille 15 ; @keyword MAX_STRUCT_LENGTH 16 ; The maximum length of the structure 17 ; permetted to convert the structure to string. Default is 18 ; 10000l. 10 19 ; 11 ; CALLING SEQUENCE:sting=struct2string(struct) 12 ; 13 ; INPUTS:struct: a structure 20 ; @keyword DIRECT2STRING 21 ; To get a string instead an "executable string" 14 22 ; 15 ; KEYWORD PARAMETERS: 23 ; @keyword CUT_IN_STRING 24 ; Try it 16 25 ; 17 ; MAX_STRUCT_LENGTH : the maximum length of the structure 18 ; permetted to convert the structure to string. Default is 19 ; 10000l. 26 ; @restrictions 27 ; Use tostr.pro, cf this function header! 20 28 ; 21 ; /DIRECT2STRING: to get a string instead an "executable string" 22 ; 23 ; /CUT_IN_STRING: try it 24 ; 25 ; OUTPUTS: 26 ; 27 ; SIDE EFFECTS:use tostr.pro, cf this function header! 28 ; 29 ; RESTRICTIONS:use tostr.pro, cf this function header! 30 ; 31 ; EXAMPLE: 29 ; @examples 32 30 ; 33 31 ; IDL> print, struct2string(!d) … … 38 36 ; ,[0,0],'ZOOM',[1,1]) 39 37 ; 40 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) 38 ; @history 39 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 41 40 ; 2000 07 03 41 ; 42 ; @version 43 ; $Id$ 44 ; 42 45 ;- 43 46 ;------------------------------------------------------------ -
trunk/SRC/ToBeReviewed/STRUCTURE/where_tag.pro
r134 r150 1 1 ;+ 2 ; NAME: 3 ; WHERE_TAG 4 ; PURPOSE: 5 ; Like WHERE but works on structure tag names 6 ; EXPLANATION: 7 ; Obtain subscripts of elements in structure array for which 8 ; a particular Tag has values in a range or matching specified values. 9 ; Like the WHERE function but for use with structures 10 ; CATEGORY: 11 ; Structures 12 ; CALLING SEQUENCE: 13 ; w = where_tag( struct, [ Nfound, TAG_NAME=, TAG_NUMBER = , RANGE =, 14 ; VALUES =, RANGE =, ISELECT =, /NOPRINT ] 2 ; @file_comments 3 ; Like WHERE but works on structure tag names 4 ; Obtain subscripts of elements in structure array for which 5 ; a particular Tag has values in a range or matching specified values. 6 ; Like the WHERE function but for use with structures 7 ; 8 ; @categories 9 ; Structures 15 10 ; 16 ; INPUTS:17 ; Struct =structure array to search.11 ; @param STRUCT {in}{required} 12 ; structure array to search. 18 13 ; 19 ; INPUT KEYWORDS: 20 ; User *must* specify (1) TAG_NAME or TAG_NUMBER to search, and (2) 21 ; the VALUES or RANGE to search on 14 ; @keyword TAG_NAME 15 ; Scalar string specifying Tag Name 16 ; 17 ; @keyword TAG_NUMBER 18 ; Otherwise give the Tag Number, 19 ; 20 ; @keyword RANGE 21 ; [min,max] range to search for in Struct 22 ; 23 ; @keyword VALUES 24 ; One or array of numbers to match for in Struct, 25 ; 26 ; @keyword ISELECT 27 ; Specifies indices to select only part of structure array, 28 ; (use it to recycle subscripts from previous searches). 29 ; 30 ; @keyword NOPRINT 31 ; Suppress informational messages about nothing found. 22 32 ; 23 ; TAG_NAME = Scalar string specifying Tag Name24 ; TAG_NUMBER = otherwise give the Tag Number,25 ; RANGE = [min,max] range to search for in Struct,26 ; VALUES = one or array of numbers to match for in Struct,27 ; ISELECT= specifies indices to select only part of structure array,28 ; (use it to recycle subscripts from previous searches).29 ; /NOPRINT = suppress informational messages about nothing found.33 ; @returns 34 ; Nfound {out} 35 ; # of occurences found. 36 ; 37 ; @restrictions 38 ; User *must* specify (1) TAG_NAME or TAG_NUMBER to search, and (2) 39 ; the VALUES or RANGE to search on; 30 40 ; 31 ; OUTPUTS: 32 ; Nfound = # of occurences found. 33 ; 34 ; RESULT: 35 ; Function returns subscripts (indices) to desired elements. 36 ; 37 ; EXAMPLES: 41 ; @examples 38 42 ; Suppose STR is a structure with tags CAT_NO:indgen(10), and 39 43 ; NAME:strarr(10). Find the indices where STR.CAT_NO is … … 43 47 ; IDL> print, WHERE_TAG( str, TAG_NUM = 0, RANGE = [3,5]) 44 48 ; 45 ; PROCEDURE: 46 ; Get tag number and apply the WHERE function appropriately. 47 ; 48 ; MODIFICATION HISTORY: 49 ; @history 49 50 ; written 1990 Frank Varosi STX @ NASA/GSFC 50 51 ; Stop printing "Tag <xxx> not found" with /NOPRINT, CD Pike 8-Jun-93 52 ; 53 ; @version 54 ; $Id$ 55 ; 51 56 ;- 52 57 function where_Tag, Struct, Nfound, TAG_NAME=Tag_Name, $ -
trunk/SRC/ToBeReviewed/TRIANGULATION/ciseauxtri.pro
r134 r150 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME: 6 ; 7 ; PURPOSE:vire les tableaux qui ne doivent pas etre dessines grace a 2 8 ; tests: 9 ; 1) les coins du tableau doivent etre ds la fenetre 10 ; 2) les clongeurs des cotes des triangfles exprimes en 11 ; coordonnees normalisesne doivent pas depasser une certaine 12 ; longueur seuil. 13 ; 14 ; CATEGORY: 15 ; 16 ; CALLING SEQUENCE: 17 ; 18 ; INPUTS: 19 ; 20 ; KEYWORD PARAMETERS: 21 ; 22 ; OUTPUTS: 23 ; 24 ; COMMON BLOCKS: 25 ; common.pro 26 ; 27 ; SIDE EFFECTS: 28 ; 29 ; RESTRICTIONS: 30 ; 31 ; EXAMPLE: 32 ; 33 ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr) 5 ; @file_comments 6 ; Delete arrays which do not have to be drawn thanks to 2 tests: 7 ; 1) Corners of the array must be in the window 8 ; 2) Lenghtes of side of triangles expressed in normalized 9 ; coordinates must not surpass a sill lenght. 10 ; 11 ; @categories 12 ; 13 ; @param TRIANG 14 ; 15 ; @param GLAM 16 ; 17 ; @param GPHI 18 ; 19 ; @keyword ALL 20 ; 21 ; @keyword _EXTRA 22 ; Used to pass your keywords. 23 ; 24 ; @uses 25 ; common.pro 26 ; 27 ; @history 28 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 34 29 ; 20/2/99 30 ; 31 ; @version 32 ; $Id$ 33 ; 35 34 ;- 36 35 ;------------------------------------------------------------ 37 36 ;------------------------------------------------------------ 38 37 ;------------------------------------------------------------ 39 FUNCTION ciseauxtri, triang, glam, gphi, TOUT = tout, _EXTRA = ex38 FUNCTION ciseauxtri, triang, glam, gphi, ALL = all, _EXTRA = ex 40 39 ;--------------------------------------------------------- 41 40 ; … … 52 51 OR !map.projection EQ 18) THEN return, triang 53 52 ; 54 tempsun = systime(1) ; pour key_performance53 tempsun = systime(1) ; For key_performance 55 54 ; 56 55 taille = size(glam) … … 58 57 ny = taille[2] 59 58 60 tempdeux = systime(1) ; pour key_performance =259 tempdeux = systime(1) ; For key_performance =2 61 60 z = convert_coord(glam[*],gphi[*],/data,/to_normal) 62 61 x = z[0, *] … … 66 65 print, 'temps ciseauxtri: convert_coord data to_normal', systime(1)-tempdeux 67 66 ; 68 ; attention, suivant la projection certains points x ou y peuvent 69 ; devenir NaN (cf. points deriere la terre ds une projection 70 ; orthographique) il faut dans ce cas enlever tous les triangles qui 71 ; contiennent un de ces points 67 ; Beware, following the projection, some points x or y can become NaN 68 ; (see points behind the Earth in an orthographic projection). 69 ; In this case, we have to remove all triangle which contain one of these points. 72 70 ; 73 71 if (!map.projection LE 7 AND !map.projection NE 0) $ 74 72 OR !map.projection EQ 14 OR !map.projection EQ 15 OR !map.projection EQ 18 then begin 75 tempdeux = systime(1) ; pour key_performance =273 tempdeux = systime(1) ; For key_performance =2 76 74 ; 77 75 test = (x*y)[triang] … … 88 86 seuil = 5 < (min([nx, ny])-2) 89 87 ; 90 ; maintenant on vire les triangles dont un des cotes a une taille 91 ; superieure a 1/seuil du domaine reserve au dessin. 88 ; Now we delete tringles whose one side has a size superior to 1/sill from the domain reserved for the drawing. 92 89 ; 93 90 94 91 if keyword_set(key_periodic) then begin 95 tempdeux = systime(1) ; pour key_performance =292 tempdeux = systime(1) ; For key_performance =2 96 93 ; 97 94 xtri = x[triang] … … 111 108 print, 'temps ciseauxtri: trouver les triangles trop grands', systime(1)-tempdeux 112 109 ; 113 tempdeux = systime(1) ; pour key_performance =2110 tempdeux = systime(1) ; For key_performance =2 114 111 if ind[0] NE -1 then triang = triang[*, temporary(ind)] ELSE return, -1 115 112 trichanged = 1b … … 118 115 endif 119 116 ; 120 ; on supprime les triangles qui sont un peu trop hors du cadre121 ; valable qd /TOUT est active117 ; We delete all triangle which are out of the valid frame when on supprime les triangles qui sont un peu trop hors du cadre 118 ; valable qd ALL is activated 122 119 ; 123 120 if keyword_set(key_irregular) then begin 124 121 125 tempdeux = systime(1) ; pour key_performance =2122 tempdeux = systime(1) ; For key_performance =2 126 123 xtri = x[triang] 127 124 test1 = xtri GE !p.position[0] … … 148 145 ENDIF 149 146 ; 150 ; dernier tri147 ; Last sort. 151 148 ; 152 149 if keyword_set(trichanged) then BEGIN 153 150 ; 154 ; il faut verifier que les triangles que l''on garde ne 155 ; forment pas une triangulation dans laquelle 2 triangles ont un 156 ; sommet en commun sans avoir de cote de commun. 157 ; 158 ; on constitue la liste des rectangles que l''on souhaite garder (on 159 ; garde un rectangle des qu''il y a un triangle dedans) 160 ; 161 ; dans definetri, on a construit les triangles tels que le premier et 162 ; le dernier sommets soient ceux de la diagonale du rectangle definit 163 ; par le maillage. 164 ; pour retouver de quel rectangle provient un triangle, on cherche le 165 ; min de l''indice suivant x et suivant y de chaque triangle. Apres on 166 ; repasse cette indissage suivant x et y en indicage suivant nx*ny 167 ; 168 tempdeux = systime(1) ; pour key_performance =2 169 ; indices en y des rectangles 151 ; We have to check that triangles we keep do not form a triangulation 152 ; in which 2 triangles have a common summit without have a common side. 153 ; 154 ; We constitute the list of rectangles we want to keep (we keep every 155 ; rectangle containing a triangle) 156 ; 157 ; In definetri, we have construct triangles just so the first and the 158 ; last summit are those of the diagonale of the rectangle defined by 159 ; the mesh size. To find from which rectangle a triangle comes, we look 160 ; for the min of the index folowing x and following y of each triangle. 161 ; Then we go by again this indexion following x and y in an indexion 162 ; following nx*ny/ 163 ; 164 tempdeux = systime(1) ; For key_performance =2 165 ; y indexes of rectangles 170 166 indytriang = (triang[0, *]/nx) < (triang[2, *]/nx) 171 ; indices en x desrectangles167 ; x indexes of rectangles 172 168 indxtriang0 = triang[0, *]-nx*(triang[0, *]/nx) 173 169 indxtriang2 = triang[2, *]-nx*(triang[2, *]/nx) 174 170 indxmin = indxtriang0 < indxtriang2 175 ; attention dans le cas ou la grille est periodique et ou on a tous176 ; les points suivant x, les triangles qui assurent la periodicite en x177 ; ont des indices suivant x qui sont 0 et nx-1. Ils appatienent au178 ; rectangles de la colonne nx-1 et non de la colonne 0171 ; Beware in the case where the grid is periodic and where we have all points 172 ; following x, triangles which assure the periodicity in x have indexes 173 ; following x which are 0 and nx-1. They belong to rectangles of the column 174 ; nx-1 and not to column 0. 179 175 if keyword_set(key_periodic) AND nx EQ jpi then BEGIN 180 176 indxmax = indxtriang0 > indxtriang2 … … 185 181 print, 'temps ciseauxtri: liste des rectangles', systime(1)-tempdeux 186 182 ; 187 ; maintenant qu''on a cette liste on va s''assuter que l''on a pas de188 ; triangles qui n''ont qu''on sommet en commun.183 ; Now we have this list, we will make sure that we do not have triangles 184 ; with only a common summit. 189 185 ; 190 186 test = bytarr(nx, ny) … … 192 188 dejavire = 1b-test 193 189 ; 194 tempdeux = systime(1) ; pour key_performance =2190 tempdeux = systime(1) ; For key_performance =2 195 191 vire1 = 0 196 192 vire2 = 0 … … 198 194 vire1 = where( (test*shift(test, -1, -1) $ 199 195 *(1-shift(test, 0, -1))*(1-shift(test, -1, 0))) EQ 1) 200 if vire1[0] NE -1 THEN test[vire1] = 0 ; on vire le rectangle196 if vire1[0] NE -1 THEN test[vire1] = 0 ; We delete the rectangle 201 197 vire2 = where( ((1-test)*(1-shift(test, -1, -1)) $ 202 198 *shift(test, 0, -1)*shift(test, -1, 0)) EQ 1) 203 ; on vire le rectangle du dessus (meme indice x mais egale a1)199 ; We delete the top rectangle (same x index but equal to 1) 204 200 if vire2[0] NE -1 THEN test[vire2+nx] = 0 205 201 ENDWHILE … … 212 208 ; 213 209 if avirer[0] NE -1 then begin 214 tempdeux = systime(1) ; pour key_performance =2210 tempdeux = systime(1) ; For key_performance =2 215 211 indnx = n_elements(listrect) 216 212 indny = n_elements(avirer) -
trunk/SRC/ToBeReviewed/TRIANGULATION/completecointerre.pro
r134 r150 1 ;------------------------------------------------------------2 ;------------------------------------------------------------3 ;------------------------------------------------------------4 ;+5 ; NAME: COMPLETECOINTERRE6 ;7 ; PURPOSE: pour colorier proprement les continents! (c''est une longue8 ; histoire...)9 ;10 ; CATEGORY: pour plt11 ;12 ; CALLING SEQUENCE: completecointerre13 ;14 ; INPUTS: non15 ;16 ; KEYWORD PARAMETERS: _EXTRA17 ;18 ; CONT_COLOR: the color of the continent. defaut value is19 ; (!d.n_colors - 1) < 255 => white20 ;21 ; OUTPUTS: non22 ;23 ; COMMON BLOCKS: common.pro24 ;25 ; SIDE EFFECTS:26 ;27 ; RESTRICTIONS:28 ;29 ; EXAMPLE:30 ;31 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)32 ; 01/10/199933 ;-34 ;------------------------------------------------------------35 ;------------------------------------------------------------36 ;------------------------------------------------------------37 1 PRO draw_corner_triangle, lons, lats, seuil, CONT_COLOR = cont_color, _extra = ex 38 2 ; … … 55 19 ;------------------------------------------------------------ 56 20 ;------------------------------------------------------------ 21 ;------------------------------------------------------------ 22 ;+ 23 ; 24 ; @file_comments 25 ; To color cleanly continents 26 ; 27 ; @categories 28 ; graphic 29 ; 30 ; @keyword _EXTRA 31 ; Used to pass your keywords 32 ; 33 ; @keyword CONT_COLOR 34 ; The color of the continent. defaut value is 35 ; (!d.n_colors - 1) < 255 => white 36 ; 37 ; @uses 38 ; common.pro 39 ; 40 ; @history 41 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 42 ; 01/10/1999 43 ; 44 ; @version 45 ; $Id$ 46 ; 47 ;- 48 ;------------------------------------------------------------ 49 ;------------------------------------------------------------ 50 ;------------------------------------------------------------ 57 51 PRO completecointerre, COINMONTE = coinmonte, COINDESCEND = coindescend $ 58 52 , CONT_COLOR = cont_color, INDICEZOOM = indicezoom $ … … 66 60 ; if NOT keyword_set(coindescend) then return 67 61 ; if NOT keyword_set(indicezoom) then return 68 tempsun = systime(1) ; pour key_performance62 tempsun = systime(1) ; For key_performance 69 63 ;------------------------------------------------------------ 70 ; definitions des vecteurs coinmont etcoindesc64 ; definitions of vectors coinmont and coindesc 71 65 ;------------------------------------------------------------ 72 66 if keyword_set(coinmonte) then coinmont = coinmonte $ … … 76 70 IF NOT keyword_set(cont_color) THEN cont_color = (!d.n_colors-1) < 255 77 71 ;------------------------------------------------------------ 78 ; definition descoordonnees des points numerotes 1,2,3,4,5,6 cf. les 79 ; schemas en dessous! 72 ; definition of coordinates of points numbered 1,2,3,4,5,6 (see figures below) 80 73 ;------------------------------------------------------------ 81 tempdeux = systime(1) ; pour key_performance =274 tempdeux = systime(1) ; For key_performance =2 82 75 if coinmont[0] NE -1 OR coindesc[0] NE -1 then BEGIN 83 76 if keyword_set(indicezoom) then BEGIN … … 122 115 ; 123 116 ; 124 ; cas coin terre en montee: 125 ; 2 points terre en diagonale montante avec 2 points mer sur 126 ; la diagonale descendante. 117 ; Case land corner in ascent: 118 ; 2 land points in diagonal ascending with 2 ocean points on the descendant diagonal. 127 119 ; 128 120 ; 4 … … 139 131 ; 140 132 if coinmont[0] NE -1 then BEGIN 141 tempdeux = systime(1) ; pour key_performance =2133 tempdeux = systime(1) ; For key_performance =2 142 134 for id = 0, n_elements(coinmont)-1 do BEGIN 143 135 i = coinmont[id] … … 159 151 ENDIF 160 152 ;------------------------------------------------------------ 161 ; cas coin terre en descendante.: 162 ; 2 points terre en diagonale descendante avec 2 points mer sur 163 ; la diagonale montante 164 ; 153 ; Case land corner in descent: 154 ; 2 land points in diagonal descending with 2 ocean points on the ascendant diagonal. 155 ; 165 156 ; 4 166 157 ; t(i+nx)=1 u(i+nx) t(i+nx+1)=0 … … 175 166 ; 176 167 if coindesc[0] NE -1 then begin 177 tempdeux = systime(1) ; pour key_performance =2168 tempdeux = systime(1) ; For key_performance =2 178 169 for id = 0, n_elements(coindesc)-1 do BEGIN 179 170 i = coindesc[id] -
trunk/SRC/ToBeReviewed/TRIANGULATION/definetri.pro
r134 r150 1 1 ;+ 2 ; NAME:definetri3 2 ; 4 ; PURPOSE:Define a triangulation array like TRIANGULATE. 3 ; @file_comments 4 ; efine a triangulation array like TRIANGULATE. 5 5 ; But in a VERY SIMPLE CASE: 6 6 ; the points are regulary-gridded on nx*ny array. … … 35 35 ; 36 36 ; 37 ; CATEGORY: to understand how TRIANGULATE and TRIANGULATION work! 37 ; @categories 38 ; utilities 39 ; 40 ; @param NX {in}{required} 41 ; The x dimension array 38 42 ; 39 ; CALLING SEQUENCE:triangles=definetri(nx, ny [,downward]) 40 ; 41 ; INPUTS: nx and ny are the array dimensions 43 ; @param NY {in}{required} 44 ; The y dimension array 42 45 ; 43 ; OPTIONAL INPUTS: 46 ; @param DOWNWARD {in}{optional} 47 ; When downward is undefine all rectangles are cut 48 ; in using the upward diagonal. Downward is a vector which 49 ; contains the rectangles numbers which are cut in using the 50 ; downward diagonal. 51 ; The rectangle number is define by the index (in a nx*ny 52 ; vector) of the lower-left corner of the rectangle. 44 53 ; 45 ; downward: When downward is undefine all rectangles are cut 46 ; in using the upward diagonal. Downward is a vector which 47 ; contains the rectangles numbers which are cut in using the 48 ; downward diagonal. 49 ; The rectangle number is define by the index (in a nx*ny 50 ; vector) of the lower-left corner of the rectangle. 54 ; @returns 55 ; triangles is a 2d array and is dimensions are 3 and 56 ; 2*(nx-1)*(ny-1) 57 ; triangles is define like in the TRIANGULATE procedure. 51 58 ; 52 ; KEYWORD PARAMETERS: 53 ; 54 ; OUTPUTS: 55 ; triangles is a 2d array and is dimensions are 3 and 56 ; 2*(nx-1)*(ny-1) 57 ; triangles is define like in the TRIANGULATE procedure. 58 ; 59 ; 60 ; OPTIONAL OUTPUTS: 61 ; 62 ; COMMON BLOCKS: 63 ; 64 ; SIDE EFFECTS: 65 ; 66 ; RESTRICTIONS: 67 ; 68 ; PROCEDURE: 69 ; 70 ; EXAMPLE: 59 ; @examples 71 60 ; 72 61 ; triangles=definetri(3,3,[1,3]) … … 84 73 ; 85 74 ; 86 ; MODIFICATION HISTORY: sebastien Masson (smlod@ipsl.jussieu.fr) 75 ; @history 76 ; sebastien Masson (smlod@ipsl.jussieu.fr) 87 77 ; 4/3/1999 88 78 ; 79 ; @version 80 ; $Id$ 89 81 ;- 90 82 FUNCTION definetri, nx, ny, downward -
trunk/SRC/ToBeReviewed/TRIANGULATION/definetri_e.pro
r134 r150 13 13 14 14 ;+ 15 ; NAME:definetri16 15 ; 17 ; PURPOSE:Define a triangulation array like TRIANGULATE but for a 16 ; @file_comments 17 ; Define a triangulation array like TRIANGULATE but for a 18 18 ; E-grid type 19 19 ; 20 ; CATEGORY: make contours with E-grid type 20 ; @categories 21 ; Make contours with E-grid type 22 ; 23 ; @param NX {in}{required} 24 ; The x dimension array 21 25 ; 22 ; CALLING SEQUENCE:triangles=definetri(nx, ny [,vertical]) 23 ; 24 ; INPUTS: nx and ny are the array dimensions 26 ; @param NY {in}{required} 27 ; The y dimension array 25 28 ; 26 ; OPTIONAL INPUTS: 29 ; @param SINGULAR {in}{optional} 30 ; When singular is undefined all rectangles are cut 31 ; in using the vertical diagonal. Singular is a vector which 32 ; contains the rectangles numbers which are cut in using the 33 ; horizontal diagonal. 34 ; The rectangle number is define by the index (in a nx*ny 35 ; vector) of the lower-left corner of the rectangle. 27 36 ; 28 ; vertical: When vertical is undefine all rectangles are cut 29 ; in using the horizontal diagonal. Vertical is a vector which 30 ; contains the rectangles numbers which are cut in using the 31 ; vertical diagonal. 32 ; The rectangle number is define by the index (in a nx*ny 33 ; vector) of the lower-left corner of the rectangle. 34 ; 35 ; KEYWORD PARAMETERS: 36 ; 37 ; OUTPUTS: 38 ; triangles is a 2d array and is dimensions are 3 and 39 ; 2*(nx-1)*(ny-1) 40 ; triangles is define like in the TRIANGULATE procedure. 41 ; 42 ; 43 ; OPTIONAL OUTPUTS: 44 ; 45 ; COMMON BLOCKS: 46 ; 47 ; SIDE EFFECTS: 48 ; 49 ; RESTRICTIONS: 50 ; 51 ; PROCEDURE: 52 ; 53 ; EXAMPLE: 37 ; @keyword SHIFTED 54 38 ; 55 39 ; 56 ; MODIFICATION HISTORY: sebastien Masson (smlod@ipsl.jussieu.fr) 40 ; @returns 41 ; Triangles is a 2d array and is dimensions are 3 and 42 ; (nx-1)*(ny-1) 43 ; Triangles is defined like in the TRIANGULATE procedure. 44 ; 45 ; @history 46 ; Sebastien Masson (smlod@ipsl.jussieu.fr) 57 47 ; June 2001 58 48 ; 49 ; @version 50 ; $Id$ 51 ; 52 ; @todo 53 ; seb: documenter SHIFTED 59 54 ;- 60 55 FUNCTION definetri_e, nx, ny, singular, SHIFTED = shifted -
trunk/SRC/ToBeReviewed/TRIANGULATION/dessinetri.pro
r134 r150 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:dessinetri6 5 ; 7 ; PURPOSE:dessine la triangulation 6 ; @file_comments 7 ; Draw the triangulation 8 8 ; 9 ; CATEGORY:pour comprendre comment ca marche 9 ; @categories 10 ; utilities 11 ; 12 ; @param TRI {in}{optional} 13 ; Array which define the triangulation (provided by triangule.pro or triangulate) 14 ; 15 ; @param X {in}{optional} 16 ; The x position of points to which the trangulation refer to 17 ; (see the x array provided in triangulate) 10 18 ; 11 ; CALLING SEQUENCE:dessinetri [, tri, x, y] 12 ; 13 ; INPUTS:optionnels 14 ; par defaut on choisit la triangulation qui est utilise pour 15 ; les plots et on la trace aux points definites par vargrid 19 ; @param Y {in}{optional} 20 ; The y position of points to which the trangulation refer to 21 ; (see the y array provided in triangulate) 16 22 ; 17 ; sinon il faut fournir les tableaux 18 ; tri definissant la triangulation (fournis par triangule.pro 19 ; ou triangulate) 20 ; x et y qui sont les positions de points a laquelle se raporte 21 ; la triangulation (cf. les tableau x et y fournis ds 22 ; triangulate) 23 ; @keyword WAIT 24 ; =x. to call wait x second between each triangle draw. 23 25 ; 24 ; KEYWORD PARAMETERS: 26 ; @keyword ONEBYONE 27 ; To draw the triangles one by one 25 28 ; 26 ; All plots or polyfill keywords. 29 ; @keyword FILL 30 ; To fill the triangles (using polyfill) instead of plotting them 27 31 ; 28 ; WAIT=x. to call wait x second between each triangle draw. 32 ; @keyword CHANGECOLOR 33 ; =n. To change the color of each traingle. n colors 34 ; will be used and repeted if necessary. 29 35 ; 30 ; /ONEBYONE: to draw the triangles one by one 36 ; @uses 37 ; common.pro 31 38 ; 32 ; /FILL: to fill the triangles (using polyfill) instead of plotting them 39 ; @history 40 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 33 41 ; 34 ; CHANGECOLOR=n. to change the color of each traingle. n colors 35 ; will be used and repeted if necessary. 36 ; 37 ; 38 ; OUTPUTS: 39 ; 40 ; COMMON BLOCKS:common.pro 41 ; 42 ; SIDE EFFECTS: 43 ; 44 ; RESTRICTIONS: 45 ; 46 ; EXAMPLE: 47 ; 48 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) 42 ; @version 43 ; $Id$ 49 44 ; 50 45 ;- … … 58 53 ; 59 54 @common 60 tempsun = systime(1) ; pour key_performance55 tempsun = systime(1) ; For key_performance 61 56 a = '' 62 57 if n_params() EQ 3 then BEGIN … … 99 94 color = color#replicate(1, n_elements(tri)/3/n_elements(color)+1) 100 95 ; 101 tempdeux = systime(1) ; pour key_performance =296 tempdeux = systime(1) ; For key_performance =2 102 97 for i = 0L, n_elements(tri)/3-1 do begin 103 98 t = [tri[*, i], tri[0, i]] -
trunk/SRC/ToBeReviewed/TRIANGULATION/drawcoast_c.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param MASK 9 ; 10 ; 11 ; @param XF 12 ; 13 ; 14 ; @param YF 15 ; 16 ; 17 ; @param NX 18 ; 19 ; 20 ; @param NY 21 ; 22 ; 23 ; @keyword COAST_COLOR 24 ; The color of the coastline. 25 ; defaut value is 0 => black 26 ; 27 ; @keyword COAST_THICK 28 ; The thick of the trait to trace continents 29 ; By default, it is 1. 30 ; 31 ; @keyword XSEUIL 32 ; To eliminate segments of coasts which are to big (which link points which can 33 ; be close on the sphere but distant on the drawing). We delete all segments 34 ; whose the size surpass the size of the window following X/XSEUIL. By default, 35 ; XSEUIL=5. But it can be to big if we do a big zoom or a little one for some 36 ; projections... We specify it the keyword thanks to this keyword! 37 ; 38 ; @keyword YSEUIL 39 ; See XSEUIL 40 ; 41 ; @keyword _EXTRA 42 ; Used to pass our keywords 43 ; 44 ; @returns 45 ; 46 ; 47 ; @uses 48 ; 49 ; 50 ; @restrictions 51 ; 52 ; 53 ; @examples 54 ; 55 ; 56 ; @history 57 ; 58 ; 59 ; @version 60 ; 61 ; @todo 62 ; Seb: remplir le header 63 ; 64 ;- 65 ;--------------------------------------------------------- 1 66 PRO drawcoast_c, mask, xf, yf, nx, ny, COAST_COLOR = coast_color, COAST_THICK = coast_thick, YSEUIL = yseuil, XSEUIL = xseuil, _extra = ex 2 ;---------------------------------------------------------3 67 ; 4 68 compile_opt idl2, strictarrsubs … … 10 74 ENDIF 11 75 ;--------------------------------------------------------- 12 tempsun = systime(1) ; pour key_performance76 tempsun = systime(1) ; For key_performance 13 77 ;--------------------------------------------------------- 14 78 ; 15 ; on trace les segments verticaux:79 ; We trace vertical segments: 16 80 ; 17 81 if NOT keyword_set(yseuil) then yseuil = 5. < (min([nx, ny])-2) 18 82 distanceseuil = (!p.position[3]-!p.position[1])/yseuil 19 ; liste: liste des points i pourlesquels on va tracer un segment entre 20 ; le point i,j-1 et i,j 21 tempdeux = systime(1) ; pour key_performance =2 83 ; list: list of points i for which we will trace a segment between the point i,j-1 and i,j 84 tempdeux = systime(1) ; For key_performance =2 22 85 liste = where((mask+shift(mask, -1, 0)) EQ 1 $ 23 86 AND ((xf-shift(xf, 0, 1))^2+(yf-shift(yf, 0, 1))^2) LE distanceseuil^2) 24 87 IF liste[0] NE -1 THEN BEGIN 25 ; on recupere lx et ly qui sont les indices ds un tableau 2d des 26 ; points donnes par liste 88 ; We recuperate lx an dly which are indexes in a 2d array of points given by list 27 89 ly = liste/nx & lx = temporary(liste)-nx*ly 28 indice = where(ly NE 0) ; on ne prend pas les points concernant90 indice = where(ly NE 0) ; We do not take points concerning 29 91 if indice[0] NE -1 then begin 30 ; la premiere ligne car ds ce cas le pt j-1 n''est pas definit92 ; the first line because in this case, the point j-1 is undefined. 31 93 lx = lx[indice] & ly = ly[temporary(indice)] 32 ; boucle sur les points concernes et trace du segment33 ; rq: on utilise plost au lieu de plot car plots est bcp plus rapide.94 ; Loop on concerned points and drawing of the segment. 95 ; Comment: we use plots instead of plot because plots goes faster. 34 96 IF testvar(var = key_performance) EQ 2 THEN $ 35 97 print, 'temps tracecote: determiner liste des points concernes par un trait vertical', systime(1)-tempdeux 36 tempdeux = systime(1) ; pour key_performance =298 tempdeux = systime(1) ; For key_performance =2 37 99 for pt = 0L, n_elements(lx)-1 do BEGIN 38 100 i = lx[pt] & j = ly[pt] … … 45 107 ENDIF 46 108 ; 47 ; pour le trace des segments horizontaux, c''est la meme chose sauf 48 ; qu'il faut faire attention si on est periodique: 109 ; For the drawing of horizontal segments , it is the same thing but we have to be careful if it is periodic. 49 110 ; 50 ; si on est periodique on duplique la premiere colonne et on la met a 51 ; la fin. (ceci est fait non pas pour le shift qui est par defaut 52 ; periodique mais pour le plots 53 tempdeux = systime(1) ; pour key_performance =2 111 ; If it is periodic, we duplicate the first column and we put it at the end. 112 ; (This is made not for the shift which is periodic by default but for the plots) 113 tempdeux = systime(1) ; For key_performance =2 54 114 if keyword_set(key_periodic) AND nx EQ jpi then begin 55 115 mask = [mask, mask[0, *]] … … 66 126 indice = where(ly NE ny-1 AND lx NE 0) 67 127 if indice[0] NE -1 then begin 68 ; on ne prend pas les points de la 69 ; premiere colonne et de la derniere ligne (car on l''a rajoute artificiellement!)) 128 ; We do not take points of the first column and of the last line (because we added artificially) 70 129 lx = lx[indice] & ly = ly[temporary(indice)] 71 130 IF testvar(var = key_performance) EQ 2 THEN $ 72 131 print, 'temps tracecote: determiner liste des points concernes par un trait horizontal', systime(1)-tempdeux 73 tempdeux = systime(1) ; pour key_performance =2132 tempdeux = systime(1) ; For key_performance =2 74 133 for pt = 0L, n_elements(lx)-1 do BEGIN 75 134 i = lx[pt] & j = ly[pt] -
trunk/SRC/ToBeReviewed/TRIANGULATION/drawcoast_e.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param MASK 9 ; 10 ; 11 ; @param XF 12 ; 13 ; 14 ; @param YF 15 ; 16 ; 17 ; @param NX 18 ; 19 ; 20 ; @param NY 21 ; 22 ; 23 ; @keyword COAST_COLOR 24 ; The color of the coastline. 25 ; defaut value is 0 => black 26 ; 27 ; @keyword COAST_THICK 28 ; The thick of the trait to trace continents 29 ; By default, it is 1. 30 ; 31 ; @keyword XSEUIL 32 ; To eliminate segments of coasts which are to big (which link points which can 33 ; be close on the sphere but distant on the drawing). We delete all segments 34 ; whose the size surpass the size of the window following X/XSEUIL. By default, 35 ; XSEUIL=5. But it can be to big if we do a big zoom or a little one for some 36 ; projections... We specify it the keyword thanks to this keyword! 37 ; 38 ; @keyword YSEUIL 39 ; See XSEUIL 40 ; 41 ; @keyword _EXTRA 42 ; Used to pass our keywords 43 ; 44 ; @returns 45 ; 46 ; 47 ; @uses 48 ; 49 ; 50 ; @restrictions 51 ; 52 ; 53 ; @examples 54 ; 55 ; 56 ; @history 57 ; 58 ; 59 ; @version 60 ; 61 ; @todo 62 ; Seb: remplir le header 63 ; 64 ;- 65 1 66 PRO drawcoast_e, mask, xf, yf, nx, ny, COAST_COLOR = coast_color, COAST_THICK = coast_thick, YSEUIL = yseuil, XSEUIL = xseuil, onemore = onemore, _extra = ex 2 67 ;--------------------------------------------------------- -
trunk/SRC/ToBeReviewed/TRIANGULATION/drawsectionbottom.pro
r134 r150 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:drawsectionbottom6 5 ; 7 ; PURPOSE:fill and draw the bottom continents for a real section. 6 ; @file_comments 7 ; Fill and draw the bottom continents for a real section. 8 8 ; 9 ; CATEGORY: 9 ; @categories 10 ; 11 ; @param MASKIN {in}{requierd} 10 12 ; 11 ; CALLING SEQUENCE: 12 ; 13 ; INPUTS: 13 ; @param XXAXISIN {in}{requierd} 14 14 ; 15 ; KEYWORD PARAMETERS:15 ; @param DEPTHSIN {in}{requierd} 16 16 ; 17 ; COAST_COLOR: the color of the coastline. 18 ; defaut value is 0 => black 17 ; @keyword COAST_COLOR 18 ; The color of the coastline. 19 ; defaut value is 0 => black 19 20 ; 20 ; COAST_THICK: the thickness of the coastline. 21 ; defaut value is 1 21 ; @keyword COAST_THICK 22 ; The thickness of the coastline. 23 ; defaut value is 1 22 24 ; 23 ; CONT_COLOR: the color of the continent. defaut value is 24 ; (!d.n_colors - 1) < 255 => white 25 ; @keyword CONT_COLOR 26 ; The color of the continent. defaut value is 27 ; (!d.n_colors - 1) < 255 => white 25 28 ; 26 ; OUTPUTS: 29 ; @uses 30 ; common.pro 27 31 ; 28 ; COMMON BLOCKS:common.pro 29 ; 30 ; SIDE EFFECTS: 31 ; 32 ; RESTRICTIONS:simple way to fill continents for a section (using the 32 ; @restrictions 33 ; Simple way to fill continents for a section (using the 33 34 ; fact that continents are wider at the bottom than at the top). 34 35 ; 35 ; EXAMPLE: 36 ; @history 37 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 38 ; June 14, 2002 36 39 ; 37 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) 38 ; June 14, 2002 40 ; @version 41 ; $Id$ 42 ; 43 ; @todo 44 ; Seb: definir params 39 45 ;- 40 46 ;------------------------------------------------------------ -
trunk/SRC/ToBeReviewed/TRIANGULATION/fillcornermask.pro
r134 r150 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME: FILLCORNERMASK6 5 ; 7 ; PURPOSE: pour colorier proprement les continents! (c''est une longue8 ; histoire...)6 ; @file_comments 7 ; To color cleanly continents 9 8 ; 10 ; CATEGORY: pour plt 9 ; @categories 10 ; graphic 11 11 ; 12 ; CALLING SEQUENCE: completecointerre 13 ; 14 ; INPUTS: non 12 ; @keyword _EXTRA 13 ; Used to pass your keywords 15 14 ; 16 ; KEYWORD PARAMETERS: _EXTRA 15 ; @keyword CONT_COLOR 16 ; The color of the continent. defaut value is 17 ; (!d.n_colors - 1) < 255 => white 17 18 ; 18 ; CONT_COLOR: the color of the continent. defaut value is19 ; (!d.n_colors - 1) < 255 => white19 ; @uses 20 ; common.pro 20 21 ; 21 ; OUTPUTS: non 22 ; @history 23 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 24 ; 8/8/2002 22 25 ; 23 ; COMMON BLOCKS: common.pro 26 ; @version 27 ; $Id$ 24 28 ; 25 ; SIDE EFFECTS:26 ;27 ; RESTRICTIONS:28 ;29 ; EXAMPLE:30 ;31 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)32 ; 8/8/200233 29 ;- 34 30 ;------------------------------------------------------------ … … 45 41 if NOT keyword_set(coinmonte) AND NOT keyword_set(coindescend) then return 46 42 ; 47 tempsun = systime(1) ; pour key_performance43 tempsun = systime(1) ; For key_performance 48 44 ; 49 45 IF NOT keyword_set(cont_color) THEN cont_color = (!d.n_colors-1) < 255 50 46 ;------------------------------------------------------------ 51 ; definition descoordonnees des points numerotes 1,2,3,4,5,6 cf. les 52 ; schemas en dessous! 47 ; definition of coordinates of points numbered 1,2,3,4,5,6 (see figures below) 53 48 ;------------------------------------------------------------ 54 49 ; … … 64 59 ; 65 60 ; 66 ; cas coin terre en montee: 67 ; 2 points terre en diagonale montante avec 2 points mer sur 68 ; la diagonale descendante. 61 ; Case land corner in ascent: 62 ; 2 land points in diagonal ascending with 2 ocean points on the descendant diagonal. 69 63 ; 70 64 ; 3 … … 96 90 endif 97 91 ;------------------------------------------------------------ 98 ; cas coin terre en descendante.: 99 ; 2 points terre en diagonale descendante avec 2 points mer sur 100 ; la diagonale montante 92 ; Case land corner in descent: 93 ; 2 land points in diagonal descending with 2 ocean points on the ascendant diagonal. 101 94 ; 102 95 ; 4 -
trunk/SRC/ToBeReviewed/TRIANGULATION/section.pro
r134 r150 1 ;------------------------------------------------------------2 ;------------------------------------------------------------3 ;------------------------------------------------------------4 1 ;+ 5 ; NAME: 6 ; 7 ; PURPOSE: 8 ; 9 ; CATEGORY: 10 ; 11 ; CALLING SEQUENCE: 12 ; 13 ; INPUTS: 14 ; 15 ; KEYWORD PARAMETERS: 16 ; 17 ; OUTPUTS: 18 ; 19 ; COMMON BLOCKS:common.pro 20 ; 21 ; SIDE EFFECTS: 22 ; 23 ; RESTRICTIONS: 24 ; 25 ; EXAMPLE: 26 ; 27 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) 28 ; 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param FIELD 9 ; 10 ; 11 ; @param RES 12 ; 13 ; 14 ; @param GLAMAXE 15 ; 16 ; 17 ; @param GPHIAXE 18 ; 19 ; 20 ; @keyword ENDPOINTS 21 ; 22 ; 23 ; @keyword BOXZOOM 24 ; 25 ; 26 ; @keyword TYPE 27 ; 28 ; 29 ; @keyword WDEPTH 30 ; 31 ; 32 ; @keyword DIREC 33 ; 34 ; 35 ; @keyword SHOWBUILD 36 ; 37 ; 38 ; @keyword ONLYBOX 39 ; 40 ; 41 ; @keyword _EXTRA 42 ; Used to pass your keywords 43 ; 44 ; @returns 45 ; 46 ; 47 ; @uses 48 ; common.pro 49 ; 50 ; @restrictions 51 ; 52 ; 53 ; @examples 54 ; 55 ; 56 ; @history 57 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 58 ; 59 ; @version 60 ; 29 61 ;- 30 ;------------------------------------------------------------31 ;------------------------------------------------------------32 ;------------------------------------------------------------33 62 34 63 PRO section, field, res, glamaxe, gphiaxe, ENDPOINTS = endpoints $ … … 52 81 ;--------------------- 53 82 ;--------------------- 54 ; definition de boxzoom en fonction de endpoints 55 ; puis redefinition du domaine 83 ; definition of boxzoom in function of endpoints, then redefinition of the domain 56 84 boxzoom2d = [min([endpoints[0], endpoints[2]], max = ma02), ma02 $ 57 85 , min([endpoints[1], endpoints[3]], max = ma13), ma13] … … 83 111 ; how can we find a good test value? 84 112 IF nx * ny LE 10 THEN domdef, GRIDTYPE = grillechoice, _extra = ex 85 ; on redefinit lon1, ... au cas ou findalways ait ete utilise dsdomdef113 ; We redefine lon1, ... in case findalways has been used in domdef 86 114 lon1 = min([endpoints[0], endpoints[2]], max = lon2) 87 115 lat1 = min([endpoints[1], endpoints[3]], max = lat2) … … 89 117 ; until its bottom part. 90 118 if strpos(type, 'z') NE -1 THEN BEGIN 91 ; on garde les yranges (axe z) avant de changer laboxzoom.119 ; We keep yranges (axis z) before changing the boxzoom. 92 120 !y.range = [localbox[nelbox-1], localbox[nelbox-2]] 93 121 if vargrid EQ 'W' OR keyword_set(wdepth) then BEGIN … … 105 133 ENDIF 106 134 !y.range = [localbox[nelbox-1], localbox[nelbox-2]] 107 ; on recupere la grille sur la boxzoom135 ; We recuperate the grid on the boxzoom. 108 136 ; 109 137 IF NOT keyword_set(onlybox) THEN saveboxparam, 'boxparam4section.dat' … … 126 154 127 155 ;--------------------- 128 ; on definit la triangulation qui va nous permetre de determiner la129 ; section. on la recalcule car elle doit etre definie sur la terre130 ; aussi bien que sur la mer. suivant le sens de la section -plutot131 ; longitude ou plutot latitude- on definit la facon de trianguler156 ; We define the triangulation which will allows us to determinate the section. 157 ; We recalculate it because it must be defined on the Earth and on oceans. 158 ; Following the direction of the section -rather longitude or rather latitude- 159 ; we define the way to triangulate. 132 160 if strpos(type, 'x') NE -1 then BEGIN 133 161 downward = (lindgen(nx, ny))[0:nx-2, 0:ny-2] … … 146 174 ENDIF 147 175 ;--------------------- 148 ; equation de la droite suivant laquelle on fait la section176 ; Equation of the line on which we do the section. 149 177 ;--------------------- 150 178 abc = linearequation(endpoints[0:1], endpoints[2:3]) 151 179 glamtri = glam[tri] 152 180 gphitri = gphi[tri] 153 ; quels sont les points de la triangulation qui sont au dessus et au 154 ; dessous de la droite ? 181 ; Which points of the triangulation are above and below the line? 155 182 if abc[1] NE 0 THEN $ 156 183 test = temporary(gphitri) GE (-abc[0]/abc[1]*temporary(glamtri)-abc[2]/abc[1]) $ … … 158 185 159 186 zero123 = total(test, 1) 160 ; to keep: triangles de la triangulation qui sont a cheval sur la droite.187 ; to keep: triangles of the triangulation which are over the line. 161 188 tokeep1 = where(zero123 EQ 1) 162 189 tokeep2 = where(temporary(zero123) EQ 2) … … 165 192 test = test[*, tokeep] 166 193 tri = tri[*, tokeep] 167 ; quel est le sommet du triangle qui est seul d''un cote de la droite?194 ; Which summit of the triangle is alone in a side of the line? 168 195 single1 = where(test[*, 0:n_elements(tokeep1)-1] EQ 1) 169 196 single1 = single1-(single1/3)*3 … … 177 204 178 205 single = [temporary(single1), temporary(single2)] 179 ; points1 le point du triangles qui est seul d''un cote de la droite.180 ; point2 l''autre point du triangle de l''autre cote de la droite206 ; points1 the point (of the triangle) alone in a side of the line. 207 ; point2 the other point of the triangle in the other side of the line. 181 208 point1 = [single, single] 182 209 point2 = [single EQ 0, 1 + (single LE 1)] … … 189 216 points1 = tri[point1, index] 190 217 points2 = tri[point2, temporary(index)] 191 ; points : complex e contenant les couples de points de part et192 ; d''autre de la droite. Ils faut supprimer les doublons.218 ; points : complex containing couples of points in a side and the other 219 ; side of the line. We have to delete duplicates. 193 220 points = dcomplex(points1, points2) 194 221 points = points[uniq(points, sort(points))] 195 222 symetrique = dcomplex(imaginary(points), double(points)) 196 223 points = points[where(points-shift(temporary(symetrique), 1) NE 0)] 197 ; points1 les coordnnees du point du triangles qui est seul d''un cote de la droite.198 ; point2 les coordnnees de l''autre point du triangle de l''autre cote de la droite224 ; points1 coordinates of the point of the triangle which is alone in a side of the line. 225 ; point2 coordinates of the other point of the triangle in the other side of the line. 199 226 points1 = complex(glam[ double(points)], gphi[ double(points)]) 200 227 points2 = complex(glam[imaginary(points)], gphi[imaginary(points)]) 201 ; droites les equations des droites dont on cherche l''intersection 202 ; avec la section. 228 ; droites equations of line whose we look for the intersection wit the section. 203 229 droites = linearequation(points1, points2) 204 230 inter = lineintersection(droites, abc#replicate(1, n_elements(points1) ) ) 205 231 206 ; les ccordonnes geographiques des points que l''on cherche sur lasection.232 ; Geographic coordinates of points we look for on the section. 207 233 glamaxe = float(inter) 208 234 gphiaxe = imaginary(inter) 209 ; on les range ds l''ordre croissant entre les bornes de la section235 ; We arrange them in the growing order between boundaries of the section. 210 236 if strpos(type, 'x') NE -1 then BEGIN 211 237 sort = sort(glamaxe) … … 272 298 poids = poids#replicate(1, nz) 273 299 res = poids*value1+(1-poids)*value2 274 ; moyenne suivantz ?300 ; average following z ? 275 301 if strpos(type, 'z') EQ -1 then begin 276 302 nan = where(finite(res) EQ 0) … … 319 345 poids = reform(poids, npoints, nz, jpt, /over) 320 346 res = poids*value1+(1-poids)*value2 321 ; moyenne suivantz ?347 ; average following z ? 322 348 if strpos(type, 'z') EQ -1 then begin 323 349 nan = where(finite(res) EQ 0) -
trunk/SRC/ToBeReviewed/TRIANGULATION/tracecote.pro
r134 r150 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:tracecote6 5 ; 7 ; PURPOSE: dessine les cotes ds plt 6 ; @file_comments 7 ; Draw coasts in plt. 8 8 ; 9 ; CATEGORY: pour faire un joli dessin 9 ; @categories 10 ; graphic 10 11 ; 11 ; CALLING SEQUENCE:tracecote,mask12 12 ; 13 13 ; INPUTS:mask le tableau mask sur la zone consideree pour le dessin 14 14 ; 15 ; KEYWORD PARAMETERS: 15 ; @keyword SURFACE_COASTLINE 16 ; To draw the surface coast line instead of 17 ; the coast line at level firstz[tw]. Usefull only for deep 18 ; plots! 16 19 ; 17 ; COAST_COLOR: the color of the coastline.18 ; defaut value is 0 => black20 ; @keyword _EXTRA 21 ; used to pass your keywords 19 22 ; 20 ; COAST_THICK: l''epaisseur du trait pour tracer les21 ; continents. par defaut c''est 1.23 ; @uses 24 ; common.pro 22 25 ; 23 ; /SURFACE_COASTLINE: to draw the furface coast line instead of24 ; the coast line at level firstz[tw]. Usefull only for deep25 ; plots!26 ; @history 27 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 28 ; 30/9/1999 26 29 ; 27 ; XSEUIL: pour eliminer les segments de cote qui sont trop 28 ; grand (qui relient des points qui peuvent etre tres proches 29 ; sur la sphere mais tres eloignes sur le dessin) on supprime 30 ; tous les egments dot la taille depasse: 31 ; taille de la fenetre suivant X/ xseuil. 32 ; Par defaut xseuil est egale a 5. masi peut etre trop grand si 33 ; on fait un fort zoom ou trout petit pour certaines 34 ; projections... le specifier alors a l''aide de ce mot cle! 30 ; @version 31 ; $Id$ 35 32 ; 36 ; YSEUIL: cf. xseuil37 ;38 ; OUTPUTS: rien39 ;40 ; COMMON BLOCKS:common.pro41 ;42 ; SIDE EFFECTS:43 ;44 ; RESTRICTIONS:45 ;46 ; EXAMPLE:47 ;48 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)49 ; 30/9/199950 33 ;- 51 34 ;------------------------------------------------------------ … … 64 47 ENDIF 65 48 ;-------------------------------------------------------------- 66 tempsun = systime(1) ; pour key_performance49 tempsun = systime(1) ; For key_performance 67 50 if n_elements(key_gridtype) EQ 0 then key_gridtype = 'c' 68 51 ; 69 ; on agrandi un peu le cadre definit par les premier..., dernier... de 70 ; facon a bien recuperer les bords de cote qui sont en bordure du 71 ; domaine a tracer 52 ; We enlarge a bit the frame defined by firsts..., lasts... in order to 53 ; recuperate edges of the coast which are in the edging of the domain. 72 54 ; 73 tempdeux = systime(1) ; pour key_performance =255 tempdeux = systime(1) ; For key_performance =2 74 56 firstx = 0 > (min([firstxt, firstxf])-1) 75 57 lastx = (max([lastxt, lastxf])+1) < (jpi-1) … … 78 60 nx = lastx-firstx+1 79 61 ny = lasty-firsty+1 80 ; quel niveau vertical choisir?62 ; Which vertical level choose? 81 63 IF keyword_set(surface_coastline) THEN firstz = 0 ELSE $ 82 64 IF strupcase(vargrid) eq 'W' THEN firstz = firstzw ELSE firstz = firstzt 83 ; attribution du masque et des coordonnes delimitant les limites de la 84 ; terre (coordonnees f) 65 ; Attribution of the mask and of coordinates delimiting limits of the land (coordinates f). 85 66 mask = tmask[firstx:lastx, firsty:lasty, firstz] 86 67 xf = glamf[firstx:lastx, firsty:lasty] … … 90 71 ; 91 72 if key_gridtype EQ 'e' then onemore = xf[0, 0] gT xf[0, 1] 92 ; on passe en coordonnee normaliser pour pouvoir s'affranchir du type 93 ; de projection choisie et du suport surlequel on fait le dessin 94 ; (ecran ou postscript) 73 ; We pass in normalized coordinates to be able to become independant from the projection's 74 ; type choosen and from the support on which we do the drawing (screen or postscript) 95 75 z = convert_coord(xf[*],yf[*],/data,/to_normal) 96 76 xf = reform(z[0, *], nx, ny) … … 98 78 tempvar = SIZE(TEMPORARY(z)) 99 79 ; 100 ; attention, suivant la projection certains points x ou y peuvent 101 ; devenir NaN (cf. points deriere la terre ds une projection 102 ; orthographique) 80 ; Beware, following the projection, some points x or y can become NaN (see point 81 ; behind the earth in an orthographic projection). 103 82 ; 104 ; on met les points a eliminer a une tres gande valeur comme ca il ne105 ; passerons pas le test avec distanceseuil (cf. plus bas)83 ; We put points to be eliminated at a very big value so that they will not pass the 84 ; test with distanceseuil (see further). 106 85 ; 107 86 if (!map.projection LE 7 AND !map.projection NE 0) $ … … 117 96 ind = where(yf LT !p.position[1] OR yf GT !p.position[3]) 118 97 IF ind[0] NE -1 THEN yf[ind] = 1e5 119 tempvar = SIZE(TEMPORARY(ind)) ; on efface ind98 tempvar = SIZE(TEMPORARY(ind)) ; we delete ind 120 99 ; 121 100 if n_elements(key_gridtype) EQ 0 then key_gridtype = 'c' -
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] -
trunk/SRC/ToBeReviewed/TRIANGULATION/triangule.pro
r134 r150 1 ;------------------------------------ 2 ;+ 3 ; 4 ; @todo 5 ; seb 6 ; 7 ;- 8 ;------------------------------------ 1 9 FUNCTION triangule, maskentree, BASIC = basic, COINMONTE = coinmonte, COINDESCEND = coindescend, _extra = ex 2 10 ; -
trunk/SRC/ToBeReviewed/TRIANGULATION/triangule_c.pro
r134 r150 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:triangule_c 6 ; 7 ; PURPOSE:construit le tableau de triangulation. 8 ; 9 ; L''idee est de 10 ; construire une liste de triangles qui relient les points entre 11 ; eux. Ceci est fait automatiquement avec la fonction TRIANGULATE. 12 ; ICI: 13 ; on tient compte du fait que les points sont disposes sur une grille 14 ; (reguliere ou pas, mais pas destructuree, cad que les points sont 15 ; ecrits suivant une matrice rectangulaire). Un moyen tres simple de 16 ; faire des triangles entre tous les points est alors: 17 ; 18 ; pour chaque point (i,j) de la matrice -sauf ceux de la derniere 19 ; ligne et de la derniere colonne- on on appelle le rectangle 20 ; (i,j) le rectangle forme par les 4 points (i,j), (i+1,j), 21 ; (i,j+1), (i+1,j+1). Pour tracer tous les triangles, il suffit de 22 ; tracer les 2 triangles contenus ds les rectangles (i,j) 23 ; 24 ; au passage on remarque que chaque rectangle (i,j) possede 2 diagonales (si 25 ; si faites un dessin c''est vrai), il y a donc 2 choix possibles pour 26 ; chaque rectangles qd on veut le couper en 2 triangles... 5 ; 6 ; @file_comments 7 ; Construct the triangulation array. 8 ; 9 ; The idea is: construct a list of triangle which link points between them. 10 ; This is automatically done by the function TRIANGULATE 11 ; Here: 12 ; we consider the fact that points are disposed on a grid (regular or not, 13 ; but not unstructured, that is to say that points are written following a 14 ; rectangular matrix). A easy way to do triangles between all points is then: 15 ; 16 ; for each point (i,j) of the matrix -exept those of the last line and of 17 ; the last column- we call rectangle (i,j) the rectangle made of the four 18 ; points (i,j), (i+1,j), (i,j+1), (i+1,j+1). To trace all triangle, we just 19 ; have to trace the 2 triangles contained in rectangles (i,j) 20 ; 21 ; We notice that each rectangle (i,j) have 2 diagonals (it is true... Make a 22 ; drawing to make sure!!), so there are two possible choice for each rectangle 23 ; we want to cut in 2 triangles... 27 24 ; 28 ; C''est grace a ce choix que l''on va pouvoir tracer les cotes avec 29 ; des angles droits. A chaque angle de cote remarquable par 30 ; l''existance d''un unique point terre ou d''un unique point mer sur 31 ; les 4 cotes d''un rectangle (i,j), il faut couper le rectangle 32 ; suivant la diagonale qui qui passe par le point singulier. 25 ; It is thanks to this choice that we will be able to trace coast with right 26 ; angles. At each angle of coast remarkable by the existence of an unique land 27 ; point or of an unique ocean point on one of the four summit of a rectangle (i,j), 28 ; we have to cut the rectangle following the diagonal passing by this point. 33 29 ; 34 ; CATEGORY:pour faire de beaux graphiques masques 35 ; 36 ; CALLING SEQUENCE:res=triangule([mask]) 37 ; 38 ; INPUTS:optionnel:mask c''est le tableau 2d qui sevira a masquer le 39 ; champ que l''on tracera apres avec CONTOUR, 30 ; @categories 31 ; graphic 32 ; 33 ; @param MASKENTREE {in}{optional} 34 ; It is a 2d array which will serve to mask the field we will trace after with CONTOUR, 40 35 ; ...TRIANGULATION=triangule(mask) 41 ; si cet argument n''est pas specifie, la function utilise tmask. 42 ; 43 ; KEYWORD PARAMETERS: 44 ; 45 ; /BASIC: specifie que le masque est sur une grille basice 46 ; (utiliser pour la triangulation ds les coupes verticales et 47 ; des hovmoellers) 48 ; 49 ; /KEEP_CONT: to keep the triangulation even on the continents 50 ; 51 ; COINMONTE=tableau, pour obtenir le tableau de "coins de terre 52 ; montant" a traiter avec completecointerre.pro ds la variable 53 ; tableau plutot que de la faire passer par la variable globale 54 ; twin_corners_up. 55 ; 56 ; COINDESCEND=tableau cf COINMONTE 57 ; 58 ; OUTPUTS: 59 ; res: tableau 2d (3,nbre de triangles). 60 ; chaque ligne de res represente les indices des points 61 ; constituants les sommets d''un triangle. 62 ; cf. comment on trace les triangles ds dessinetri.pro 63 ; 64 ; COMMON BLOCKS: 65 ; common.pro different.pro definetri.pro 66 ; 67 ; SIDE EFFECTS: 68 ; 69 ; RESTRICTIONS:les donnees dont un veut ensuite faire le contour 70 ; doivent etre disposees dans une matrice. Par contre dans la matrice, 71 ; la disposition des points peut ne pas etre irreguliere. Si les 72 ; donnees sont disposees completement de facon irreguliere, utiliser 73 ; TRIANGULE. 74 ; 75 ; EXAMPLE: 76 ; 77 ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr) 36 ; If this argument is not specified, the function use tmask 37 ; 38 ; @keyword BASIC 39 ; Specify that the mask is on a basic grid (use the triangulation for vertical cuts and hovmoellers) 40 ; 41 ; @keyword KEEP_CONT 42 ; To keep the triangulation even on the continents 43 ; 44 ; @keyword COINMONTE 45 ; It is an array. To obtain the array of "ascending land corner" to be treated with 46 ; completecointerre.pro in the variable array instead of make it pass by the global 47 ; variable twin_corners_up. 48 ; 49 ; @keyword COINDESCEND 50 ; It is an array. See COINMONTE 51 ; 52 ; @returns 53 ; res: tableau 2d (3,nbre de triangles). 54 ; Each line of res represent indexes of points constituing summits of a triangle. 55 ; See how we trace triangles in definetri.pro 56 ; 57 ; @uses 58 ; common.pro 59 ; different.pro 60 ; definetri.pro 61 ; 62 ; @restrictions 63 ; Datas whose we want to do the contour must be disposed in a matrix. 64 ; On the other hand, in the matrix, the points's arrangement can not be 65 ; irregular. If it is, use TRIANGULE. 66 ; 67 ; @history 68 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 78 69 ; 26/4/1999 70 ; 71 ; @version 72 ; $Id$ 73 ; 74 ; @todo 75 ; seb L.267->268 je ne pense pas que ce soit ce que tu voulais dire mais 76 ; c'est la traduction de ce qu'il y avait écrit. Correction si besoin. 79 77 ;- 80 78 ;------------------------------------------------------------ … … 83 81 FUNCTION triangule_c, maskentree, COINMONTE = coinmonte, COINDESCEND = coindescend, BASIC = basic, KEEP_CONT = keep_cont 84 82 ; 85 86 ; 87 tempsun = systime(1) ; pour key_performance83 compile_opt idl2, strictarrsubs 84 ; 85 tempsun = systime(1) ; For key_performance 88 86 ;--------------------------------------------------------- 89 87 @cm_4mesh 90 88 IF NOT keyword_set(key_forgetold) THEN BEGIN 91 89 @updatenew 92 93 ;------------------------------------------------------------ 94 ; le masque est donne ou il faut prendre tmask?95 ;------------------------------------------------------------ 96 ; 97 98 99 100 101 ; 102 103 ;------------------------------------------------------------ 104 105 106 107 108 109 ;------------------------------------------------------------ 110 ; on va trouver la liste des rectangles (i,j) (reperes par leur coin111 ; en bas a gauche) qu''il faut couper suivant une diagonale descendante112 ; on appellera cette liste: pts_downward90 ENDIF 91 ;------------------------------------------------------------ 92 ; Is the mask given or do we have to take tmask? 93 ;------------------------------------------------------------ 94 ; 95 msk = maskentree 96 taille = size(msk) 97 nx = taille[1] 98 ny = taille[2] 99 ; 100 IF n_elements(keep_cont) EQ 0 THEN keep_cont = 1-key_irregular 101 ;------------------------------------------------------------ 102 if keyword_set(key_periodic)*(nx EQ jpi) $ 103 AND NOT keyword_set(basic) then BEGIN 104 msk = [msk, msk[0, *]] 105 nx = nx+1 106 ENDIF 107 ;------------------------------------------------------------ 108 ; We will find the list of rectangles (i,j)(located by their left 109 ; bottom corner) we have to cut folowing a descendant diagonal. 110 ; We will call this list : pts_downward 113 111 ; 114 115 116 ; on construit le test qui permet de trouver un tel triangle:112 pts_downward = 0 113 114 ; We construct the test which allow to find this triangle : 117 115 ; 118 116 ; … … 124 122 ; msk---------------------shift(msk, -1, 0) 125 123 ; 126 sum1 = msk+shift(msk, -1, 0)+shift(msk, -1, -1) ;pts qui entourrent le pt en haut a gauche 127 sum2 = msk+shift(msk, 0, -1)+shift(msk, -1, -1) ;pts qui entourrent le pt en bas a droite 128 129 130 tempdeux = systime(1) ; pour key_performance =2 131 ; pt terre en haut a gauche entoure de pts mer 132 liste = where( (4-sum1)*(1-shift(msk, 0, -1)) EQ 1 ) 133 if liste[0] NE -1 THEN pts_downward = [pts_downward,liste ] 134 ; pt mer en haut a gauche entoure de pts terre 135 liste = where( (1-sum1)*shift(msk, 0, -1) EQ 1) 136 if liste[0] NE -1 THEN pts_downward = [pts_downward,liste ] 137 ; pt terre en bas a droite entoure de pts mer 138 liste = where( (4-sum2)*(1-shift(msk, -1, 0)) EQ 1) 139 if liste[0] NE -1 THEN pts_downward = [pts_downward,liste ] 140 ; pt mer en bas a droite entoure de pts terre 141 liste = where( (1-sum2)*shift(msk, -1, 0) EQ 1) 142 if liste[0] NE -1 THEN pts_downward = [pts_downward,liste ] 143 undefine, liste 144 ; 145 IF testvar(var = key_performance) EQ 2 THEN $ 146 print, 'temps triangule: trouver pts_downward', systime(1)-tempdeux 147 ; 148 if (NOT keyword_set(basic)) OR keyword_set(coinmonte) OR keyword_set(coindescend) then begin 149 tempdeux = systime(1) ; pour key_performance =2 150 ;2 points terre en diagonale montante avec 2 points mer sur la diagonale descendante 151 coinmont = where( (1-msk)*(1-shift(msk, -1, -1)) $ 152 *(shift(msk, 0, -1)*shift(msk, -1, 0) EQ 1) ) 153 if coinmont[0] NE -1 THEN pts_downward = [pts_downward, coinmont] 154 ; 155 IF testvar(var = key_performance) EQ 2 THEN $ 156 print, 'temps triangule: trouver coinmont', systime(1)-tempdeux 157 tempdeux = systime(1) ; pour key_performance =2 158 ; 159 ;2 points terre en diagonale descendante avec 2 points mer sur la diagonale montante 160 coindesc = where( ((1-shift(msk, 0, -1))*(1-shift(msk, -1, 0)) $ 161 *msk*shift(msk, -1, -1) EQ 1) ) 162 ; 163 IF testvar(var = key_performance) EQ 2 THEN $ 164 print, 'temps triangule: trouver coindesc', systime(1)-tempdeux 165 ; 166 ENDIF 167 ; 168 if n_elements(pts_downward) EQ 1 then BEGIN 169 tempdeux = systime(1) ; pour key_performance =2 170 ; 171 triang = definetri(nx, ny) 172 ; 173 IF testvar(var = key_performance) EQ 2 THEN $ 174 print, 'temps triangule: definetri', systime(1)-tempdeux 175 coinmont = -1 176 coindesc = -1 177 ENDIF ELSE BEGIN 178 tempdeux = systime(1) ; pour key_performance =2 179 pts_downward = pts_downward[1:n_elements(pts_downward)-1] 180 pts_downward = pts_downward[uniq(pts_downward, sort(pts_downward))] 181 ; aucun rectangle ne peut avoir comme coin en bas a gauche un element 182 ; de la derniere colonne ou de la derniere ligne. 183 ; il faut donc enlever ces points si ils ont ete selectionnes dans 184 ; pts_downward. 185 derniere_colonne = (lindgen(ny)+1)*nx-1 186 derniere_ligne = lindgen(nx)+(ny-1)*nx 187 pts_downward =different(pts_downward,derniere_colonne ) 188 pts_downward =different(pts_downward,derniere_ligne ) 189 if (NOT keyword_set(basic)) OR keyword_set(coinmonte) OR keyword_set(coindescend) then begin 190 if coinmont[0] NE -1 then begin 124 sum1 = msk+shift(msk, -1, 0)+shift(msk, -1, -1) ;points which surround the left top point. 125 sum2 = msk+shift(msk, 0, -1)+shift(msk, -1, -1) ;points which surround the right bottom point. 126 127 128 tempdeux = systime(1) ; For key_performance =2 129 ; The left top land point surrounded by ocean points 130 liste = where( (4-sum1)*(1-shift(msk, 0, -1)) EQ 1 ) 131 if liste[0] NE -1 THEN pts_downward = [pts_downward,liste ] 132 ; The left top ocean point surrounded by land points 133 liste = where( (1-sum1)*shift(msk, 0, -1) EQ 1) 134 if liste[0] NE -1 THEN pts_downward = [pts_downward,liste ] 135 ; The right bottom land point surrounded by ocean points 136 liste = where( (4-sum2)*(1-shift(msk, -1, 0)) EQ 1) 137 if liste[0] NE -1 THEN pts_downward = [pts_downward,liste ] 138 ; The right bottom ocean point surrounded by land points 139 liste = where( (1-sum2)*shift(msk, -1, 0) EQ 1) 140 if liste[0] NE -1 THEN pts_downward = [pts_downward,liste ] 141 undefine, liste 142 ; 143 IF testvar(var = key_performance) EQ 2 THEN $ 144 print, 'temps triangule: trouver pts_downward', systime(1)-tempdeux 145 ; 146 if (NOT keyword_set(basic)) OR keyword_set(coinmonte) OR keyword_set(coindescend) then begin 147 tempdeux = systime(1) ; For key_performance =2 148 ;2 land points in ascendant diagonal with 2 ocean points in descendant diagonal. 149 coinmont = where( (1-msk)*(1-shift(msk, -1, -1)) $ 150 *(shift(msk, 0, -1)*shift(msk, -1, 0) EQ 1) ) 151 if coinmont[0] NE -1 THEN pts_downward = [pts_downward, coinmont] 152 ; 153 IF testvar(var = key_performance) EQ 2 THEN $ 154 print, 'temps triangule: trouver coinmont', systime(1)-tempdeux 155 tempdeux = systime(1) ; pour key_performance =2 156 ; 157 coindesc = where( ((1-shift(msk, 0, -1))*(1-shift(msk, -1, 0)) $ 158 *msk*shift(msk, -1, -1) EQ 1) ) 159 ; 160 ;2 land points in descendant diagonal with 2 ocean points in ascendant diagonal. 161 IF testvar(var = key_performance) EQ 2 THEN $ 162 print, 'temps triangule: trouver coindesc', systime(1)-tempdeux 163 ; 164 ENDIF 165 ; 166 if n_elements(pts_downward) EQ 1 then BEGIN 167 tempdeux = systime(1) ; For key_performance =2 168 ; 169 triang = definetri(nx, ny) 170 ; 171 IF testvar(var = key_performance) EQ 2 THEN $ 172 print, 'temps triangule: definetri', systime(1)-tempdeux 173 coinmont = -1 174 coindesc = -1 175 ENDIF ELSE BEGIN 176 tempdeux = systime(1) ; For key_performance =2 177 pts_downward = pts_downward[1:n_elements(pts_downward)-1] 178 pts_downward = pts_downward[uniq(pts_downward, sort(pts_downward))] 179 ; None rectangle can have an element of the last column or of the 180 ; last line as left bottom corner. 181 ; so we have to remove these points if they has been selected in pts_downward. 182 derniere_colonne = (lindgen(ny)+1)*nx-1 183 derniere_ligne = lindgen(nx)+(ny-1)*nx 184 pts_downward =different(pts_downward,derniere_colonne ) 185 pts_downward =different(pts_downward,derniere_ligne ) 186 if (NOT keyword_set(basic)) OR keyword_set(coinmonte) OR keyword_set(coindescend) then begin 187 if coinmont[0] NE -1 then begin 191 188 coinmont =different(coinmont,derniere_colonne ) 192 189 coinmont =different(coinmont,derniere_ligne ) 193 194 190 endif 191 if coindesc[0] NE -1 then begin 195 192 coindesc =different(coindesc,derniere_colonne ) 196 193 coindesc =different(coindesc,derniere_ligne ) 197 endif 198 ENDIF ELSE BEGIN 199 coinmont = -1 200 coindesc = -1 201 ENDELSE 202 IF testvar(var = key_performance) EQ 2 THEN $ 203 print, 'temps triangule: menage ds pts_downward coinmont et coindesc', systime(1)-tempdeux 204 ; 205 tempdeux = systime(1) ; pour key_performance =2 206 if pts_downward[0] EQ -1 then triang = definetri(nx, ny) $ 207 ELSE triang = definetri(nx, ny, pts_downward) 208 IF testvar(var = key_performance) EQ 2 THEN $ 209 print, 'temps triangule: definetri', systime(1)-tempdeux 210 ENDELSE 211 ;------------------------------------------------------------ 212 ; on vire les triangles qui ne contiennent que des points terre 213 ;------------------------------------------------------------ 214 ; 215 ; tres bonne idee qui ne marche pas encore a 200% avec IDL 5.2 216 ; ca devrait aller mieux dans les prochaines versions d''IDL... 217 ; 218 if (NOT keyword_set(basic)) AND (NOT keyword_set(keep_cont)) then begin 219 tempdeux = systime(1) ; pour key_performance =2 220 ; on enleve les rectangles qui sont entierement dans la terre 221 recdsterre = where((1-msk)*(1-shift(msk, -1, 0))*(1-shift(msk, 0, -1))*(1-shift(msk, -1, -1)) EQ 1) 222 IF testvar(var = key_performance) EQ 2 THEN $ 223 print, 'temps triangule: tous les recdsterre', systime(1)-tempdeux 224 225 ; en attendant une version qui marche parfaitement, on est contraint 226 ; de faire un nouveau tri: 227 ; il ne faut pas enlever les rectangles qui n''ont qu''un sommet en 228 ; commun. 194 endif 195 ENDIF ELSE BEGIN 196 coinmont = -1 197 coindesc = -1 198 ENDELSE 199 IF testvar(var = key_performance) EQ 2 THEN $ 200 print, 'temps triangule: menage ds pts_downward coinmont et coindesc', systime(1)-tempdeux 201 ; 202 tempdeux = systime(1) ; For key_performance =2 203 if pts_downward[0] EQ -1 then triang = definetri(nx, ny) $ 204 ELSE triang = definetri(nx, ny, pts_downward) 205 IF testvar(var = key_performance) EQ 2 THEN $ 206 print, 'temps triangule: definetri', systime(1)-tempdeux 207 ENDELSE 208 ;------------------------------------------------------------ 209 ; We delete land points which only contain land points. 210 ;------------------------------------------------------------ 211 ; 212 ; 213 if (NOT keyword_set(basic)) AND (NOT keyword_set(keep_cont)) then begin 214 tempdeux = systime(1) ; For key_performance =2 215 ; We delete rectangles which are entirely in the land. 216 recdsterre = where((1-msk)*(1-shift(msk, -1, 0))*(1-shift(msk, 0, -1))*(1-shift(msk, -1, -1)) EQ 1) 217 IF testvar(var = key_performance) EQ 2 THEN $ 218 print, 'temps triangule: tous les recdsterre', systime(1)-tempdeux 219 220 ; We do an other sort : 221 ; We have to do not remove rectangles which only have one common summit. 229 222 ; t1 = systime(1) 230 231 232 233 234 tempdeux = systime(1) ; pour key_performance =2235 236 ;if NOT keyword_set(basic) then begin237 vire1 = 0238 vire2 = 0239 while (vire1[0] NE -1 OR vire2[0] NE -1) ne 0 do begin240 ; vire sont les rectangles qu''il faut retirer de recsterre (en fait241 ; qu''il faut garder bien qu''ils soient entirement dans la terre)242 vire1 = where( (indice*shift(indice, -1, -1) $243 *(1-shift(indice, 0, -1))*(1-shift(indice, -1, 0))*trimask) EQ 1)244 if vire1[0] NE -1 THEN BEGIN245 indice[vire1] = 0223 indice = intarr(nx, ny) 224 trimask = intarr(nx, ny) 225 trimask[0:nx-2, 0:ny-2] = 1 226 IF recdsterre[0] NE -1 then BEGIN 227 tempdeux = systime(1) ; For key_performance =2 228 indice[recdsterre] = 1 229 if NOT keyword_set(basic) then begin 230 vire1 = 0 231 vire2 = 0 232 while (vire1[0] NE -1 OR vire2[0] NE -1) ne 0 do begin 233 ; Delete rectangles we have to remove from recsterre (in fact those we have 234 ; to keep although they ar eentirely in the land). 235 vire1 = where( (indice*shift(indice, -1, -1) $ 236 *(1-shift(indice, 0, -1))*(1-shift(indice, -1, 0))*trimask) EQ 1) 237 if vire1[0] NE -1 THEN BEGIN 238 indice[vire1] = 0 246 239 ; indice[vire1+nx+1] = 0 247 endif248 249 vire2 = where( ((1-indice)*(1-shift(indice, -1, -1)) $250 *shift(indice, 0, -1)*shift(indice, -1, 0)*trimask) EQ 1)251 if vire2[0] NE -1 THEN BEGIN252 indice[vire2+1] = 0240 endif 241 242 vire2 = where( ((1-indice)*(1-shift(indice, -1, -1)) $ 243 *shift(indice, 0, -1)*shift(indice, -1, 0)*trimask) EQ 1) 244 if vire2[0] NE -1 THEN BEGIN 245 indice[vire2+1] = 0 253 246 ; indice[vire2+nx] = 0 254 endif255 endwhile256 IF testvar(var = key_performance) EQ 2 THEN $257 print, 'temps triangule: trier les recdsterre', systime(1)-tempdeux258 ;endif259 indice[*, ny-1] = 1 ; la deriere colonne te la derniere ligne260 indice[nx-1, *] = 1 ; ne peuvent definir derectangle.261 ; 262 tempdeux = systime(1) ; pour key_performance =2263 264 ; on recupere les numeros des triangles que l'' on va garder265 266 267 247 endif 248 endwhile 249 IF testvar(var = key_performance) EQ 2 THEN $ 250 print, 'temps triangule: trier les recdsterre', systime(1)-tempdeux 251 endif 252 indice[*, ny-1] = 1 ; The last column and the last line 253 indice[nx-1, *] = 1 ; can not define any rectangle. 254 ; 255 tempdeux = systime(1) ; For key_performance =2 256 recgarde = where(indice EQ 0) 257 ; We recuperate numbers of triangles we will keep. 258 trigarde = 2*[recgarde-recgarde/nx] 259 trigarde = transpose(temporary(trigarde)) 260 trigarde = [trigarde, trigarde+1] 268 261 ; 269 270 262 triang = triang[*, temporary(trigarde[*])] 263 IF testvar(var = key_performance) EQ 2 THEN $ 271 264 print, 'temps triangule: virer les triangle de la liste', systime(1)-tempdeux 272 273 265 endif 266 endif 274 267 ; print, 'temps tri triangles', systime(1)-t1 275 268 ;------------------------------------------------------------ 276 ; quand key_periodic eq 1, triang est une liste d''indice d'un277 ; tableau qui a une colonne de trop.278 ; il faut ramener ca a la matrice initiale en mettant les indivces de279 ; la derniere colonne egaux a ceux de la derniere colonne...280 ;------------------------------------------------------------ 281 tempdeux = systime(1) ; pour key_performance =2282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 ;------------------------------------------------------------ 314 315 316 ;------------------------------------------------------------ 317 269 ; When key_periodic equal 1, triang is a list of indexes's array which 270 ; have a surplus column. 271 ; We have to put it back to the initial matrix by putting indexes of 272 ; the last column equal to these of the last column... 273 ;------------------------------------------------------------ 274 tempdeux = systime(1) ; For key_performance =2 275 if keyword_set(key_periodic)*(nx-1 EQ jpi) $ 276 AND NOT keyword_set(basic) then BEGIN 277 indicey = triang/nx 278 indicex = triang-indicey*nx 279 nx = nx-1 280 liste = where(indicex EQ nx) 281 if liste[0] NE -1 then indicex[liste] = 0 282 triang = indicex+nx*indicey 283 nx = nx+1 284 if coinmont[0] NE -1 then begin 285 indicey = coinmont/nx 286 indicex = coinmont-indicey*nx 287 nx = nx-1 288 liste = where(indicex EQ nx) 289 if liste[0] NE -1 THEN indicex[liste] = 0 290 coinmont = indicex+nx*indicey 291 nx = nx+1 292 endif 293 if coindesc[0] NE -1 then begin 294 indicey = coindesc/nx 295 indicex = coindesc-indicey*nx 296 nx = nx-1 297 liste = where(indicex EQ nx) 298 if liste[0] NE -1 THEN indicex[liste] = 0 299 coindesc = indicex+nx*indicey 300 nx = nx+1 301 endif 302 endif 303 IF testvar(var = key_performance) EQ 2 THEN $ 304 print, 'temps triangule: finitions', systime(1)-tempdeux 305 306 ;------------------------------------------------------------ 307 if keyword_set(coinmonte) THEN coinmonte = coinmont ELSE twin_corners_up = coinmont 308 if keyword_set(coindescend) THEN coindescend = coindesc ELSE twin_corners_dn = coindesc 309 ;------------------------------------------------------------ 310 IF NOT keyword_set(key_forgetold) THEN BEGIN 318 311 @updateold 319 320 321 322 323 312 ENDIF 313 314 IF keyword_set(key_performance) THEN print, 'temps triangule', systime(1)-tempsun 315 316 return, triang 324 317 325 318 END -
trunk/SRC/ToBeReviewed/TRIANGULATION/triangule_e.pro
r134 r150 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:triangule_e 6 ; 7 ; PURPOSE:buid the triangulation for a E-grid type 8 ; 9 ; CATEGORY: 10 ; 11 ; CALLING SEQUENCE: 12 ; 13 ; INPUTS: 14 ; 15 ; KEYWORD PARAMETERS: 16 ; 17 ; OUTPUTS: 18 ; 19 ; COMMON BLOCKS:common.pro 20 ; 21 ; SIDE EFFECTS: 22 ; 23 ; RESTRICTIONS: 24 ; 25 ; EXAMPLE: 26 ; 27 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) 5 ; @file_comments 6 ; Buid the triangulation for a E-grid type 7 ; 8 ; @categories 9 ; graphic 10 ; 11 ; @param MASKENTREE {in}{optional} 12 ; It is a 2d array which will serve to mask the field we will trace after with CONTOUR, 13 ; ...TRIANGULATION=triangule(mask) 14 ; If this argument is not specified, the function use tmask 15 ; 16 ; @keyword BASIC 17 ; Specify that the mask is on a basic grid (use the triangulation for vertical cuts and hovmoellers) 18 ; 19 ; @keyword COINMONTE 20 ; It is an array. To obtain the array of "ascending land corner" to be treated with 21 ; completecointerre.pro in the variable array instead of make it pass by the global 22 ; variable twin_corners_up. 23 ; 24 ; @keyword COINDESCEND 25 ; It is an array. See COINMONTE 26 ; 27 ; @keyword SHIFTED 28 ; 29 ; @uses 30 ; common.pro 31 ; 32 ; @history 33 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 28 34 ; june 2001 35 ; 36 ; @version 37 ; $Id$ 38 ; 39 ; @todo 40 ; seb L.152->153 je ne pense pas que ce soit ce que tu voulais dire mais 41 ; c'est la traduction de ce qu'il y avait écrit. Correction si besoin. 29 42 ;- 30 43 ;------------------------------------------------------------ … … 42 55 ENDIF 43 56 ;--------------------------------------------------------- 44 tempsun = systime(1) ; pour key_performance45 ;------------------------------------------------------------ 46 ; le masque est donne ou il faut prendre tmask?57 tempsun = systime(1) ; For key_performance 58 ;------------------------------------------------------------ 59 ; Is the mask given or do we have to take tmask? 47 60 ;------------------------------------------------------------ 48 61 ; … … 138 151 ; ; 139 152 ;------------------------------------------------------------ 140 ; quand key_periodic eq 1, triang est une liste d''indice d'un141 ; tableau qui a une colonne de trop.142 ; il faut ramener ca a la matrice initiale en mettant les indivces de143 ; la derniere colonne egaux a ceux de la derniere colonne...144 ;------------------------------------------------------------ 145 tempdeux = systime(1) ; pour key_performance =2153 ; When key_periodic equal 1, triang is a list of indexes's array which 154 ; have a surplus column. 155 ; We have to put it back to the initial matrix by putting indexes of 156 ; the last column equal to these of the last column... 157 ;------------------------------------------------------------ 158 tempdeux = systime(1) ; For key_performance =2 146 159 if keyword_set(key_periodic)*(nx-1 EQ jpi) $ 147 160 AND NOT keyword_set(basic) then BEGIN … … 176 189 177 190 ;------------------------------------------------------------ 178 ;if arg_present(coinmonte) THEN coinmonte = coinmont ELSE twin_corners_up = coinmont179 ;if arg_present(coindescend) THEN coindescend = coindesc ELSE twin_corners_dn = coindesc180 ; 181 ;IF NOT keyword_set(key_forgetold) THEN BEGIN182 ;@updateold183 ;ENDIF191 if arg_present(coinmonte) THEN coinmonte = coinmont ELSE twin_corners_up = coinmont 192 if arg_present(coindescend) THEN coindescend = coindesc ELSE twin_corners_dn = coindesc 193 194 IF NOT keyword_set(key_forgetold) THEN BEGIN 195 @updateold 196 ENDIF 184 197 ;------------------------------------------------------------ 185 198 -
trunk/SRC/ToBeReviewed/UTILITAIRE/get_extra.pro
r134 r150 1 1 ;+ 2 ; @todo seb 2 ; @todo 3 ; seb 3 4 ;- 4 5 ; -
trunk/SRC/ToBeReviewed/UTILITAIRE/oups.pro
r134 r150 7 7 ; mistake, I execute this program and i can redo the only plot missed. 8 8 ; 9 ; @categories utilities 9 ; @categories 10 ; utilities 10 11 ; 11 ; @restrictions compatible with @ps @vzoom text_box... 12 ; @restrictions 13 ; compatible with \@ps \@vzoom text_box... 12 14 ; 13 ; @history Sebastien Masson (smasson@lodyc.jussieu.fr) 15 ; @history 16 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 14 17 ; 15 18 ; 16 ; @version $Id$ 19 ; @version 20 ; $Id$ 17 21 ; 18 ; @todo seb 22 ; @todo 23 ; seb 19 24 ; 20 25 ;- -
trunk/SRC/ToBeReviewed/UTILITAIRE/vzoom.pro
r134 r150 8 8 ; ZOOM prewritten by IDL which just get pixels bigger. 9 9 ; 10 ; @categories utilities 10 ; @categories 11 ; utilities 11 12 ; 12 ; @restrictions use the journal. 13 ; @history Sebastien Masson (smasson@lodyc.jussieu.fr) 13 ; @restrictions 14 ; use the journal. 15 ; 16 ; @history 17 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 14 18 ; 29/4/1999 15 19 ; 16 ; @version $Id$ 20 ; @version 21 ; $Id$ 17 22 ; 18 ; @todo seb 23 ; @todo 24 ; seb 19 25 ; 20 26 ;- -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/buildcmd.pro
r134 r150 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:buildcmd 6 ; 7 ; PURPOSE:cette fonction reourne un string qui contient la commande de 8 ; lecture et les parametres du trace. 9 ; 10 ; CATEGORY: 11 ; 12 ; CALLING SEQUENCE: 13 ; 14 ; INPUTS: 15 ; 16 ; KEYWORD PARAMETERS: 17 ; 18 ; OUTPUTS: 19 ; 20 ; COMMON BLOCKS: 21 ; 22 ; SIDE EFFECTS: 23 ; 24 ; RESTRICTIONS: 25 ; 26 ; EXAMPLE: 27 ; 28 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) 5 ; 6 ; @file_comments 7 ; This function send back a string which contain the reading command 8 ; and drawing's parameters. 9 ; 10 ; @param BASE {in}{required} 11 ; 12 ; @keyword BOXZOOM 13 ; Vector indicating the geographic zone on which we want to cut the map. 14 ; If BOXZOOM has : 15 ; 1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]] 16 ; 2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]] 17 ; 4 elements: The extraction is made on [Boxzoom, 0, max([gdept, gdepw])] 18 ; 5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]] 19 ; 6 elements: The extraction is made on Boxzoom 20 ; Where lon1, lon2,lat1,lat2 are global variables defined at the last domdef! 21 ; 22 ; @keyword FORCETYPE 23 ; 24 ; @history 25 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 26 ; 27 ; @version 28 ; $Id$ 29 ; 30 ; @todo 31 ; seb: documenter le param BASE et le keyword FORCETYPE 29 32 ; 30 33 ;- … … 56 59 ;------------------------------------------------------------ 57 60 ;--------------- 58 ; on determine quelle procedure on va etre appele pour faire le dessin 59 ; et le type 61 ; We determinate which procedure we will call to do the drawing and the type 60 62 ;--------------- 61 63 IF keyword_set(forcetype) THEN type = forcetype $ … … 81 83 endcase 82 84 ; 83 ; recherche desoptions85 ; Search of options 84 86 ; 85 87 options = extractatt(top_uvalue, 'options') … … 94 96 alreadyvector = extractatt(top_uvalue, 'alreadyvector') 95 97 alreadyover = extractatt(top_uvalue, 'alreadyoer') 96 ; que devons-nous lire?98 ; What must we read ? 97 99 case 1 of 98 100 alreadyover NE -1:BEGIN … … 340 342 ;----------------------- 341 343 ;--------------- 342 ; determination du nom de la boxzoom 343 ;--------------- 344 ; determination of the boxzoom's name. 344 345 if NOT keyword_set(boxzoom) then widget_control, domainid, get_value = boxzoom 345 ; ecriture de celle-ci sous forme d''unstring346 ; Writting of this one as a string 346 347 box = '['+strtrim(boxzoom[0], 1) 347 348 for i = 1, (n_elements(boxzoom)-1) < (3+2*(strpos(type, 'z') EQ -1)) do $ 348 349 box = box+', '+strtrim(boxzoom[i], 1) 349 ; pour les [plots en z, box doit avoir par defaut 0,profmax350 ; For [plots in z, box must have by default 0,profmax 350 351 if strpos(type, 'z') NE -1 then BEGIN 351 ; si + de 1 niveau est selectionne:352 ; If more than 1 level is selected: 352 353 widget_control, widget_info(base, find_by_uname = 'dthlv1'), get_value = niv1 353 354 niv1 = niv1.combobox_index … … 372 373 ENDIF 373 374 ;--------------- 374 ; on determine typein375 ; We determinate typein 375 376 ;--------------- 376 377 IF strpos(type, ' diag ') NE -1 THEN typein = ''''+strmid(type, 0, 4)+'''' $ … … 378 379 ;--------------- 379 380 ;--------------- 380 ; determination desmall381 ; determination of small 381 382 ;--------------- 382 383 ssmall = tostr(smallout) 383 384 ;------------------------------------------------------------ 384 ; on va definir le string qui contiendra la commande a executer parwidgetdessine.pro385 ; We will define the string which will contain the command to be executed by widgetdessine.pro 385 386 ;------------------------------------------------------------ 386 387 Cmd = [readCmd, procedure+ ', field $' $ … … 395 396 ; print, '---------------' 396 397 ;--------------- 397 ; on complete et/ou actualise lastructure top_uvalue...398 ; We complete and/or update the structure top_uvalue... 398 399 ;--------------- 399 400 (*top_uvalue[1, findline(top_uvalue, 'nameprocedures')])[numdessinout] = procedure -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/buildreadcmd.pro
r148 r150 1 ;------------------------------------------------------------2 ;------------------------------------------------------------3 ;------------------------------------------------------------4 1 ;+ 5 ; NAME:buildreadcmd 2 ; 3 ; @param BASE {in}{required} 4 ; The id of the widget where apply the drawing. 6 5 ; 7 ; PURPOSE:6 ; @param SNAMEEXP {in}{required} 8 7 ; 9 ; CATEGORY:10 8 ; 11 ; CALLING SEQUENCE: 9 ; @param PROCEDURE {in}{required} 10 ; 11 ; 12 ; @param TYPE {in}{required} 13 ; 12 14 ; 13 ; INPUTS: 15 ; @keyword BOXZOOM 16 ; Vector indicating the geographic zone on which we want to cut the map. 17 ; If BOXZOOM has : 18 ; 1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]] 19 ; 2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]] 20 ; 4 elements: The extraction is made on [Boxzoom, 0, max([gdept, gdepw])] 21 ; 5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]] 22 ; 6 elements: The extraction is made on Boxzoom 23 ; Where lon1, lon2,lat1,lat2 are global variables defined at the last domdef! 14 24 ; 15 ; KEYWORD PARAMETERS:25 ; @keyword COMPLETE 16 26 ; 17 ; OUTPUTS: 27 ; 28 ; @keyword NAMEFIELD 18 29 ; 19 ; COMMON BLOCKS:common.pro20 30 ; 21 ; SIDE EFFECTS: 31 ; @uses 32 ; common.pro 33 ; 34 ; @history 35 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 36 ; 37 ; @version 38 ; $Id$ 22 39 ; 23 ; RESTRICTIONS: 24 ; 25 ; EXAMPLE: 26 ; 27 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) 40 ; @todo 41 ; seb: documenter les param et les keyword qui ne le sont pas. 28 42 ; 29 43 ;- 30 ;------------------------------------------------------------31 ;------------------------------------------------------------32 ;------------------------------------------------------------33 44 FUNCTION buildreadcmd, base, snameexp, procedure, type, BOXZOOM = boxzoom $ 34 45 , COMPLETE = complete, NAMEFIELD = namefield … … 135 146 ;------------------------------------------------------------ 136 147 ;------------------------------------------------------------ 137 ; on va definir le string qui contiendra la commande a executer pour 138 ; la lecture 148 ; We will define the string which will contain the command to be executed for the reading. 139 149 ;------------------------------------------------------------ 140 150 Cmd = ['; Definition of extra structure:', 'extra = '+sextra $ -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/changefield.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param BASE {in}{required} 9 ; The id of the widget where apply the drawing. 10 ; 11 ; @param NEWFIELDNAME 12 ; 13 ; 14 ; @keyword BOXZOOM 15 ; Vector indicating the geographic zone on which we want to cut the map. 16 ; If BOXZOOM has : 17 ; 1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]] 18 ; 2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]] 19 ; 4 elements: The extraction is made on [Boxzoom, 0, max([gdept, gdepw])] 20 ; 5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]] 21 ; 6 elements: The extraction is made on Boxzoom 22 ; Where lon1, lon2,lat1,lat2 are global variables defined at the last domdef! 23 ; 24 ; @returns 25 ; 26 ; 27 ; @uses 28 ; 29 ; 30 ; @restrictions 31 ; 32 ; 33 ; @examples 34 ; 35 ; 36 ; @history 37 ; 38 ; 39 ; @version 40 ; $Id$ 41 ; 42 ; @todo 43 ; seb 44 ; 45 ;- 1 46 PRO changefield, base, newfieldname, BOXZOOM = boxzoom 2 47 ; -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/changefile.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param BASE {in}{required} 9 ; The id of the widget where apply the drawing. 10 ; 11 ; @param NEWFILENAME 12 ; 13 ; 14 ; @keyword BOXZOOM 15 ; Vector indicating the geographic zone on which we want to cut the map. 16 ; If BOXZOOM has : 17 ; 1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]] 18 ; 2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]] 19 ; 4 elements: The extraction is made on [Boxzoom, 0, max([gdept, gdepw])] 20 ; 5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]] 21 ; 6 elements: The extraction is made on Boxzoom 22 ; Where lon1, lon2,lat1,lat2 are global variables defined at the last domdef! 23 ; 24 ; @keyword DATE1 25 ; 26 ; @keyword DATE2 27 ; 28 ; @keyword FIELDNAME 29 ; 30 ; 31 ; @returns 32 ; 33 ; 34 ; @uses 35 ; 36 ; 37 ; @restrictions 38 ; 39 ; 40 ; @examples 41 ; 42 ; 43 ; @history 44 ; 45 ; 46 ; @version 47 ; $Id$ 48 ; 49 ; @todo 50 ; seb 51 ; 52 ;- 1 53 PRO changefile, base, newfilename, BOXZOOM = boxzoom, DATE1 = date1, DATE2 = date2, FIELDNAME = fieldname 2 54 ; -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/createhistory.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param BASE {in}{required} 9 ; The id of the widget where apply the drawing. 10 ; 11 ; @param SMALL 12 ; Vector composed of 3 or 4 elements, applyed to make a drawing on a small 13 ; portion of a page or screen. It delimit the zone where the drawing will 14 ; be done. If there is 4 elements: then is constituated of coordinates (expressed 15 ; in cm located from the up and left corner of the page or the window (in portrait 16 ; like in lanscape)) of the bottom and left corner and of the up and right corner 17 ; of the drawing zone. If there is 3 elements: in this case, we divide the page or 18 ; the screen in small[0] columns and in small[1] lines the drawing made in the box 19 ; numbered small[2]. The numerotation starting up and left by the number 1 and then, 20 ; following the writing direction. By default, we make the largest drawing we can do, 21 ; conserving the aspect rapport (exept when REMPLI is activated). 22 ; 23 ; @returns 24 ; 25 ; 26 ; @uses 27 ; 28 ; 29 ; @restrictions 30 ; 31 ; 32 ; @examples 33 ; 34 ; 35 ; @history 36 ; 37 ; 38 ; @version 39 ; $Id$ 40 ; 41 ; @todo 42 ; seb: je ne suis pas sur pour les param, 43 ; documenter le reste. 44 ; 45 ;- 1 46 PRO createhistory, base, small 2 47 ; -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/cutcmd.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param WIDCMD 9 ; 10 ; 11 ; @param TOREAD 12 ; 13 ; 14 ; @param NUMBEROFREAD 15 ; 16 ; 17 ; @param PREFIX 18 ; 19 ; 20 ; @param NAMEEXP 21 ; 22 ; 23 ; @param ENDING 24 ; 25 ; 26 ; @returns 27 ; 28 ; 29 ; @uses 30 ; 31 ; 32 ; @restrictions 33 ; 34 ; 35 ; @examples 36 ; 37 ; 38 ; @history 39 ; 40 ; 41 ; @version 42 ; $Id$ 43 ; 44 ; @todo 45 ; seb 46 ; 47 ;- 1 48 PRO cutcmd, widcmd, toread, numberofread, prefix, nameexp, ending 2 49 ; -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/definedefaultextra.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param NOMVARIABLE 9 ; 10 ; 11 ; @returns 12 ; 13 ; 14 ; @uses 15 ; 16 ; 17 ; @restrictions 18 ; 19 ; 20 ; @examples 21 ; 22 ; 23 ; @history 24 ; 25 ; 26 ; @version 27 ; $Id$ 28 ; 29 ; @todo 30 ; seb 31 ; 32 ;- 1 33 FUNCTION definedefaultextra, nomvariable 2 34 ; -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/doubleclickaction.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param EVENT 9 ; 10 ; 11 ; @returns 12 ; 13 ; 14 ; @uses 15 ; 16 ; 17 ; @restrictions 18 ; 19 ; 20 ; @examples 21 ; 22 ; 23 ; @history 24 ; 25 ; 26 ; @version 27 ; $Id$ 28 ; 29 ; @todo 30 ; seb 31 ; 32 ;- 1 33 PRO doubleclickaction, event 2 34 ;------------------------------------------------------------ … … 6 38 widget_control, event.id , get_uvalue = uval 7 39 widget_control, event.top, get_uvalue = top_uvalue 8 ; on active la bonne fenetre40 ; We activate the right window 9 41 widget_control, event.id, get_value = win 10 42 wset, win 11 ; quel est le dessin selectionne??43 ; What is the selected drawing? 12 44 smallin = extractatt(top_uvalue, 'smallin') 13 45 smallout = extractatt(top_uvalue, 'smallout') … … 17 49 numligne = n_elements(where(findgen(smallin[1])/smallin[1] lt 1-y))-1 18 50 numdessin = numcolonne+numligne*smallin[0]+1 19 ; choix du type d''action51 ; Choice of the type of action. 20 52 case uval.press of 21 53 1:BEGIN … … 46 78 inserthistory, event.top, ';', '; beginning of '+strtrim(numdessin, 2) $ 47 79 , '; end of '+strtrim(numdessin, 2) 48 ; remise a 0 des attributs de la uvalue concernant ce dessin:80 ; Putting at 0 of attributes of the value concerning the drawing: 49 81 50 82 numdessin = numdessin-1 -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/extractatt.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param TOP_UVALUE 9 ; 10 ; 11 ; @param NAME 12 ; 13 ; 14 ; @returns 15 ; 16 ; 17 ; @uses 18 ; 19 ; 20 ; @restrictions 21 ; 22 ; 23 ; @examples 24 ; 25 ; 26 ; @history 27 ; 28 ; 29 ; @version 30 ; $Id$ 31 ; 32 ; @todo 33 ; seb 34 ; 35 ;- 1 36 FUNCTION extractatt, top_uvalue, name 2 37 ; -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/findline.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param TOP_UVALUE 9 ; 10 ; 11 ; @param NAME 12 ; 13 ; 14 ; @returns 15 ; 16 ; 17 ; @uses 18 ; 19 ; 20 ; @restrictions 21 ; 22 ; 23 ; @examples 24 ; 25 ; 26 ; @history 27 ; 28 ; 29 ; @version 30 ; $Id$ 31 ; 32 ; @todo 33 ; seb 34 ; 35 ;- 1 36 FUNCTION findline, top_uvalue, name 2 37 ; -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/identifyclick.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param EVENT 9 ; 10 ; 11 ; @returns 12 ; 13 ; 14 ; @uses 15 ; 16 ; 17 ; @restrictions 18 ; 19 ; 20 ; @examples 21 ; 22 ; 23 ; @history 24 ; 25 ; 26 ; @version 27 ; $Id$ 28 ; 29 ; @todo 30 ; seb 31 ; 32 ;- 1 33 FUNCTION identifyclick, event 2 34 ; … … 7 39 if thisEvent EQ 'WIDGET_TIMER' then press = 0 ELSE press = event.press 8 40 ; 9 ; d/0/>1 -------->t/1/0--------->**d/2/0** 10 ; -------->d/1/0--------->**t/2/0** click normal41 ; d/0/>1 -------->t/1/0--------->**d/2/0** long click 42 ; -------->d/1/0--------->**t/2/0** normal click 11 43 ; --------->**d/2/>1**-------->d/3/0----->t/0/0 double click 12 44 ; -------->t/3/0----->d/0/0 double click 13 45 type = 'inutile' 14 46 case 1 OF 15 ; d/0/0 1er re monte47 ; d/0/0 1er reascending 16 48 thisEvent EQ 'WIDGET_DRAW' AND uval.click EQ 0 AND press EQ 0: 17 ; d/0/>1 1er appuie de la serie49 ; d/0/>1 1er click of the series 18 50 thisEvent EQ 'WIDGET_DRAW' AND uval.click EQ 0 AND press ge 1:BEGIN 19 51 uval.x = [event.x, 0] … … 23 55 widget_control, event.id, timer = .3 24 56 END 25 ; d/1/0 1er re monte57 ; d/1/0 1er reascending 26 58 thisEvent EQ 'WIDGET_DRAW' AND uval.click EQ 1 AND press EQ 0:uval.click = 2 27 ; d/2/0 finlong click59 ; d/2/0 End of the long click 28 60 thisEvent EQ 'WIDGET_DRAW' AND uval.click EQ 2 AND press EQ 0:BEGIN 29 61 type = 'long' … … 39 71 uval.click = 3 40 72 END 41 ; d/3/0 re monte et fin de double click73 ; d/3/0 reascending and end of the double click 42 74 thisEvent EQ 'WIDGET_DRAW' AND uval.click EQ 3 AND press EQ 0:uval.click = 0 43 ; t/0/0 fin de double click75 ; t/0/0 End of the double click 44 76 thisEvent EQ 'WIDGET_TIMER' AND uval.click EQ 0 AND press EQ 0: 45 77 ; t/1/0 long click 46 78 thisEvent EQ 'WIDGET_TIMER' AND uval.click EQ 1 AND press EQ 0:uval.click = 2 47 ; t/2/0 click normal79 ; t/2/0 normal click 48 80 thisEvent EQ 'WIDGET_TIMER' AND uval.click EQ 2 AND press EQ 0:BEGIN 49 81 type = 'single' … … 51 83 uval.click = 0 52 84 END 53 ; t/3/0 fin de double click85 ; t/3/0 End of the double click 54 86 thisEvent EQ 'WIDGET_TIMER' AND uval.click EQ 3 AND press EQ 0:uval.click = 0 55 ; cas normalement impossible:87 ; Imposible case in theory: 56 88 ELSE:BEGIN 57 89 print, thisEvent, uval.click, press -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/inserthistory.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param BASE 9 ; 10 ; 11 ; @param TEXT 12 ; 13 ; 14 ; @param LINE1 15 ; 16 ; 17 ; @param LINE2 18 ; 19 ; 20 ; @returns 21 ; 22 ; 23 ; @uses 24 ; 25 ; 26 ; @restrictions 27 ; 28 ; 29 ; @examples 30 ; 31 ; 32 ; @history 33 ; 34 ; 35 ; @version 36 ; $Id$ 37 ; 38 ; @todo 39 ; seb 40 ; 41 ;- 42 ;------------------------------------------------------------- 1 43 PRO inserthistory, base, text, line1, line2 2 ;-------------------------------------------------------------3 44 ; 4 45 compile_opt idl2, strictarrsubs -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/letsdraw.pro
r134 r150 1 ;------------------------------------------------------------2 ;------------------------------------------------------------3 ;------------------------------------------------------------4 1 ;+ 5 ; NAME:widgetdessine 2 ; @file_comments 3 ; It si the procedure lauching the drawing. 4 ; If we do not give the command to it, it call 5 ; construitcommande to know what to trace. 6 6 ; 7 ; PURPOSE: c'est la procedure qui lance le dessin. Si on ne le lui 8 ; donne pas de commande, elle appelle construitcommande pour savoir 9 ; quoi tracer. 7 ; @categories 10 8 ; 11 ; CATEGORY: 9 ; 10 ; @param BASE {in}{required} 11 ; The id of the widget where apply the drawing. 12 ; 13 ; @keyword COMMANDE 14 ; A string of the style: read_data('sst'...),... 12 15 ; 13 ; CALLING SEQUENCE:widgetdessine, base 16 ; @keyword _EXTRA 17 ; Used to pass your keywords 14 18 ; 15 ; INPUTS:base: l''id du widget ou appliquer le dessin 16 ; 17 ; KEYWORD PARAMETERS: 18 ; COMMANDE: un string du style: read_data('sst'...),.... 19 ; 20 ; OUTPUTS: 21 ; 22 ; COMMON BLOCKS:common.pro 23 ; 24 ; SIDE EFFECTS: 25 ; 26 ; RESTRICTIONS: 27 ; 28 ; EXAMPLE: 29 ; 30 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) 31 ; 19 ; @uses 20 ; common.pro 21 ; 22 ; @history 23 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 24 ; 25 ; @version 26 ; $Id$ 27 ; 32 28 ;- 33 ;------------------------------------------------------------34 ;------------------------------------------------------------35 ;------------------------------------------------------------36 37 29 PRO letsdraw, base, COMMANDE = commande, _extra = ex 38 30 ; … … 40 32 ; 41 33 @common 42 ; on recupere la uvalue debase34 ; we recuperate the uvalue of base 43 35 ; widget_control,base, get_uvalue = top_uvalue 44 36 ; print, '*****************' … … 61 53 ; 62 54 ; 63 ; on recuperel''id de la fenetre graphique associee au widget d''id base55 ; we recuperate the id of the graphic associated to the widget of id base. 64 56 graphid = extractatt(top_uvalue, 'graphid') 65 57 widget_control, graphid, get_value = win 66 ; on la selectionne (c''est a elle que sera passe toutes les commandes 67 ; concernant une fenetre) 58 ; We select it (we will pass to it all commands concerning the window) 68 59 wset, win 69 ; erase, 255 ; on netoie la fenetre 70 ; on s''assure que si on travaille avec un ecran codant les couleurs 71 ; sur 24 bits la couleur de fond specifiee!p.background est bien 72 ; appliquee 60 ; erase, 255 ; we clean the window 61 ; We make sure that, if we work with a screen coding colors on 24 bits, the specified background color !p.background is the one applied. 73 62 ; if !d.n_colors gt 256 then begin 74 63 ; device, decomposed=1 -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/loadgrid.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param MESHFILEIN 9 ; 10 ; 11 ; @keyword _EXTRA 12 ; Used to pass your keywords 13 ; 14 ; @returns 15 ; 16 ; 17 ; @uses 18 ; 19 ; 20 ; @restrictions 21 ; 22 ; 23 ; @examples 24 ; 25 ; 26 ; @history 27 ; 28 ; 29 ; @version 30 ; $Id$ 31 ; 32 ; @todo 33 ; seb 34 ; 35 ;- 1 36 PRO loadgrid, meshfilein, _extra = ex 2 37 ; -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/longclickaction.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param EVENT 9 ; 10 ; 11 ; @returns 12 ; 13 ; 14 ; @uses 15 ; 16 ; 17 ; @restrictions 18 ; 19 ; 20 ; @examples 21 ; 22 ; 23 ; @history 24 ; 25 ; 26 ; @version 27 ; $Id$ 28 ; 29 ; @todo 30 ; seb 31 ; 32 ;- 1 33 PRO longclickaction, event 2 34 ; … … 5 37 widget_control, event.id, get_uvalue = uval 6 38 widget_control, event.top, get_uvalue = top_uvalue 7 ; quel est le dessin selectionne??39 ; What is the selected drawing? 8 40 smallout = extractatt(top_uvalue, 'smallout') 9 41 smallin = extractatt(top_uvalue, 'smallin') … … 32 64 domainid = widget_info(event.top, find_by_uname = 'domain') 33 65 boxzoom = [x, y] 34 ; faut-il passer la boxzoom en indexes ???66 ; Do we have to pass the boxzoom in indexes ??? 35 67 currentplot = (extractatt(top_uvalue, 'smallin'))[2]-1 36 68 options = extractatt(top_uvalue, 'options') … … 40 72 changey = (flags[where(options EQ 'Latitude / y index')])[0] EQ 1 41 73 if changex OR changey then begin 42 ; on veut retrouver le type de grille qui est utilisee74 ; We want to find the type of grid which is used 43 75 currentfile = extractatt(top_uvalue, 'currentfile') 44 76 listgrid = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listgrid -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/read_vermair.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param NAME 9 ; 10 ; 11 ; @param DEBUT 12 ; 13 ; 14 ; @param FIN 15 ; 16 ; 17 ; @param NOMEXP 18 ; 19 ; 20 ; @keyword PARENT 21 ; same as DIALOG_PARENT de dialog_message.pro 22 ; 23 ; @keyword BOXZOOM 24 ; Vector indicating the geographic zone on which we want to cut the map. 25 ; If BOXZOOM has : 26 ; 1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]] 27 ; 2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]] 28 ; 4 elements: The extraction is made on [Boxzoom, 0, max([gdept, gdepw])] 29 ; 5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]] 30 ; 6 elements: The extraction is made on Boxzoom 31 ; Where lon1, lon2,lat1,lat2 are global variables defined at the last domdef! 32 ; 33 ; @keyword _EXTRA 34 ; Used to pass your keywords 35 ; 36 ; @returns 37 ; 38 ; 39 ; @uses 40 ; 41 ; 42 ; @restrictions 43 ; 44 ; 45 ; @examples 46 ; 47 ; 48 ; @history 49 ; 50 ; 51 ; @version 52 ; $Id$ 53 ; 54 ; @todo 55 ; seb 56 ; 57 ;- 1 58 FUNCTION read_vermair, name, debut, fin, nomexp, PARENT = parent, BOXZOOM=boxzoom, _EXTRA = ex 2 59 ; -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/scanfile.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param NAMEFILE 9 ; 10 ; 11 ; @keyword GRID 12 ; 13 ; 14 ; @keyword _EXTRA 15 ; Used to pass your keywords 16 ; 17 ; @returns 18 ; 19 ; 20 ; @uses 21 ; 22 ; 23 ; @restrictions 24 ; 25 ; 26 ; @examples 27 ; 28 ; 29 ; @history 30 ; 31 ; 32 ; @version 33 ; $Id$ 34 ; 35 ; @todo 36 ; seb : I don't know what to do with that... 37 ; 38 ;- 1 39 ; 2 40 ; liste des presupposes: … … 145 183 time = date0fk + lindgen(jpt) 146 184 ENDIF ELSE BEGIN 147 ; on lit l''axe des temps185 ; we read the time axis 148 186 ncdf_varget, cdfid, varid, time 149 187 time = double(time) … … 180 218 ENDELSE 181 219 ; 182 ; ATTENTION il faut recuperer l''attribut calendar et ajuster time en 183 ; consequense... 184 ; 185 ; 186 ; on passe time en jour julien d''idl 220 ; BEWARE we have to recuperate the calendar attribute and ajust TIME by consequence... 221 ; 222 ; 223 ; We pass TIME in IDL julian days 187 224 ; 188 225 unite = strlowcase(unite) -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/selectfile.pro
r134 r150 144 144 end 145 145 ;********************************************************************* 146 ;+ 147 ; @file_comments 148 ; 149 ; 150 ; @categories 151 ; 152 ; 153 ; @param DATAFILENAME 154 ; 155 ; 156 ; @param IDLFILE 157 ; 158 ; 159 ; @param ARGSPRO 160 ; 161 ; 162 ; @keyword _EXTRA 163 ; Used to pass your keywords 164 ; 165 ; @returns 166 ; 167 ; 168 ; @uses 169 ; 170 ; 171 ; @restrictions 172 ; 173 ; 174 ; @examples 175 ; 176 ; 177 ; @history 178 ; 179 ; 180 ; @version 181 ; $Id$ 182 ; 183 ; @todo 184 ; seb: documenter les params 185 ; 186 ;- 146 187 FUNCTION selectfile, datafilename, idlfile, argspro, _extra = ex 147 188 ; … … 153 194 ;------------------------------------------------------------ 154 195 ; 155 ; pour recuperer les reponses possees lors de l''utilisation de ce156 ; widget on cree un pointeur que l''on place dans la uvalue. Comme ca157 ; une fois que le widget est detruit dans la procedure ...event.pro,158 ; la variable surlaquelle pointait le pointeur (contenue ds la uvalue159 ; d u widget) n''est pas detruite est on peut recuperer le resultat!196 ; We create a pointer in the uvalue to recuperate answers at setted 197 ; questions atthe time of the use of this widget. So when the widget 198 ; is deleted in the procedure ...event.pro, the variable on which the 199 ; pointer pointed (contained in the uvalue of the widget) is not 200 ; deleted and we can recuperate the result! 160 201 ; 161 202 messenger = ptr_new(/allocate_heap) -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/singleclickaction.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param EVENT 9 ; 10 ; 11 ; @returns 12 ; 13 ; 14 ; @uses 15 ; 16 ; 17 ; @restrictions 18 ; 19 ; 20 ; @examples 21 ; 22 ; 23 ; @history 24 ; 25 ; 26 ; @version 27 ; $Id$ 28 ; 29 ; @todo 30 ; seb 31 ; 32 ;- 1 33 PRO singleclickaction, event 2 34 ; … … 14 46 type = widget_info(actionid, /combobox_gettext) 15 47 IF type NE 'plt' THEN return 16 ; on active la bonne fenetre48 ; We activate the right window 17 49 widget_control, event.id, get_value = win 18 50 wset, win 19 ; choi x du type d''action51 ; choice of the type of action 20 52 case uval.press of 21 53 1:BEGIN -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/tracecadre.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param SMALL 9 ; 10 ; 11 ; @keyword OUT 12 ; 13 ; 14 ; @keyword ERASE 15 ; 16 ; 17 ; @keyword FILL 18 ; 19 ; 20 ; @returns 21 ; 22 ; 23 ; @uses 24 ; 25 ; 26 ; @restrictions 27 ; 28 ; 29 ; @examples 30 ; 31 ; 32 ; @history 33 ; 34 ; 35 ; @version 36 ; $Id$ 37 ; 38 ; @todo 39 ; seb 40 ; 41 ;- 1 42 PRO tracecadre, small, out = out, erase = erase, fill = fill 2 43 ;------------------------------------------------------------ 3 ; determination de la colonne et de la ligne correspondant au small en 4 ; entree 44 ; determination of the column and of the line corresponding in input to small 5 45 ; 6 46 compile_opt idl2, strictarrsubs … … 9 49 numligne = numdessin/small[0] 10 50 numcolonne = numdessin-numligne*small[0] 11 ; determination deposcadre51 ; determination of poscadre 12 52 largeurcolonne = 1./small[0] 13 53 largeurligne = 1./small[1] -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/updatewidget.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param BASE {in}{required} 9 ; The id of the widget where apply the drawing. 10 ; 11 ; @keyword NOBOXZOOM 12 ; 13 ; 14 ; @keyword NODATES 15 ; 16 ; 17 ; @keyword NOTYPE 18 ; 19 ; 20 ; @returns 21 ; 22 ; 23 ; @uses 24 ; 25 ; 26 ; @restrictions 27 ; 28 ; 29 ; @examples 30 ; 31 ; 32 ; @history 33 ; 34 ; 35 ; @version 36 ; $Id$ 37 ; 38 ; @todo 39 ; seb 40 ; 41 ;- 1 42 PRO updatewidget, base, NOBOXZOOM = noboxzoom, NODATES = nodates, NOTYPE = notype 2 43 ;---------------------------------------------------------------------- -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/xcreateanim.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param EVENT 9 ; 10 ; 11 ; @returns 12 ; 13 ; 14 ; @uses 15 ; 16 ; 17 ; @restrictions 18 ; 19 ; 20 ; @examples 21 ; 22 ; 23 ; @history 24 ; 25 ; 26 ; @version 27 ; $Id$ 28 ; 29 ; @todo 30 ; seb 31 ; 32 ;- 1 33 pro xcreateanim_event, event 2 34 ; … … 4 36 ; 5 37 @common 6 ; on recupere les aguments contenus ds le widget38 ; We recuperate arguments contained in the widget 7 39 if tag_names(event, /structure_name) NE 'WIDGET_BUTTON' then return 8 40 widget_control, event.id, get_uvalue = uval … … 12 44 return 13 45 ENDIF 14 ; on va ecrire l''animation!46 ; We will write the animation! 15 47 ; 16 48 widget_control, event.top, get_uvalue = local_uvalue … … 36 68 index2 = where(calendar eq date2jul(vdate2)) & index2 = index2[0] 37 69 if index2 EQ -1 OR index2 LE index1 then return 38 ; on detruit le widget avant de creer le fichier.ps70 ; We delete the widget before create the file .ps 39 71 widget_control, event.top, /destroy 40 72 ; 41 ; creation de la routine qui nous serviera pour faire le dessin42 ; 43 ; on recupere la liste des instructions73 ; creation of the routine which will serve us to do the drawing 74 ; 75 ; We recuperate the list of instructions 44 76 globalcommand = extractatt(top_uvalue, 'globalcommand') 45 ; on complete par le premiere et les dernieres lignes du programme77 ; We complete by first and last lines of the program 46 78 createpro, globalcommand, filename = myuniquetmpdir + 'xxx2ps.pro' $ 47 79 , KWDLIST = ', NOERASE = noerase, POSTSCRIPT = postscript, DATE1IN = date1in, DATE2IN = date2in' 48 80 ; 49 ;--------creation du fichier----------50 ; 51 ; recupere le nombre d'octets surlequel on code la palette81 ;--------creation of the file--------- 82 ; 83 ; we recuperate the number of octets on which we code the palette. 52 84 device, get_visual_depth = depth 53 ; taille de l''image (en nombre de pixel:85 ; Picture's size (in number of pixels): 54 86 xsize = !d.x_size 55 87 ysize = !d.y_size 56 88 ; 57 ; on verifie que le nom du fichier termine bien par.gif89 ; We check that the file's name end by .gif 58 90 if strpos(nomfic, '.gif') EQ -1 then nomfic = nomfic+'.gif' 59 91 … … 62 94 63 95 64 ; indication du numero de l''image que l''on est en train de creer96 ; indication of the number of the picture we are creating 65 97 base = widget_base() 66 98 sliderid = widget_slider(base, minimum = 1, maximum = index2-index1+1, value = 1 $ … … 68 100 widget_control, base, /realize 69 101 ; 70 ; commencement du fichier gif. ecriture d''une image vide102 ; Beginning of the gif file. Writting of an empty picture. 71 103 IF keyword_set(fakecal) THEN date = index1 ELSE date = jul2date(calendar[index1]) 72 104 xxx2ps, /noerase, date1in = date, date2in = date … … 91 123 wdelete, !d.window 92 124 ; 93 ; boucle de creation et d''ecriture ds le fichier.125 ; Creation and writting loop in the file. 94 126 ; 95 127 IF index2 GT index1 THEN BEGIN 96 128 FOR ind = index1+1, index2 do BEGIN 97 129 ; 98 widget_control, sliderid, set_value = ind-index1+1 ; on bouge le slider130 widget_control, sliderid, set_value = ind-index1+1 ; We move the slider. 99 131 ; 100 132 window, /free, /pixmap, xsize = xsize, ysize = ysize … … 111 143 ENDFOR 112 144 ENDIF 113 ; on met une derniere image blanche145 ; We put a last white picture 114 146 window, /free, /pixmap, xsize = xsize, ysize = ysize 115 147 reinitplt … … 122 154 write_gif, animdir+nomfic, image, red, green, blue, /multiple 123 155 wdelete, !d.window 124 ; fermeture du fichier156 ; File's closing. 125 157 write_gif, animdir+nomfic, /close 126 158 widget_control, base, /destroy 127 ; rebascule en mode "normal"159 ; Rerock in "normal" mode 128 160 thisOS = strupcase(strmid(!version.os_family, 0, 3)) 129 161 ; 130 162 wset, current_window 131 163 132 ; si on est sous x on essaie de lancerxanim...164 ; If we are under x, we try to lauch xanim... 133 165 134 166 if thisOS NE 'MAC' AND thisOS NE 'WIN' then begin … … 141 173 end 142 174 ;---------------------------------------------------------------- 175 ;+ 176 ; @file_comments 177 ; 178 ; 179 ; @categories 180 ; 181 ; 182 ; @param PARENT 183 ; 184 ; 185 ; @returns 186 ; 187 ; 188 ; @uses 189 ; 190 ; 191 ; @restrictions 192 ; 193 ; 194 ; @examples 195 ; 196 ; 197 ; @history 198 ; 199 ; 200 ; @version 201 ; $Id$ 202 ; 203 ; @todo 204 ; seb 205 ; 206 ;- 143 207 PRO xcreateanim, parent 144 208 ; … … 149 213 widget_control, parent, get_uvalue = top_uvalue 150 214 ; 151 ; on va s''assurer que toutes les procedures de sont paspltt215 ; We will make sure that all procedure are not in pltt 152 216 ; 153 217 procedures = extractatt(top_uvalue, 'nameprocedures') … … 157 221 ENDIF 158 222 ; 159 ; on va s''assurer que toutes les figures ont le meme calendrier223 ; We will make sure that all figure have the same calendar 160 224 ; 161 225 filelist = extractatt(top_uvalue, 'filelist') … … 183 247 endif 184 248 ; 185 ; c''est possible de faire une animation249 ; It is possible to do an animation. 186 250 ; 187 251 base = widget_base(/column, title = 'animation creation', uvalue = {parent:parent, indexfile:indexfile}) -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/xxxmenubar_event.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param EVENT 9 ; 10 ; 11 ; @returns 12 ; 13 ; 14 ; @uses 15 ; 16 ; 17 ; @restrictions 18 ; 19 ; 20 ; @examples 21 ; 22 ; 23 ; @history 24 ; 25 ; 26 ; @version 27 ; $Id$ 28 ; 29 ; @todo 30 ; seb 31 ;- 1 32 ;------------------------------------------------ 2 33 PRO xxxmenubar_event, event … … 15 46 widget_control, event.top, update = 0 16 47 widget_control, event.top, get_uvalue = top_uvalue 17 ; on s''occupe defilelist48 ; We take care of filelist 18 49 filelist = extractatt(top_uvalue, 'filelist') 19 50 filelist = [filelist, newfile.fileparameters.filename] 20 51 currentfile = n_elements(filelist)-1 21 ; on update le widget52 ; We update the widget 22 53 filelistid = widget_info(event.top, find_by_uname = 'filelist') 23 54 widget_control, filelistid, combobox_additem = file_basename(newfile.fileparameters.filename) 24 55 widget_control, filelistid, set_combobox_select = currentfile 25 ; on update les elements filelist et currentfile de la top_uvalue56 ; We update filelist and currentfile's elements of the top_value 26 57 *top_uvalue[1, findline(top_uvalue, 'filelist')] = filelist 27 58 oldfile = *top_uvalue[1, findline(top_uvalue, 'currentfile')] 28 59 *top_uvalue[1, findline(top_uvalue, 'currentfile')] = currentfile 29 ; on s''occupe du nom de lavariable60 ; We take care of the name of the variable 30 61 vlstid = widget_info(event.top, find_by_uname = 'varlist') 31 ; quel etait le champ selectionne ? on le reselectionne?62 ; What is the selected field ? Do we reselect it ? 32 63 fieldname = widget_info(vlstid, /combobox_gettext) 33 64 index = where(newfile.fileparameters.listvar EQ fieldname) 34 65 widget_control, vlstid, set_value = newfile.fileparameters.listvar 35 66 widget_control, vlstid, set_combobox_select = 0 > index[0] 36 ; on s''occupe du calendrier67 ; We take care of the calendar. 37 68 key_caltype = newfile.fileparameters.caltype 38 69 date1id = widget_info(event.top, find_by_uname = 'calendar1') … … 53 84 rien = cw_calendar(basecal, newfile.fileparameters.time_counter, jdate2, uname = 'calendar2' $ 54 85 , FAKECAL = fakecal, uvalue = {name:'calendar2'}, /frame) 55 ; on update les elements fileparameters, readparameters et meshparameters de la top_uvalue86 ; We update fileparameters, readparameters et meshparameters elements of the top_value 56 87 newfileparameters = ptrarr(currentfile+1, /allocate_heap) 57 88 FOR i = 0, currentfile-1 DO $ … … 74 105 ptr_free, extractatt(top_uvalue, 'meshparameters') 75 106 *top_uvalue[1, findline(top_uvalue, 'meshparameters')] = newmeshparameters 76 ; on actualise le widget!107 ; We update the widget! 77 108 if cmpgrid(oldmeshparams) then BEGIN 78 109 domainid = widget_info(event.top, find_by_uname = 'domain') … … 93 124 ptr_free, extractatt(top_uvalue, 'meshparameters') 94 125 ptr_free, top_uvalue 95 widget_control, event.top, /destroy ; on ferme le widget126 widget_control, event.top, /destroy ;We shut the widget 96 127 end 97 128 'PostScript' :BEGIN … … 101 132 ENDIF 102 133 widget_control, event.top, get_uvalue = top_uvalue 103 ; on recupere la liste desinstructions134 ; We recuperate the list of instructions 104 135 globalcommand = extractatt(top_uvalue, 'globalcommand') 105 136 ; for i = 0, n_elements(globalcommand)-1 do print, globalcommand[i] 106 ; on complete par le premiere et les dernieres lignes du programme137 ; We complete by first and last lines of the program. 107 138 createpro, globalcommand, filename = myuniquetmpdir + 'xxx2ps.pro' $ 108 139 , KWDLIST = ', NOERASE = noerase, POSTSCRIPT = postscript' $ … … 136 167 return 137 168 ENDIF 138 ; on recupere le nom du fichier169 ; We recuperate the name of the file 139 170 filename = xquestion('dans quelle procedure IDL voulez vous sauver !C la realisation de ce graph?', 'xxx_figure.pro') 140 ; on le complete par un.pro171 ; We complete it by a .pro 141 172 if rstrpos(filename, '.pro') NE strlen(filename)-4 then filename = filename+'.pro' 142 173 filename = isafile(file = filename, io = homedir, /new) 143 174 widget_control, event.top, get_uvalue = top_uvalue 144 ; portrait o ulandscape ???175 ; portrait or landscape ??? 145 176 options = extractatt(top_uvalue, 'options') 146 177 optionsflag = extractatt(top_uvalue, 'optionsflag') 147 178 portrait = (optionsflag[where(options EQ 'Portrait/Landscape'), 0])[0] 148 ; on lit les commandes pour faire unplot179 ; We read commands to do a plot 149 180 globalcommand = extractatt(top_uvalue, 'globalcommand') 150 ; on complete par le premiere et les dernieres lignes du programme181 ; We complete by first and last lines of the program 151 182 thisOS = strupcase(strmid(!version.os_family, 0, 3)) 152 183 CASE thisOS of … … 163 194 , 'return' $ 164 195 , 'end'] 165 ; on les ecrit dans un programme196 ; We write it in a program 166 197 putfile, filename, globalcommand 167 198 END … … 171 202 return 172 203 ENDIF 173 ; on recupere le nom du fichier204 ; We recuperate the name of the file 174 205 filename = xquestion('dans quel fichier bianire voulez vous sauver le widget ?', 'xxx_widget.dat') 175 ; on le complete par un.dat206 ; We complete it by a .dat 176 207 if rstrpos(filename, '.dat') NE strlen(filename)-4 then filename = filename+'.dat' 177 208 filename = isafile(file = filename, io = homedir, /new) … … 195 226 key_portrait = 1-optionsflag[index, 0] 196 227 (*top_uvalue[1, findline(top_uvalue, 'optionsflag')])[index, *] = key_portrait 197 ; fenetre separee ou fenetre collee au widget?228 ; Separated windows or windows stuck to the widget? 198 229 if widget_info(event.top, find_by_uname = 'graph') EQ 0 then BEGIN 199 ; on tue la fenetre230 ; We delete the window 200 231 graphid = extractatt(top_uvalue, 'graphid') 201 232 widget_control, widget_info(graphid, /parent), /destroy 202 ; on la recree233 ; We recreate it. 203 234 basegraph = widget_base(title = 'xxx window', group_leader = event.top, uvalue = event.top, uname = 'basegraph') 204 235 windsize = givewindowsize() … … 209 240 widget_control, basegraph, /realize 210 241 xmanager, 'xxx', basegraph, /no_block 211 ; on redessine ce qu''il y avait dedans212 ; on recupere la liste desinstructions242 ; We redraw what their were into it 243 ; We recuperate the list of instructions 213 244 globalcommand = extractatt(top_uvalue, 'globalcommand') 214 ; on complete par le premiere et les dernieres lignes du programme245 ; We complete by first and last lines of the program 215 246 createpro, globalcommand, filename = myuniquetmpdir + 'xxx2ps.pro' $ 216 247 , KWDLIST = ', NOERASE = noerase, POSTSCRIPT = postscript, PORTRAIT = portrait, LANDSCAPE = landscape' $ 217 248 , KWDUSED = ', /noerase, PORTRAIT = portrait' 218 ; on reattribue l''element graphid de la top_uvalue249 ; We reattribute the graphic element of the top_value 219 250 *top_uvalue[1, findline(top_uvalue, 'graphid')] = graphid 220 251 ENDIF ELSE BEGIN 221 252 extra = extractatt(top_uvalue, 'extra') 222 253 xxx, CALLERWIDID = event.top, /redraw, _extra = extra 223 widget_control, event.top, /destroy ; on ferme le widget254 widget_control, event.top, /destroy ;We shut the widget 224 255 ENDELSE 225 256 end … … 230 261 flags = extractatt(top_uvalue, 'optionsflag') 231 262 index = where(options EQ 'Overlay') 232 ; on change le flag surLongitude / x index263 ; We change the flag on Longitude / x index 233 264 flag = 1-flags[index, numdessinin] & flag = flag[0] 234 ; on le reeatribue265 ; We reattribute it 235 266 (*top_uvalue[1, findline(top_uvalue, 'optionsflag')])[index, numdessinin] = flag 236 267 end … … 241 272 flags = extractatt(top_uvalue, 'optionsflag') 242 273 index = where(options EQ 'Vecteur') 243 ; on change le flag surLongitude / x index274 ; We change the flag on Longitude / x index 244 275 flag = 1-flags[index, numdessinin] & flag = flag[0] 245 ; on le reeatribue276 ; We reattribute it 246 277 (*top_uvalue[1, findline(top_uvalue, 'optionsflag')])[index, numdessinin] = flag 247 278 end … … 252 283 flags = extractatt(top_uvalue, 'optionsflag') 253 284 index = where(options EQ 'Longitude / x index') 254 ; on change le flag surLongitude / x index285 ; We change the flag on Longitude / x index 255 286 flag = 1-flags[index, numdessinin] & flag = flag[0] 256 ; on le reeatribue287 ; We reattribute it 257 288 (*top_uvalue[1, findline(top_uvalue, 'optionsflag')])[index, numdessinin] = flag 258 ; maintenant on va changer les sliders definissant laboxzoom289 ; Now we will change sliders defining the boxzoom 259 290 domainid = widget_info(event.top, find_by_uname = 'domain') 260 291 boxzoom = (extractatt(top_uvalue, 'domaines'))[*, numdessinin] 261 ; on veut retrouver le type de grille qui est utilisee292 ; We want to find the type of grid which is used 262 293 currentfile = extractatt(top_uvalue, 'currentfile') 263 294 listgrid = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listgrid … … 268 299 vargrid = strupcase(listgrid[indexvar]) 269 300 if flag EQ 0 then BEGIN ; longitudes 270 ; on fait un domdef pour retrouver le lon1 lon2 correspondant a la 271 ; boxzoom definie sur le widget... 301 ; We do a domdef to find the lon1 lon2 corresponding to the boxzoom defined on the widget... 272 302 domdef, boxzoom, gridtype = vargrid, /xindex $ 273 303 , yindex = (flags[where(options EQ 'Latitude / y index'), numdessinin])[0] 274 304 widget_control, domainid, set_value = [lon1, lon2, boxzoom[2:3]] 275 305 ENDIF ELSE BEGIN ; xindex 276 ; maintenant ion veut retrouver firstx, lastx correspondant a la 277 ; boxzoom definie sur le widget... 306 ; now we want to find firstx, lastx corresponding to the boxzoom defined on the widget... 278 307 domdef, boxzoom, gridtype = vargrid $ 279 308 , yindex = (flags[where(options EQ 'Latitude / y index'), numdessinin])[0] … … 281 310 widget_control, domainid, set_value = [firstx, lastx, boxzoom[2:3]] 282 311 ENDELSE 283 ; on met a jour latop_uvalue312 ; We update the top_uvalue 284 313 widget_control, domainid, get_value = boxzoom 285 314 (*top_uvalue[1, findline(top_uvalue, 'domaines')])[*, numdessinin] = boxzoom … … 291 320 flags = extractatt(top_uvalue, 'optionsflag') 292 321 index = where(options EQ 'Latitude / y index') 293 ; on change le flag surLatitude / y index322 ; We change the flag on Latitude / y index 294 323 flag = 1-flags[index, numdessinin] & flag = flag[0] 295 ; on le reeatribue324 ; We reattribute it 296 325 (*top_uvalue[1, findline(top_uvalue, 'optionsflag')])[index, numdessinin] = flag 297 ; maintenant on va changer les sliders definissant laboxzoom326 ; Now we will change sliders defining the boxzoom 298 327 domainid = widget_info(event.top, find_by_uname = 'domain') 299 328 boxzoom = (extractatt(top_uvalue, 'domaines'))[*, numdessinin] 300 ; on veut retrouver le type de grille qui est utilisee329 ; We want to find the type of grid which is used 301 330 currentfile = extractatt(top_uvalue, 'currentfile') 302 331 listgrid = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listgrid … … 307 336 vargrid = strupcase(listgrid[indexvar]) 308 337 if flag EQ 0 then BEGIN ; latitudes 309 ; on fait un domdef pour retrouver le lat1 lat2 correspondant a la 310 ; boxzoom definie sur le widget... 338 ; We do a domdef to find the lat1 lat2 corresponding to the boxzoom defined on the widget... 311 339 domdef, boxzoom, gridtype = vargrid, /yindex $ 312 340 , xindex = (flags[where(options EQ 'Longitude / x index'), numdessinin])[0] 313 341 widget_control, domainid, set_value = [boxzoom[0:1], lat1, lat2] 314 342 ENDIF ELSE BEGIN ; yindex 315 ; maintenant ion veut retrouver firsty, lasty correspondant a la 316 ; boxzoom definie sur le widget... 343 ; now we want to find firsty, lasty corresponding to the boxzoom defined on the widget... 317 344 domdef, boxzoom, gridtype = vargrid $ 318 345 , xindex = (flags[where(options EQ 'Longitude / x index'), numdessinin])[0] … … 320 347 widget_control, domainid, set_value = [boxzoom[0:1], firsty, lasty] 321 348 ENDELSE 322 ; on met a jour latop_uvalue349 ; We update the top_uvalue 323 350 widget_control, domainid, get_value = boxzoom 324 351 (*top_uvalue[1, findline(top_uvalue, 'domaines')])[*, numdessinin] = boxzoom -
trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_bgroup.pro
r134 r150 1 ; $Id$2 ;3 ; Copyright (c) 1992-2005, Research Systems, Inc. All rights reserved.4 ; Unauthorized reproduction prohibited.5 ;+6 ; NAME:7 ; CW_BGROUP8 ;9 ; PURPOSE:10 ; CW_BGROUP is a compound widget that simplifies creating11 ; a base of buttons. It handles the details of creating the12 ; proper base (standard, exclusive, or non-exclusive) and filling13 ; in the desired buttons. Events for the individual buttons are14 ; handled transparently, and a CW_BGROUP event returned. This15 ; event can return any one of the following:16 ; - The Index of the button within the base.17 ; - The widget ID of the button.18 ; - The name of the button.19 ; - An arbitrary value taken from an array of User values.20 ;21 ; CATEGORY:22 ; Compound widgets.23 ;24 ; CALLING SEQUENCE:25 ; Widget = CW_BGROUP(Parent, Names)26 ;27 ; To get or set the value of a CW_BGROUP, use the GET_VALUE and28 ; SET_VALUE keywords to WIDGET_CONTROL. The value of a CW_BGROUP29 ; is:30 ;31 ; -----------------------------------------------32 ; Type Value33 ; -----------------------------------------------34 ; normal None35 ; exclusive Index of currently set button36 ; non-exclusive Vector indicating the position37 ; of each button (1-set, 0-unset)38 ; -----------------------------------------------39 ;40 ;41 ; INPUTS:42 ; Parent: The ID of the parent widget.43 ; Names: A string array, containing one string per button,44 ; giving the name of each button.45 ;46 ; KEYWORD PARAMETERS:47 ;48 ; BUTTON_UVALUE: An array of user values to be associated with49 ; each button and returned in the event structure.50 ; COLUMN: Buttons will be arranged in the number of columns51 ; specified by this keyword.52 ; EVENT_FUNCT: The name of an optional user-supplied event function53 ; for buttons. This function is called with the return54 ; value structure whenever a button is pressed, and55 ; follows the conventions for user-written event56 ; functions.57 ; EXCLUSIVE: Buttons will be placed in an exclusive base, with58 ; only one button allowed to be selected at a time.59 ; FONT: The name of the font to be used for the button60 ; titles. If this keyword is not specified, the default61 ; font is used.62 ; FRAME: Specifies the width of the frame to be drawn around63 ; the base.64 ; IDS: A named variable into which the button IDs will be65 ; stored, as a longword vector.66 ; LABEL_LEFT: Creates a text label to the left of the buttons.67 ; LABEL_TOP: Creates a text label above the buttons.68 ; MAP: If set, the base will be mapped when the widget69 ; is realized (the default).70 ; NONEXCLUSIVE: Buttons will be placed in an non-exclusive base.71 ; The buttons will be independent.72 ; NO_RELEASE: If set, button release events will not be returned.73 ; RETURN_ID: If set, the VALUE field of returned events will be74 ; the widget ID of the button.75 ; RETURN_INDEX: If set, the VALUE field of returned events will be76 ; the zero-based index of the button within the base.77 ; THIS IS THE DEFAULT.78 ; RETURN_NAME: If set, the VALUE field of returned events will be79 ; the name of the button within the base.80 ; ROW: Buttons will be arranged in the number of rows81 ; specified by this keyword.82 ; SCROLL: If set, the base will include scroll bars to allow83 ; viewing a large base through a smaller viewport.84 ; SET_VALUE: The initial value of the buttons. This is equivalent85 ; to the later statement:86 ;87 ; WIDGET_CONTROL, widget, set_value=value88 ;89 ; SPACE: The space, in pixels, to be left around the edges90 ; of a row or column major base. This keyword is91 ; ignored if EXCLUSIVE or NONEXCLUSIVE are specified.92 ; UVALUE: The user value to be associated with the widget.93 ; UNAME: The user name to be associated with the widget.94 ; XOFFSET: The X offset of the widget relative to its parent.95 ; XPAD: The horizontal space, in pixels, between children96 ; of a row or column major base. Ignored if EXCLUSIVE97 ; or NONEXCLUSIVE are specified.98 ; XSIZE: The width of the base.99 ; X_SCROLL_SIZE: The width of the viewport if SCROLL is specified.100 ; YOFFSET: The Y offset of the widget relative to its parent.101 ; YPAD: The vertical space, in pixels, between children of102 ; a row or column major base. Ignored if EXCLUSIVE103 ; or NONEXCLUSIVE are specified.104 ; YSIZE: The height of the base.105 ; Y_SCROLL_SIZE: The height of the viewport if SCROLL is specified.106 ;107 ; OUTPUTS:108 ; The ID of the created widget is returned.109 ;110 ; SIDE EFFECTS:111 ; This widget generates event structures with the following definition:112 ;113 ; event = { ID:0L, TOP:0L, HANDLER:0L, SELECT:0, VALUE:0 }114 ;115 ; The SELECT field is passed through from the button event. VALUE is116 ; either the INDEX, ID, NAME, or BUTTON_UVALUE of the button,117 ; depending on how the widget was created.118 ;119 ; RESTRICTIONS:120 ; Only buttons with textual names are handled by this widget.121 ; Bitmaps are not understood.122 ;123 ; MODIFICATION HISTORY:124 ; 15 June 1992, AB125 ; 7 April 1993, AB, Removed state caching.126 ; 6 Oct. 1994, KDB, Font keyword is not applied to the label.127 ; 10 FEB 1995, DJC fixed bad bug in event procedure, getting128 ; id of stash widget.129 ; 11 April 1995, AB Removed Motif special cases.130 ;-131 132 133 1 pro CW_BGROUP_SETV, id, value 134 2 compile_opt hidden, idl2, strictarrsubs … … 224 92 225 93 94 95 96 ; 97 ;+ 98 ; @file_comments 99 ; CW_BGROUP is a compound widget that simplifies creating 100 ; a base of buttons. It handles the details of creating the 101 ; proper base (standard, exclusive, or non-exclusive) and filling 102 ; in the desired buttons. Events for the individual buttons are 103 ; handled transparently, and a CW_BGROUP event returned. This 104 ; event can return any one of the following: 105 ; - The Index of the button within the base. 106 ; - The widget ID of the button. 107 ; - The name of the button. 108 ; - An arbitrary value taken from an array of User values. 109 ; 110 ; @categories 111 ; Compound widgets. 112 ; 113 ; @param PARENT {in}{required} 114 ; The ID of the parent widget. 115 ; 116 ; @param NAMES 117 ; A string array, containing one string per button, 118 ; giving the name of each button. 119 ; 120 ; @keyword BUTTON_UVALUE 121 ; An array of user values to be associated with 122 ; each button and returned in the event structure. 123 ; 124 ; @keyword COLUMN 125 ; Buttons will be arranged in the number of columns 126 ; specified by this keyword. 127 ; 128 ; @keyword EVENT_FUNCT 129 ; The name of an optional user-supplied event function 130 ; for buttons. This function is called with the return 131 ; value structure whenever a button is pressed, and 132 ; follows the conventions for user-written event functions. 133 ; 134 ; @keyword EXCLUSIVE 135 ; Buttons will be placed in an exclusive base, with 136 ; only one button allowed to be selected at a time. 137 ; 138 ; @keyword FONT 139 ; The name of the font to be used for the button 140 ; titles. If this keyword is not specified, the default 141 ; font is used. 142 ; 143 ; @keyword FRAME 144 ; Specifies the width of the frame to be drawn around the base. 145 ; 146 ; @keyword IDS 147 ; A named variable into which the button IDs will be 148 ; stored, as a longword vector. 149 ; 150 ; @keyword LABEL_LEFT 151 ; Creates a text label to the left of the buttons. 152 ; 153 ; @keyword LABEL_TOP 154 ; Creates a text label above the buttons. 155 ; 156 ; @keyword MAP 157 ; If set, the base will be mapped when the widget 158 ; is realized (the default). 159 ; 160 ; @keyword NONEXCLUSIVE 161 ; Buttons will be placed in an non-exclusive base. 162 ; The buttons will be independent. 163 ; 164 ; @keyword NO_RELEASE 165 ; If set, button release events will not be returned. 166 ; 167 ; @keyword RETURN_ID 168 ; If set, the VALUE field of returned events will be 169 ; the widget ID of the button. 170 ; 171 ; @keyword RETURN_INDEX 172 ; If set, the VALUE field of returned events will be 173 ; the zero-based index of the button within the base. 174 ; THIS IS THE DEFAULT. 175 ; 176 ; @keyword RETURN_NAME 177 ; If set, the VALUE field of returned events will be 178 ; the name of the button within the base. 179 ; 180 ; @keyword ROW 181 ; Buttons will be arranged in the number of rows 182 ; specified by this keyword. 183 ; 184 ; @keyword SCROLL 185 ; If set, the base will include scroll bars to allow 186 ; viewing a large base through a smaller viewport. 187 ; 188 ; @keyword SET_VALUE 189 ; The initial value of the buttons. This is equivalent 190 ; to the later statement: 191 ; 192 ; WIDGET_CONTROL, widget, set_value=value 193 ; 194 ; @keyword SPACE 195 ; The space, in pixels, to be left around the edges 196 ; of a row or column major base. This keyword is 197 ; ignored if EXCLUSIVE or NONEXCLUSIVE are specified. 198 ; 199 ; @keyword UVALUE 200 ; The user value to be associated with the widget. 201 ; 202 ; @keyword UNAME 203 ; The user name to be associated with the widget. 204 ; 205 ; @keyword XOFFSET 206 ; The X offset of the widget relative to its parent. 207 ; 208 ; @keyword XPAD 209 ; The horizontal space, in pixels, between children 210 ; of a row or column major base. Ignored if EXCLUSIVE 211 ; or NONEXCLUSIVE are specified. 212 ; 213 ; @keyword XSIZE 214 ; The width of the base. 215 ; @keyword X_SCROLL_SIZE 216 ; The width of the viewport if SCROLL is specified. 217 ; 218 ; @keyword YOFFSET 219 ; The Y offset of the widget relative to its parent. 220 ; 221 ; @keyword YPAD 222 ; The vertical space, in pixels, between children of 223 ; a row or column major base. Ignored if EXCLUSIVE 224 ; or NONEXCLUSIVE are specified. 225 ; 226 ; @keyword YSIZE 227 ; The height of the base. 228 ; 229 ; @keyword Y_SCROLL_SIZE 230 ; The height of the viewport if SCROLL is specified. 231 ; 232 ; @returns 233 ; The ID of the created widget is returned. 234 ; 235 ; @restrictions 236 ; This widget generates event structures with the following definition: 237 ; 238 ; event = { ID:0L, TOP:0L, HANDLER:0L, SELECT:0, VALUE:0 } 239 ; 240 ; The SELECT field is passed through from the button event. VALUE is 241 ; either the INDEX, ID, NAME, or BUTTON_UVALUE of the button, 242 ; depending on how the widget was created. 243 ; 244 ; @restrictions 245 ; Only buttons with textual names are handled by this widget. 246 ; Bitmaps are not understood. 247 ; 248 ; @history 249 ; 15 June 1992, AB 250 ; 7 April 1993, AB, Removed state caching. 251 ; 6 Oct. 1994, KDB, Font keyword is not applied to the label. 252 ; 10 FEB 1995, DJC fixed bad bug in event procedure, getting 253 ; id of stash widget. 254 ; 11 April 1995, AB Removed Motif special cases. 255 ; 256 ; Copyright (c) 1992-2005, Research Systems, Inc. All rights reserved. 257 ; Unauthorized reproduction prohibited. 258 ; 259 ; @version 260 ; $Id$ 261 ; 262 ;- 226 263 227 264 -
trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_calendar.pro
r146 r150 276 276 ;---------------------------------------------------------------------- 277 277 ;---------------------------------------------------------------------- 278 ;+ 279 ; @file_comments 280 ; 281 ; 282 ; @categories 283 ; 284 ; 285 ; @param PARENT {in}{required} 286 ; The widget ID of the parent widget. 287 ; 288 ; @param CALENDAR 289 ; 290 ; 291 ; @param JDATE0 292 ; 293 ; 294 ; @keyword CALTYPE 295 ; 296 ; 297 ; @keyword FAKECAL 298 ; 299 ; 300 ; @keyword UVALUE 301 ; 302 ; 303 ; @keyword UNAME 304 ; 305 ; 306 ; @keyword _EXTRA 307 ; Used to pass your keywords 308 ; 309 ; @returns 310 ; 311 ; 312 ; @uses 313 ; 314 ; 315 ; @restrictions 316 ; 317 ; 318 ; @examples 319 ; 320 ; 321 ; @history 322 ; 323 ; 324 ; @version 325 ; $Id$ 326 ; 327 ; @todo 328 ; seb 329 ; 330 ;- 278 331 FUNCTION cw_calendar, parent, calendar, jdate0, CALTYPE = CALTYPE, FAKECAL = fakecal, UVALUE = uvalue, UNAME = uname, _extra = ex 279 332 ; -
trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_combobox_pm.pro
r134 r150 1 ;------------------------------------------------------------2 ;------------------------------------------------------------3 ;------------------------------------------------------------4 ;+5 ; NAME: cw_combobox_pm6 ;7 ; PURPOSE: widget equivalent a WIDGET_COMBOBOX sauf qu'en plus on8 ; dispose de 2 bouttons + et - pour deplacer le widget de +/- 1.9 ;10 ; CATEGORY: compound widget (aide a l''ecriture des widgets)11 ;12 ; CALLING SEQUENCE: id=cw_combobox_pm(parent)13 ;14 ; INPUTS:15 ; Parent: The widget ID of the parent widget.16 ;17 ; KEYWORD PARAMETERS:tous ceux de WIDGET_COMBOBOX18 ;19 ; OUTPUTS:20 ; The returned value of this function is the widget ID of the21 ; newly-created animation widget.22 ;23 ; COMMON BLOCKS: none24 ;25 ; SIDE EFFECTS:26 ;27 ; Widget Events Returned by Combobox Widgets28 ;29 ; Pressing the mouse button while the mouse cursor is over an30 ; element of a combobox widget causes the widget to change the label31 ; on the combobox button and to generate an event. The appearance of32 ; any previously selected element is restored to normal at the same33 ; time. The event structure returned by the WIDGET_EVENT function is34 ; defined by the following statement:35 ;36 ; { CW_COMBOBOX_PM, ID:0L, TOP:0L, HANDLER:0L, INDEX:0L, OUT:0 }37 ;38 ; The first three fields are the standard fields found in every39 ; widget event.40 ; INDEX returns the index of the selected item. This can be used to41 ; index the array of names originally used to set the widget''s42 ; value43 ; OUT:c''est un entier qui peut prendre 3 valeurs:44 ; 1 : si on appuie sur + alors que l''index est deja aux max. rq:45 ; ds ce cas l''index reste au max46 ; -1: si on appuie sur - alors que l''index est deja aux min. rq:47 ; ds ce cas l''index reste au min48 ; 0 : ds les autres cas!49 ;50 ; Keywords to WIDGET_CONTROL51 ;52 ; A number of keywords to the WIDGET_CONTROL procedure affect the53 ; behavior of cw_slider_pm widget: GET_VALUE and SET_VALUE.54 ; 1) GET_VALUE55 ; widget_control,wid_id,get_value=resultat56 ; retourne ds la variable resultat une structure de 3 elements dont57 ; les noms sont inspires des mots cles que l''on peut passer a58 ; widget_control qd on utilise WIDGET_COMBOBOX:59 ; COMBOBOX_NUMBER: the number of elements currently60 ; contained in the specified combobox widget.61 ; COMBOBOX_SELECT: the zero-based number of the62 ; currently-selected element (i.e., the currently-displayed63 ; element) in the specified combobox widget.64 ; DYNAMIC_RESIZE: a True value (1) if the widget specified65 ; by Widget_ID is a button, combobox, or label widget that66 ; has had its DYNAMIC_RESIZE attribute set. Otherwise,67 ; False (0) is returned.68 ; 2) SET_VALUE69 ; widget_control,wid_id,set_value=impose70 ; permet de modifier l''etat de la combobox comme on peut le faire71 ; pour WIDGET_COMBOBOX Impose peut etre:72 ; a) The contents of the list widget (string or string array)73 ; b) une structure qui peut avoir comme elements (de 1 a 3):74 ; DYNAMIC_RESIZE:Set this keyword to activate (if set to 1)75 ; or deactivate (if set to 0) dynamic resizing of the76 ; specified CW_COMBOBOX_PM widget (see the documentation77 ; for the DYNAMIC_RESIZE keyword to WIDGET_COMBOBOX78 ; procedure for more information about dynamic widget79 ; resizing).80 ; COMBOBOX_SELECT:Set this keyword to return the zero-based81 ; number of the currently-selected element (i.e., the82 ; currently-displayed element) in the specified combobox83 ; widget.84 ; VALUE: The contents of the list widget (string or string85 ; array)86 ;87 ; RESTRICTIONS:88 ;89 ; EXAMPLE: cf utiliser le programme founit i-dessous: testwid et la90 ; procedure associee, testwid_event.91 ;92 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)93 ; 6/9/199994 ;95 ;-96 ;------------------------------------------------------------97 ;------------------------------------------------------------98 ;------------------------------------------------------------99 1 ; testwid, value=strtrim(indgen(10),2) 100 2 ; PRO testwid_event, event … … 212 114 , INDEX:index, STR:cmbbtxt, OUT:out} 213 115 end 214 ;---------------------------------------------------------------------- 116 ;------------------------------------------------------------ 117 ;------------------------------------------------------------ 118 ;------------------------------------------------------------ 119 ;+ 120 ; 121 ; @file_comments 122 ; Like WIDGET_COMBOBOX but here, their are 2 buttons + and - to move the widget from +/- 1 123 ; 124 ; @categories 125 ; compound widget 126 ; 127 ; @param PARENT {in}{required} 128 ; The widget ID of the parent widget. 129 ; 130 ; @keyword COLUMN 131 ; Buttons will be arranged in the number of columns 132 ; specified by this keyword. 133 ; 134 ; @keyword ROW 135 ; Buttons will be arranged in the number of rows 136 ; specified by this keyword. 137 ; 138 ; @keyword UVALUE 139 ; The user value to be associated with the widget. 140 ; 141 ; @keyword UNAME 142 ; The user name to be associated with the widget. 143 ; 144 ; @keyword VALUE 145 ; 146 ; 147 ; @keyword _EXTRA 148 ; Used to pass your keywords 149 ; 150 ; @returns 151 ; The returned value of this function is the widget ID of the 152 ; newly-created animation widget. 153 ; 154 ; @restrictions 155 ; 156 ; Widget Events Returned by Combobox Widgets 157 ; 158 ; Pressing the mouse button while the mouse cursor is over an 159 ; element of a combobox widget causes the widget to change the label 160 ; on the combobox button and to generate an event. The appearance of 161 ; any previously selected element is restored to normal at the same 162 ; time. The event structure returned by the WIDGET_EVENT function is 163 ; defined by the following statement: 164 ; 165 ; { CW_COMBOBOX_PM, ID:0L, TOP:0L, HANDLER:0L, INDEX:0L, OUT:0 } 166 ; 167 ; The first three fields are the standard fields found in every 168 ; widget event. 169 ; INDEX returns the index of the selected item. This can be used to 170 ; index the array of names originally used to set the widget''s 171 ; value 172 ; OUT:It is an integer which can take 3 values: 173 ; 1 : If we press + when the index is already at the max 174 ; Comment: In this case, the index stay at the max 175 ; -1: If we press - when the index is already at the min 176 ; Comment: In this case, the index stay at the min 177 ; 0 : In other cases 178 ; 179 ; Keywords to WIDGET_CONTROL 180 ; 181 ; A number of keywords to the WIDGET_CONTROL procedure affect the 182 ; behavior of cw_slider_pm widget: GET_VALUE and SET_VALUE. 183 ; 1) GET_VALUE 184 ; widget_control,wid_id,get_value=resultat 185 ; Send back, in the result variable, a structure of 3 elements whose 186 ; names are inspired by keywords we can pass at widget_control when 187 ; we use WIDGET_COMBOBOX: 188 ; COMBOBOX_NUMBER: the number of elements currently 189 ; contained in the specified combobox widget. 190 ; COMBOBOX_SELECT: the zero-based number of the 191 ; currently-selected element (i.e., the currently-displayed 192 ; element) in the specified combobox widget. 193 ; DYNAMIC_RESIZE: a True value (1) if the widget specified 194 ; by Widget_ID is a button, combobox, or label widget that 195 ; has had its DYNAMIC_RESIZE attribute set. Otherwise, 196 ; False (0) is returned. 197 ; 2) SET_VALUE 198 ; widget_control,wid_id,set_value=impose 199 ; Allows to modify the state of the combobox like we can do it for 200 ; WIDGET_COMBOBOX. May impose: 201 ; a) The contents of the list widget (string or string array) 202 ; b) A structure which can have for elements (from 1 to 3): 203 ; DYNAMIC_RESIZE:Set this keyword to activate (if set to 1) 204 ; or deactivate (if set to 0) dynamic resizing of the 205 ; specified CW_COMBOBOX_PM widget (see the documentation 206 ; for the DYNAMIC_RESIZE keyword to WIDGET_COMBOBOX 207 ; procedure for more information about dynamic widget 208 ; resizing). 209 ; COMBOBOX_SELECT:Set this keyword to return the zero-based 210 ; number of the currently-selected element (i.e., the 211 ; currently-displayed element) in the specified combobox 212 ; widget. 213 ; VALUE: The contents of the list widget (string or string 214 ; array) 215 ; 216 ; @examples 217 ; See the program provided above (testwid and the associated procedure, testwid_event). 218 ; 219 ; @history 220 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 221 ; 6/9/1999 222 ; 223 ; @version 224 ; $Id$ 225 ; 226 ;- 227 ;------------------------------------------------------------ 228 ;------------------------------------------------------------ 229 ;------------------------------------------------------------ 215 230 FUNCTION cw_combobox_pm, parent, VALUE = value, UVALUE = uvalue, UNAME = uname, ROW = row, COLUMN = column, _extra = ex 216 231 ; -
trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_domain.pro
r134 r150 53 53 change = changegrid(currentgrid) 54 54 ;------------------------------------------------ 55 ; quel est le type de boxzoom?55 ; What is the type of boxzoom ? 56 56 currentplot = (extractatt(top_uvalue, 'smallin'))[2]-1 57 57 options = extractatt(top_uvalue, 'options') … … 63 63 ytype = 'geographic' ELSE ytype = 'index' 64 64 ;------------------------------------------------ 65 ; comment completer la boxzoom?65 ; How to complete the boxzoom ? 66 66 IF xtype EQ 'geographic' then begin 67 67 lonn1 = lon1 … … 114 114 strict = uvalue.strict 115 115 ; 116 ; les longitudes117 ; 118 ; min et max possible116 ; Longitudes 117 ; 118 ; Possible min and max 119 119 if xtype EQ 'geographic' then BEGIN 120 120 min = floor(min([glamt,glamf], max = max)) … … 124 124 max = jpi-1 125 125 ENDELSE 126 ; les id des widgets126 ; widgets's id 127 127 lon1id = widget_info(id,find_by_uname = 'lon1') 128 128 lon2id = widget_info(id,find_by_uname = 'lon2') 129 ; doit-on changer de type d''axe x: longitude/index129 ; Do we have to change the type of x axis: longitude/index 130 130 lonbase = widget_info(id,find_by_uname = 'lonbase') 131 131 widget_control, lonbase, get_uvalue = lonbase_uvalue 132 132 if lonbase_uvalue.name NE xtype then BEGIN 133 133 widget_control, lonbase, update = 0 134 ; on casse tout134 ; We break everything 135 135 widget_control, lon1id, /destroy 136 136 widget_control, lon2id, /destroy 137 ; on reconstruit137 ; We reconstruct 138 138 lon1id = cw_slider_pm(lonbase,value=min > boxzoom[0] < ((boxzoom[1] < max)-keyword_set(strict)) $ 139 139 , uvalue={name:'lon1', strict:keyword_set(strict)},uname ='lon1' $ … … 147 147 widget_control, lonbase, update = 1 148 148 ENDIF ELSE BEGIN 149 ; la nouvelle valeur qu''ils vont avoir149 ; The new value they will have 150 150 cursorvalue1 = min > boxzoom[0] < ((boxzoom[1] < max)-strict) 151 151 cursorvalue2 = ((min > boxzoom[0])+strict) > boxzoom[1] < max 152 ; on change les bornes des slider152 ; We change slider's boundaries 153 153 widget_control, lon1id, set_value = {slider_min:min, slider_max:cursorvalue2-strict} 154 154 widget_control, lon2id, set_value = {slider_min:cursorvalue1+strict, slider_max:max} 155 ; on attribut la nouvelle valeur155 ; We attribute the new value 156 156 widget_control, lon1id , set_value = cursorvalue1 157 157 widget_control, lon2id, set_value = cursorvalue2 158 158 ENDELSE 159 159 ; 160 ; les latitudes161 ; 162 ; min et max possible160 ; Latitudes 161 ; 162 ; Possible min and max 163 163 if ytype EQ 'geographic' then begin 164 164 min = floor(min([gphit,gphif], max = max)) … … 168 168 max = jpj-1 169 169 ENDELSE 170 ; doit-on changer de type d''axe y: latitude/index170 ; Do we have to change the type of y axis: latitude/index 171 171 latbase = widget_info(id,find_by_uname = 'latbase') 172 172 widget_control, latbase, get_uvalue = latbase_uvalue … … 219 219 widget_control, dthlv2id, set_value = {value:strtrim(gdep2, 1)} 220 220 ENDIF ELSE gdep2 = gdep1+1 221 ; on s''assure que les profs donnees contiennent bien au moins un 222 ; niveau. 221 ; We make sure that given depthes contain at least one level. 223 222 if boxzoom[4] GT boxzoom[5] then begin 224 223 rien = boxzoom[4] … … 240 239 boxzoom[5] = boxzoom[4]+1 241 240 endif 242 ; maintenant que les values et les indexes sont definis proprement,243 ; on peut les appliquer241 ; Now, values and indexes are proprely defined. 242 ; So we can apply them 244 243 widget_control, dthlv1id, set_value = {combobox_select:indice1} 245 244 widget_control, dthlv2id, set_value = {combobox_select:indice2} 246 ; control er les min et les max dessliders...245 ; control mins and maxs of sliders... 247 246 if indice1 EQ 0 then min1 = 0 ELSE min1 = gdep2[indice1-1] 248 247 max1 = (min1+1) > gdep1[indice2] … … 313 312 depth2id = widget_info(event.handler,find_by_uname = 'depth2') 314 313 dthlv2id = widget_info(event.handler,find_by_uname = 'dthlv2') 315 ; faut-il changerdthlv2 ?314 ; Do we have to change dthlv2 ? 316 315 widget_control, event.id, get_value = dthlv1_value 317 316 gdep1 = fix(dthlv1_value.combobox_value) … … 319 318 gdep2 = fix(dthlv2_value.combobox_value) 320 319 if dthlv2_value.combobox_index LT event.index then BEGIN 321 ; on redefinie la valeur de dthlv2id320 ; We redefine the dthlv2id's value 322 321 widget_control, dthlv2id, set_value = {combobox_select:event.index} 323 ; donc on redefinit la valeur et le max duslider 2322 ; So we redefine the value and the max of the slider 2 324 323 if event.index EQ jpk-1 then BEGIN 325 324 max = max([gdept, gdepw]) … … 329 328 widget_control, depth2id $ 330 329 , set_value = {slider_max:max, value:gdep2[event.index]} 331 ; du coup on redefinie donc le max du slider 1330 ; So we redefine the max of the slider 1 332 331 widget_control, depth1id, set_value = {slider_max:gdep1[event.index]} 333 332 END 334 ; on redefinie la valeur et le min du slider depth 1333 ; We redefine the value and the min of the slider depth1 335 334 if event.index EQ 0 then min = 0 ELSE min = gdep1[event.index-1]+1 336 335 widget_control, depth1id, set_value = {slider_min:min, value:gdep1[event.index]} 337 ; du coup on change aussi la valeur du min duslider depth 2336 ; S we change the value of the min of the slider depth 2 338 337 widget_control, depth2id, set_value = {slider_min:gdep1[event.index]+1} 339 338 END … … 343 342 depth2id = widget_info(event.handler,find_by_uname = 'depth2') 344 343 dthlv1id = widget_info(event.handler,find_by_uname = 'dthlv1') 345 ; faut-il changerdthlv1 ?344 ; Do we have to change dthlv1 ? 346 345 widget_control, dthlv1id, get_value = dthlv1_value 347 346 gdep1 = fix(dthlv1_value.combobox_value) … … 349 348 gdep2 = fix(dthlv2_value.combobox_value) 350 349 if dthlv1_value.combobox_index GT event.index then BEGIN 351 ; on redefinie la valeur dedthlv1id350 ; We redfine the value of dthlv1id 352 351 widget_control, dthlv1id, set_value = {combobox_select:event.index} 353 ; donc on redefinit la valeur et le min duslider 1352 ; So we redefine the value and the min of the slider 1 354 353 if event.index EQ 0 then min = 0 ELSE min = gdep2[event.index-1] 355 354 widget_control, depth1id $ 356 355 , set_value = {slider_min:min, value:gdep1[event.index]} 357 ; du coup on redefinie donc le min duslider 2356 ; Se we redefine the min of the slider 2 358 357 widget_control, depth2id, set_value = {slider_min:gdep2[event.index]} 359 358 END 360 ; on redefinie la valeur et le max duslider depth 2359 ; We redefine the value and the max of the slider depth 2 361 360 if event.index EQ jpk-1 then BEGIN 362 361 max = max([gdept, gdepw]) … … 365 364 ENDIF ELSE max = gdep2[event.index+1]-1 366 365 widget_control, depth2id, set_value = {slider_max:max, value:gdep2[event.index]} 367 ; du coup on change aussi la valeur du max duslider depth 1366 ; So we change the value of the max of the slider depth 1 368 367 widget_control, depth1id, set_value = {slider_max:gdep2[event.index]-1} 369 368 END … … 372 371 depth2id = widget_info(event.handler,find_by_uname = 'depth2') 373 372 dthlv1id = widget_info(event.handler,find_by_uname = 'dthlv1') 374 ; doit-on changerdthlv1 ?373 ; Do we have to change dthlv1 ? 375 374 widget_control, dthlv1id, get_value = dthlv1_value 376 375 gdep1 = fix(dthlv1_value.combobox_value) … … 378 377 indice = indice < (jpk-1) 379 378 if indice NE dthlv1_value.combobox_index then begin 380 ; on change le min dedepth2379 ; We change the min of depth2 381 380 widget_control, depth2id, set_value = {slider_min:gdep1[indice]+1} 382 ; on redefinie la valeur dedthlv1id381 ; We redefine the value of dthlv1id 383 382 widget_control, dthlv1id, set_value = {combobox_select:indice} 384 ; donc on redefinit le min duslider 1383 ; So we redefine the min of the slider 1 385 384 if indice EQ 0 then min = 0 ELSE min = gdep1[indice-1]+1 386 385 widget_control, event.id, set_value = {slider_min:min} … … 391 390 depth1id = widget_info(event.handler,find_by_uname = 'depth1') 392 391 dthlv2id = widget_info(event.handler,find_by_uname = 'dthlv2') 393 ; doit-on changerdthlv2 ?392 ; Do we have to change dthlv2 ? 394 393 widget_control, dthlv2id, get_value = dthlv2_value 395 394 gdep2 = fix(dthlv2_value.combobox_value) … … 397 396 indice = 0 > (indice-1) 398 397 if indice NE dthlv2_value.combobox_index then begin 399 ; on change le max dedepth1398 ; We change the min of depth1 400 399 widget_control, depth1id, set_value = {slider_max:gdep2[indice]-1} 401 ; on redefinie la valeur dedthlv2id400 ; We redefine the value of dthlv2id 402 401 widget_control, dthlv2id, set_value = {combobox_select:indice} 403 ; donc on redefinit le max duslider 2402 ; So we redefine the min of the slider 2 404 403 if indice EQ jpk-1 then BEGIN 405 404 max = max([gdept, gdepw]) … … 418 417 end 419 418 ;********************************************************************* 419 ;+ 420 ; @file_comments 421 ; 422 ; 423 ; @categories 424 ; 425 ; 426 ; @param PARENT {in}{required} 427 ; The widget ID of the parent widget. 428 ; 429 ; @keyword UVALUE 430 ; The user value to be associated with the widget. 431 ; 432 ; @keyword UNAME 433 ; The user name to be associated with the widget. 434 ; 435 ; @keyword STRICT 436 ; 437 ; 438 ; @keyword UNZOOM 439 ; 440 ; 441 ; @keyword BOXZOOM 442 ; Vector indicating the geographic zone on which we want to cut the map. 443 ; If BOXZOOM has : 444 ; 1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]] 445 ; 2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]] 446 ; 4 elements: The extraction is made on [Boxzoom, 0, max([gdept, gdepw])] 447 ; 5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]] 448 ; 6 elements: The extraction is made on Boxzoom 449 ; Where lon1, lon2,lat1,lat2 are global variables defined at the last domdef! 450 ; 451 ; @keyword _EXTRA 452 ; Used to pass your keywords 453 ; 454 ; @returns 455 ; 456 ; 457 ; @uses 458 ; 459 ; 460 ; @restrictions 461 ; 462 ; 463 ; @examples 464 ; 465 ; 466 ; @history 467 ; 468 ; 469 ; @version 470 ; $Id$ 471 ; 472 ; @todo 473 ; seb: Documenter 474 ; 475 ;- 420 476 FUNCTION cw_domain, parent, BOXZOOM = boxzoom, STRICT = strict, UVALUE = uvalue, UNAME = uname, UNZOOM = unzoom, _extra = ex 421 477 ; … … 426 482 @cm_4data 427 483 ; 428 ; def de laboxzoom484 ; Definition of the boxzoom 429 485 Case N_Elements(Boxzoom) OF 430 486 0:boxzoom = [lon1, lon2, lat1, lat2 $ -
trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_droplist_pm.pro
r134 r150 1 ;------------------------------------------------------------2 ;------------------------------------------------------------3 ;------------------------------------------------------------4 ;+5 ; NAME: cw_droplist_pm6 ;7 ; PURPOSE: widget equivalent a WIDGET_DROPLIST sauf qu'en plus on8 ; dispose de 2 bouttons + et - pour deplacer le widget de +/- 1.9 ;10 ; CATEGORY: compound widget (aide a l''ecriture des widgets)11 ;12 ; CALLING SEQUENCE: id=cw_droplist_pm(parent)13 ;14 ; INPUTS:15 ; Parent: The widget ID of the parent widget.16 ;17 ; KEYWORD PARAMETERS:tous ceux de WIDGET_DROPLIST18 ;19 ; OUTPUTS:20 ; The returned value of this function is the widget ID of the21 ; newly-created animation widget.22 ;23 ; COMMON BLOCKS: none24 ;25 ; SIDE EFFECTS:26 ;27 ; Widget Events Returned by Droplist Widgets28 ;29 ; Pressing the mouse button while the mouse cursor is over an30 ; element of a droplist widget causes the widget to change the label31 ; on the droplist button and to generate an event. The appearance of32 ; any previously selected element is restored to normal at the same33 ; time. The event structure returned by the WIDGET_EVENT function is34 ; defined by the following statement:35 ;36 ; { CW_DROPLIST_PM, ID:0L, TOP:0L, HANDLER:0L, INDEX:0L, OUT:0 }37 ;38 ; The first three fields are the standard fields found in every39 ; widget event.40 ; INDEX returns the index of the selected item. This can be used to41 ; index the array of names originally used to set the widget''s42 ; value43 ; OUT:c''est un entier qui peut prendre 3 valeurs:44 ; 1 : si on appuie sur + alors que l''index est deja aux max. rq:45 ; ds ce cas l''index reste au max46 ; -1: si on appuie sur - alors que l''index est deja aux min. rq:47 ; ds ce cas l''index reste au min48 ; 0 : ds les autres cas!49 ;50 ; Keywords to WIDGET_CONTROL51 ;52 ; A number of keywords to the WIDGET_CONTROL procedure affect the53 ; behavior of cw_slider_pm widget: GET_VALUE and SET_VALUE.54 ; 1) GET_VALUE55 ; widget_control,wid_id,get_value=resultat56 ; retourne ds la variable resultat une structure de 3 elements dont57 ; les noms sont inspires des mots cles que l''on peut passer a58 ; widget_control qd on utilise WIDGET_DROPLIST:59 ; DROPLIST_NUMBER: the number of elements currently60 ; contained in the specified droplist widget.61 ; DROPLIST_SELECT: the zero-based number of the62 ; currently-selected element (i.e., the currently-displayed63 ; element) in the specified droplist widget.64 ; DYNAMIC_RESIZE: a True value (1) if the widget specified65 ; by Widget_ID is a button, droplist, or label widget that66 ; has had its DYNAMIC_RESIZE attribute set. Otherwise,67 ; False (0) is returned.68 ; 2) SET_VALUE69 ; widget_control,wid_id,set_value=impose70 ; permet de modifier l''etat de la droplist comme on peut le faire71 ; pour WIDGET_DROPLIST Impose peut etre:72 ; a) The contents of the list widget (string or string array)73 ; b) une structure qui peut avoir comme elements (de 1 a 3):74 ; DYNAMIC_RESIZE:Set this keyword to activate (if set to 1)75 ; or deactivate (if set to 0) dynamic resizing of the76 ; specified CW_DROPLIST_PM widget (see the documentation77 ; for the DYNAMIC_RESIZE keyword to WIDGET_DROPLIST78 ; procedure for more information about dynamic widget79 ; resizing).80 ; DROPLIST_SELECT:Set this keyword to return the zero-based81 ; number of the currently-selected element (i.e., the82 ; currently-displayed element) in the specified droplist83 ; widget.84 ; VALUE: The contents of the list widget (string or string85 ; array)86 ;87 ; RESTRICTIONS:88 ;89 ; EXAMPLE: cf utiliser le programme founit i-dessous: testwid et la90 ; procedure associee, testwid_event.91 ;92 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)93 ; 6/9/199994 ;95 ;-96 ;------------------------------------------------------------97 ;------------------------------------------------------------98 ;------------------------------------------------------------99 1 ; PRO testwid_event, event 100 2 ; ; help, event, /STRUCT … … 199 101 end 200 102 ;---------------------------------------------------------------------- 103 ;------------------------------------------------------------ 104 ;------------------------------------------------------------ 105 ;------------------------------------------------------------ 106 ;+ 107 ; 108 ; @file_comments 109 ; Like WIDGET_DROPLIST but here, their are 2 buttons + and - to move the widget from +/- 1 110 ; 111 ; @categories 112 ; compound widget 113 ; 114 ; @param PARENT {in}{required} 115 ; The widget ID of the parent widget. 116 ; 117 ; @keyword COLUMN 118 ; Buttons will be arranged in the number of columns 119 ; specified by this keyword. 120 ; 121 ; @keyword ROW 122 ; Buttons will be arranged in the number of rows 123 ; specified by this keyword. 124 ; 125 ; @keyword UVALUE 126 ; The user value to be associated with the widget. 127 ; 128 ; @keyword UNAME 129 ; The user name to be associated with the widget. 130 ; 131 ; @keyword _EXTRA 132 ; Used to pass your keywords 133 ; 134 ; @returns 135 ; The returned value of this function is the widget ID of the 136 ; newly-created animation widget. 137 ; 138 ; @restrictions 139 ; 140 ; Widget Events Returned by Droplist Widgets 141 ; 142 ; Pressing the mouse button while the mouse cursor is over an 143 ; element of a droplist widget causes the widget to change the label 144 ; on the droplist button and to generate an event. The appearance of 145 ; any previously selected element is restored to normal at the same 146 ; time. The event structure returned by the WIDGET_EVENT function is 147 ; defined by the following statement: 148 ; 149 ; { CW_DROPLIST_PM, ID:0L, TOP:0L, HANDLER:0L, INDEX:0L, OUT:0 } 150 ; 151 ; The first three fields are the standard fields found in every 152 ; widget event. 153 ; INDEX returns the index of the selected item. This can be used to 154 ; index the array of names originally used to set the widget''s 155 ; value 156 ; OUT:It is an integer which can take 3 values: 157 ; 1 : If we press + when the index is already at the max 158 ; Comment: In this case, the index stay at the max 159 ; -1: If we press - when the index is already at the min 160 ; Comment: In this case, the index stay at the min 161 ; 0 : In other cases 162 ; 163 ; Keywords to WIDGET_CONTROL 164 ; 165 ; A number of keywords to the WIDGET_CONTROL procedure affect the 166 ; behavior of cw_slider_pm widget: GET_VALUE and SET_VALUE. 167 ; 1) GET_VALUE 168 ; widget_control,wid_id,get_value=resultat 169 ; Send back, in the result variable, a structure of 3 elements whose 170 ; names are inspired by keywords we can pass at widget_control when 171 ; we use WIDGET_COMBOBOX: 172 ; DROPLIST_NUMBER: the number of elements currently 173 ; contained in the specified droplist widget. 174 ; DROPLIST_SELECT: the zero-based number of the 175 ; currently-selected element (i.e., the currently-displayed 176 ; element) in the specified droplist widget. 177 ; DYNAMIC_RESIZE: a True value (1) if the widget specified 178 ; by Widget_ID is a button, droplist, or label widget that 179 ; has had its DYNAMIC_RESIZE attribute set. Otherwise, 180 ; False (0) is returned. 181 ; 2) SET_VALUE 182 ; widget_control,wid_id,set_value=impose 183 ; permet de modifier l''etat de la droplist comme on peut le faire 184 ; pour WIDGET_DROPLIST Impose peut etre: 185 ; a) The contents of the list widget (string or string array) 186 ; b) A structure which can have for elements (from 1 to 3): 187 ; DYNAMIC_RESIZE:Set this keyword to activate (if set to 1) 188 ; or deactivate (if set to 0) dynamic resizing of the 189 ; specified CW_DROPLIST_PM widget (see the documentation 190 ; for the DYNAMIC_RESIZE keyword to WIDGET_DROPLIST 191 ; procedure for more information about dynamic widget 192 ; resizing). 193 ; DROPLIST_SELECT:Set this keyword to return the zero-based 194 ; number of the currently-selected element (i.e., the 195 ; currently-displayed element) in the specified droplist 196 ; widget. 197 ; VALUE: The contents of the list widget (string or string 198 ; array) 199 ; 200 ; @examples 201 ; See the program provided above (testwid and the associated procedure, testwid_event). 202 ; 203 ; @history 204 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 205 ; 6/9/1999 206 ; 207 ; @version 208 ; $Id$ 209 ; 210 ;- 211 ;------------------------------------------------------------ 212 ;------------------------------------------------------------ 213 ;------------------------------------------------------------ 201 214 FUNCTION cw_droplist_pm, parent,UVALUE = uvalue, UNAME = uname, ROW = row, COLUMN = column, _extra = ex 202 215 ; -
trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_pagelayout.pro
r134 r150 18 18 ; 19 19 @common 20 ; si on ne change pas le nombre de colonnes, on sort20 ; If we do not change the number of columns, we send 21 21 if uval.name EQ 'column' then $ 22 22 if event.index+1 EQ smallin[0] THEN $ 23 23 return,{ID:event.handler, TOP:event.top, HANDLER:0L} 24 ; si on ne change pas le nombre de lignes, on sort24 ; If we do not change the number of lines, we send 25 25 if uval.name EQ 'row' then $ 26 26 if event.index+1 EQ smallin[1] THEN $ 27 27 return,{ID:event.handler, TOP:event.top, HANDLER:0L} 28 28 ; 29 ; on efface lapage29 ; We erase the page 30 30 ; graphid = widget_info(event.top,find_by_uname = 'graph') 31 31 graphid = extractatt(top_uvalue, 'graphid') … … 46 46 nbredessin = smallin[0]*smallin[1] 47 47 ; 48 ; on remet tout a 0 en ce qui concerne lespostscripts48 ; We put all back to 0 for postscripts 49 49 createhistory, event.top, smallin 50 50 ; … … 79 79 end 80 80 ;********************************************************************* 81 ;+ 82 ; @file_comments 83 ; 84 ; 85 ; @categories 86 ; 87 ; 88 ; @param PARENT {in}{required} 89 ; The widget ID of the parent widget. 90 ; 91 ; @param SMALL 92 ; 93 ; 94 ; @keyword COLUMN 95 ; Buttons will be arranged in the number of columns 96 ; specified by this keyword. 97 ; 98 ; @keyword ROW 99 ; Buttons will be arranged in the number of rows 100 ; specified by this keyword. 101 ; 102 ; @keyword UVALUE 103 ; The user value to be associated with the widget. 104 ; 105 ; @keyword UNAME 106 ; The user name to be associated with the widget. 107 ; 108 ; @keyword _EXTRA 109 ; Used to pass your keywords 110 ; 111 ; 112 ; 113 ; @returns 114 ; 115 ; 116 ; @uses 117 ; 118 ; 119 ; @restrictions 120 ; 121 ; 122 ; @examples 123 ; 124 ; 125 ; @history 126 ; 127 ; 128 ; @version 129 ; $Id$ 130 ; 131 ; @todo 132 ; seb: documenter 133 ; 134 ;- 81 135 FUNCTION cw_pagelayout, parent, small, UVALUE = uvalue, UNAME = uname, UNZOOM = unzoom, COLUMN = column, ROW = row, _extra = ex 82 136 ;------------------------------------------------ -
trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_slide_slice.pro
r134 r150 109 109 end 110 110 ;-------------------------------------------------------------------------------- 111 ;+ 112 ; @file_comments 113 ; 114 ; 115 ; @categories 116 ; 117 ; @param PARENT {in}{required} 118 ; The widget ID of the parent widget. 119 ; 120 ; @keyword BOXZOOM 121 ; Vector indicating the geographic zone on which we want to cut the map. 122 ; If BOXZOOM has : 123 ; 1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]] 124 ; 2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]] 125 ; 4 elements: The extraction is made on [Boxzoom, 0, max([gdept, gdepw])] 126 ; 5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]] 127 ; 6 elements: The extraction is made on Boxzoom 128 ; Where lon1, lon2,lat1,lat2 are global variables defined at the last domdef! 129 ; 130 ; @keyword COLUMN 131 ; Buttons will be arranged in the number of columns 132 ; specified by this keyword. 133 ; 134 ; @keyword FRAME 135 ; Specifies the width of the frame to be drawn around the base. 136 ; 137 ; @keyword ROW 138 ; Buttons will be arranged in the number of rows 139 ; specified by this keyword. 140 ; 141 ; @keyword UVALUE 142 ; The user value to be associated with the widget. 143 ; 144 ; @keyword UNAME 145 ; The user name to be associated with the widget. 146 ; 147 ; @keyword _EXTRA 148 ; Used to pass your keywords 149 ; 150 ; @returns 151 ; 152 ; 153 ; @uses 154 ; 155 ; 156 ; @restrictions 157 ; 158 ; 159 ; @examples 160 ; 161 ; 162 ; @history 163 ; 164 ; 165 ; @version 166 ; $Id$ 167 ; 168 ; @todo 169 ; seb: documenter 170 ; 171 ;- 111 172 FUNCTION cw_slide_slice, parent, boxzoom = boxzoom, UVALUE = uvalue, UNAME = uname, FRAME = frame, ROW = row, COLUMN = column, _extra = ex 112 173 ; -
trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_slider_pm.pro
r134 r150 1 ;------------------------------------------------------------2 ;------------------------------------------------------------3 ;------------------------------------------------------------4 ;+5 ; NAME: cw_slider_pm6 ;7 ; PURPOSE: widget equivalent a WIDGET_SLIDER sauf qu'en plus on8 ; dispose de 2 bouttons + et - pour deplacer le widget de +/- 1.9 ;10 ; CATEGORY: compound widget (aide a l''ecriture des widgets)11 ;12 ; CALLING SEQUENCE: id=cw_slider_pm(parent)13 ;14 ; INPUTS:15 ; Parent: The widget ID of the parent widget.16 ;17 ; KEYWORD PARAMETERS:tous ceux de WIDGET_SLIDER18 ;19 ; OUTPUTS:20 ; The returned value of this function is the widget ID of the21 ; newly-created animation widget.22 ;23 ; COMMON BLOCKS: none24 ;25 ; SIDE EFFECTS:26 ;27 ; Widget Events Returned by the CW_SLIDER_PM Widget28 ;29 ; Slider widgets generate events when the mouse is used to change30 ; their value. The event structure returned by the WIDGET_EVENT31 ; function is defined by the following statement:32 ;33 ; {CW_SLIDER_PM, ID:0L, TOP:0L, HANDLER:0L, VALUE:0L, DRAG:0, OUT:0}34 ;35 ; ID is the widget ID of the button generating the event. TOP is the36 ; widget ID of the top level widget containing ID.37 ; HANDLER contains the widget ID of the widget associated with the38 ; handler routine.39 ; VALUE returns the new value of the slider.40 ; DRAG returns integer 1 if the slider event was generated as part of41 ; a drag operation, or zero if the event was generated when the user42 ; had finished positioning the slider. Note that the slider widget43 ; only generates events during the drag operation if the DRAG keyword44 ; is set, and if the application is running under Motif. When the45 ; DRAG keyword is set, the DRAG field can be used to avoid46 ; computationally expensive operations until the user releases the47 ; slider.48 ; OUT:c''est un entier qui peut prendre 3 valeurs:49 ; 1 : si on appuie sur + alors que le slider est deja aux max. rq:50 ; ds ce cas le slider reste au max51 ; -1: si on appuie sur - alors que le slider est deja aux min. rq:52 ; ds ce cas le slider reste au min53 ; 0 : ds les autres cas!54 ;55 ; Keywords to WIDGET_CONTROL56 ;57 ; A number of keywords to the WIDGET_CONTROL procedure affect the58 ; behavior of cw_slider_pm widget: GET_VALUE and SET_VALUE.59 ; 1) GET_VALUE60 ; widget_control,wid_id,get_value=resultat61 ; retourne ds la variable resultat une structure de 2 elements dont62 ; les noms sont inspires des mots cles que l''on peut passer a63 ; widget_control qd on utilise WIDGET_SLIDER:64 ; VALUE:the value setting of the widget65 ; SLIDER_MIN_MAX: a 2 elements array: The minimum and the66 ; maximum value of the range encompassed by the slider67 ; 2) SET_VALUE68 ; widget_control,wid_id,set_value=impose69 ; permet de modifier l''etat de la slider bar comme on peut le faire70 ; pour WIDGET_SLIDER. Impose peut etre:71 ; a) un entier: donne la nouvelle position of the slider.72 ; b) une structure qui peut avoir comme elements (de 1 a 3):73 ; VALUE:un entier qui donne la nouvelle position of the slider.74 ; SLIDER_MIN:Set to a new minimum value for the specified75 ; slider widget.76 ; SLIDER_MAX:Set to a new minimum value for the specified77 ; slider widget.78 ;79 ; RESTRICTIONS:80 ;81 ; EXAMPLE: cf utiliser le programme founit i-dessous: testwid et la82 ; procedure associee, testwid_event.83 ;84 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)85 ; 5/9/199986 ;-87 ;------------------------------------------------------------88 ;------------------------------------------------------------89 ;------------------------------------------------------------90 1 ; PRO testwid_event, event 91 2 ; ; help, event, /STRUCT … … 249 160 end 250 161 ;---------------------------------------------------------------------- 162 ;------------------------------------------------------------ 163 ;------------------------------------------------------------ 164 ;------------------------------------------------------------ 165 ;+ 166 ; 167 ; @file_comments 168 ; Like WIDGET_SLIDER but here, their are 2 buttons + and - to move the widget from +/- 1 169 ; 170 ; @categories 171 ; compound widget 172 ; 173 ; @param PARENT {in}{required} 174 ; The widget ID of the parent widget. 175 ; 176 ; @keyword UVALUE 177 ; The user value to be associated with the widget. 178 ; 179 ; @keyword UNAME 180 ; The user name to be associated with the widget. 181 ; 182 ; @keyword VALUE 183 ; 184 ; 185 ; @keyword MAXIMUM 186 ; 187 ; 188 ; @keyword MINIMUM 189 ; 190 ; 191 ; @keyword STRMINLEN 192 ; 193 ; 194 ; @keyword _EXTRA 195 ; Used to pass your keywords 196 ; 197 ; @returns 198 ; The returned value of this function is the widget ID of the 199 ; newly-created animation widget. 200 ; 201 ; @restrictions 202 ; 203 ; Widget Events Returned by the CW_SLIDER_PM Widget 204 ; 205 ; Slider widgets generate events when the mouse is used to change 206 ; their value. The event structure returned by the WIDGET_EVENT 207 ; function is defined by the following statement: 208 ; 209 ; {CW_SLIDER_PM, ID:0L, TOP:0L, HANDLER:0L, VALUE:0L, DRAG:0, OUT:0} 210 ; 211 ; ID is the widget ID of the button generating the event. TOP is the 212 ; widget ID of the top level widget containing ID. 213 ; HANDLER contains the widget ID of the widget associated with the 214 ; handler routine. 215 ; VALUE returns the new value of the slider. 216 ; DRAG returns integer 1 if the slider event was generated as part of 217 ; a drag operation, or zero if the event was generated when the user 218 ; had finished positioning the slider. Note that the slider widget 219 ; only generates events during the drag operation if the DRAG keyword 220 ; is set, and if the application is running under Motif. When the 221 ; DRAG keyword is set, the DRAG field can be used to avoid 222 ; computationally expensive operations until the user releases the 223 ; slider. 224 ; OUT:It is an integer which can take 3 values: 225 ; 1 : If we press + when the index is already at the max 226 ; Comment: In this case, the index stay at the max 227 ; -1: If we press - when the index is already at the min 228 ; Comment: In this case, the index stay at the min 229 ; 0 : In other cases 230 ; 231 ; Keywords to WIDGET_CONTROL 232 ; 233 ; A number of keywords to the WIDGET_CONTROL procedure affect the 234 ; behavior of cw_slider_pm widget: GET_VALUE and SET_VALUE. 235 ; 1) GET_VALUE 236 ; widget_control,wid_id,get_value=resultat 237 ; retourne ds la variable resultat une structure de 2 elements dont 238 ; les noms sont inspires des mots cles que l''on peut passer a 239 ; widget_control qd on utilise WIDGET_SLIDER: 240 ; VALUE:the value setting of the widget 241 ; SLIDER_MIN_MAX: a 2 elements array: The minimum and the 242 ; maximum value of the range encompassed by the slider 243 ; 2) SET_VALUE 244 ; widget_control,wid_id,set_value=impose 245 ; Allows to modify the state of the combobox like we can do it for 246 ; WIDGET_COMBOBOX. May impose: 247 ; a) un entier: donne la nouvelle position of the slider. 248 ; b) A structure which can have for elements (from 1 to 3): 249 ; VALUE: an integer which give the new position of the slider 250 ; SLIDER_MIN:Set to a new minimum value for the specified 251 ; slider widget. 252 ; SLIDER_MAX:Set to a new minimum value for the specified 253 ; slider widget. 254 ; 255 ; 256 ; @examples 257 ; See the program provided above (testwid and the associated procedure, testwid_event). 258 ; 259 ; @history 260 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 261 ; 5/9/1999 262 ; 263 ; @version 264 ; $Id$ 265 ; 266 ; @todo 267 ; seb: documenter 268 ; 269 ;- 270 ;------------------------------------------------------------ 271 ;------------------------------------------------------------ 272 ;------------------------------------------------------------ 251 273 FUNCTION cw_slider_pm, parent, MAXIMUM = maximum, MINIMUM = minimum $ 252 274 , STRMINLEN = strminlen, VALUE = value, UVALUE = uvalue $ -
trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_specifie.pro
r134 r150 72 72 'default':BEGIN 73 73 ;--------------- 74 ; on trouve le nom de la variable: 75 ;--------------- 74 ; We find the name of the variable: 76 75 vlstid = widget_info(event.top, find_by_uname = 'varlist') 77 76 fieldname = widget_info(vlstid, /combobox_gettext) … … 94 93 ;***************************************************** 95 94 ;***************************************************** 95 ;+ 96 ; @file_comments 97 ; 98 ; 99 ; @categories 100 ; 101 ; 102 ; @param PARENT {in}{required} 103 ; The widget ID of the parent widget. 104 ; 105 ; @keyword COLUMN 106 ; Buttons will be arranged in the number of columns 107 ; specified by this keyword. 108 ; 109 ; @keyword ROW 110 ; Buttons will be arranged in the number of rows 111 ; specified by this keyword. 112 ; 113 ; @keyword UVALUE 114 ; The user value to be associated with the widget. 115 ; 116 ; @keyword UNAME 117 ; The user name to be associated with the widget. 118 ; 119 ; @keyword FRAME 120 ; 121 ; 122 ; @keyword FORXXX 123 ; 124 ; 125 ; @keyword _EXTRA 126 ; Used to pass your keywords 127 ; 128 ; 129 ; @returns 130 ; 131 ; 132 ; @uses 133 ; 134 ; 135 ; @restrictions 136 ; 137 ; 138 ; @examples 139 ; 140 ; 141 ; @history 142 ; 143 ; 144 ; @version 145 ; $ID$ 146 ; 147 ; @todo 148 ; seb: documenter 149 ; 150 ;- 96 151 FUNCTION cw_specifie, parent, ROW = row, COLUMN = column, UVALUE = uvalue, UNAME = uname, FRAME = frame, FORXXX = forxxx, _extra = ex 97 152 ; cheking exclusive keywords … … 135 190 136 191 137 ; widget text cont ennant les autres mots cles passe dstop_uvalue.exextra138 ; en reste-t-il? si oui, il faut les mettres sous forme destring192 ; widget text containig other keywords pass into top_uvalue.exextra 193 ; Does it remain some? If yes, we have to put them as string 139 194 140 195 rien = widget_text(base, value = ' ', /editable, uname = 'autres', uvalue = 'autres', xsize = 54, ysize = 3, yoffset = 65, /wrap, /no_newline) -
trunk/SRC/ToBeReviewed/WIDGET/findtopid.pro
r134 r150 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME: findtopid6 5 ; 7 ; PURPOSE: retrouve a partir d''un Id de widget l'Id du widget qui est 6 ; @file_comments 7 ; Find, from an Id of widget, the Id of the widget which is 8 8 ; "the top-level base" (i.e., it has no parent) 9 9 ; 10 ; CATEGORY: aide pour les widgets 11 ; 12 ; CALLING SEQUENCE: res=findtopid(Widget_ID) 10 ; categories 11 ; widget 13 12 ; 14 ; INPUTS: Widget_ID: this argument should be the widget ID of the 13 ; @param WIDGET_ID 14 ; This argument should be the widget ID of the 15 15 ; widget for which information is desired. 16 16 ; 17 ; KEYWORD PARAMETERS: 17 ; @returns 18 ; The Id of the widget which is "the top-level base" 18 19 ; 19 ; OUTPUTS: l'Id du widget qui est "the top-level base" 20 ; @history 21 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 22 ; 22/9/1999 20 23 ; 21 ; COMMON BLOCKS: 24 ; @version 25 ; $Id$ 22 26 ; 23 ; SIDE EFFECTS:24 ;25 ; RESTRICTIONS:26 ;27 ; EXAMPLE:28 ;29 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)30 ; 22/9/199931 27 ;- 32 28 ;------------------------------------------------------------ 33 29 ;------------------------------------------------------------ 34 30 ;------------------------------------------------------------ 35 FUNCTION findtopid, identite31 FUNCTION findtopid, WIDGET_ID 36 32 ; 37 33 compile_opt idl2, strictarrsubs 38 34 ; 39 id = long( identite)35 id = long(WIDGET_ID) 40 36 ; exist = widget_info(id, /managed) 41 37 ; if exist EQ 0 then return, -1 -
trunk/SRC/ToBeReviewed/WIDGET/slec.pro
r134 r150 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @param NAME 9 ; 10 ; 11 ; @param DEBUT 12 ; 13 ; 14 ; @param FIN 15 ; 16 ; 17 ; @param NOMEXP 18 ; 19 ; 20 ; @keyword PARENT {in}{required} 21 ; The widget ID of the parent widget. 22 ; 23 ; @keyword BOXZOOM 24 ; Vector indicating the geographic zone on which we want to cut the map. 25 ; If BOXZOOM has : 26 ; 1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]] 27 ; 2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]] 28 ; 4 elements: The extraction is made on [Boxzoom, 0, max([gdept, gdepw])] 29 ; 5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]] 30 ; 6 elements: The extraction is made on Boxzoom 31 ; Where lon1, lon2,lat1,lat2 are global variables defined at the last domdef! 32 ; 33 ; @keyword _EXTRA 34 ; Used to pass your keywords 35 ; 36 ; 37 ; @returns 38 ; 39 ; 40 ; @uses 41 ; 42 ; 43 ; @restrictions 44 ; 45 ; 46 ; @examples 47 ; 48 ; 49 ; @history 50 ; 51 ; 52 ; @version 53 ; $Id$ 54 ; 55 ; @todo 56 ; Seb: documenter 57 ; 58 ;- 1 59 FUNCTION slec,name,debut,fin, nomexp, PARENT = parent, BOXZOOM=boxzoom, _EXTRA = ex 2 60 ;--------------------------------------------------------- -
trunk/SRC/ToBeReviewed/WIDGET/xnotice.pro
r134 r150 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:xnotice6 5 ; 7 ; PURPOSE:cree un widget avec du texte au milieu de la fenetre. 6 ; @file_comments 7 ; Create a widget with some text at the middle of the window 8 8 ; 9 ; CATEGORY:information 9 ; @categories 10 ; Information 11 ; 12 ; @param TEXT {in}{required} 13 ; it is a string or a vector of string. If it is a scalar, we 14 ; look for the line separator !C to create a text with several lines. 10 15 ; 11 ; CALLING SEQUENCE:widgetid=xnotice(text) 12 ; 13 ; INPUTS:text: un string ou un vecteur de string. Si c''est un 14 ; scalaire on cherche le separateur de ligne !C pour creer un texte a 15 ; plusieurs lignes. 16 ; @keyword CHKWIDGET 17 ; Force to verify that they are some active widget to create a widget, 18 ; otherwise print at the prompt 16 19 ; 17 ; KEYWORD PARAMETERS:chkwidget: oblige a verifier qu''il y a des18 ; widgets actif pour creer un widget, sinon imprime au prompt20 ; @returns 21 ; The identity of the created widget 19 22 ; 20 ; OUTPUTS:lidentite du widget cree 21 ; 22 ; COMMON BLOCKS 23 ; 24 ; SIDE EFFECTS:ne fait pas appelle a xmanager -> ne cree aucun event! 25 ; il faut detruire ce widget a la main: 23 ; @restrictions 24 ; It do not call xmanager -> It do not create any event! 25 ; We have to delete this widget manuelly: 26 26 ; widget_control, widgetid, /destroy 27 27 ; 28 ; RESTRICTIONS: 29 ; 30 ; EXAMPLE: 28 ; @examples 31 29 ; IDL> id=xnotice('ca marche !C ou pas?') 32 30 ; IDL> widget_control, id, /destroy 33 31 ; 34 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) 32 ; @history 33 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 35 34 ; 2000 3 17 35 ; 36 ; @version 37 ; $Id$ 38 ; 36 39 ;- 37 40 ;------------------------------------------------------------ … … 40 43 FUNCTION xnotice, text, CHKWIDGET = chkwidget 41 44 ; 42 ; on separe le text en differentes lignes (separees par !C) si ce45 ; We separate the text in different lines (separated by !C) if it is not done yet... 43 46 ; n''est pas deja fait... 44 47 ; -
trunk/SRC/ToBeReviewed/WIDGET/xquestion.pro
r134 r150 1 ;------------------------------------------------------------2 ;------------------------------------------------------------3 ;------------------------------------------------------------4 ;+5 ; NAME:xquestion6 ;7 ; PURPOSE: a small widget who ask a question and give an answer.8 ; WARNING: For a binary question with yes/no answer use9 ; DIALOG_MESSAGE.10 ;11 ; CATEGORY: widget12 ;13 ; CALLING SEQUENCE: answer = xquestion(question[,proposedanswer])14 ;15 ; INPUTS:16 ; question: a scalar string or a array of string. If this17 ; argument is set to :18 ; + an array of strings: each array element is19 ; displayed as a separate line of text.20 ; + a scalar string: we are looking for the "separate line21 ; character" '!C'22 ;23 ; proposedanswer: a string proposing a answer24 ;25 ; KEYWORD PARAMETERS: those from WIDGET_BASE and WIDGET_TEXT26 ;27 ; /CHKWIDGET: active this keyword if you whant that xquestion28 ; check if managed widget are present. If not, xquestion do not29 ; open a widget but print the question in the IDL window.30 ;31 ; OUTPUTS:32 ; answer: a string33 ;34 ; COMMON BLOCKS:35 ; none (we use a "false widget")36 ;37 ; SIDE EFFECTS:38 ; The function does not return to its caller until the user39 ; press "Enter" key in the widget.40 ;41 ; RESTRICTIONS:42 ;43 ; EXAMPLE:44 ;45 ; IDL> help, xquestion('Postscript name')46 ; <Expression> STRING = 'toto.ps'47 ;48 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)49 ; 13/10/199950 ;-51 ;------------------------------------------------------------52 ;------------------------------------------------------------53 ;------------------------------------------------------------54 1 ;------------------------------------------------------------------------- 55 2 pro xquestion_event, event … … 68 15 end 69 16 ;------------------------------------------------------------------------- 17 ;------------------------------------------------------------ 18 ;------------------------------------------------------------ 19 ;------------------------------------------------------------ 20 ;+ 21 ; 22 ; @file_comments 23 ; A small widget who ask a question and give an answer. 24 ; WARNING: For a binary question with yes/no answer use 25 ; DIALOG_MESSAGE. 26 ; 27 ; @categories 28 ; widget 29 ; 30 ; @param QUESTION 31 ; A scalar string or a array of string. If this 32 ; argument is set to : 33 ; + an array of strings: each array element is 34 ; displayed as a separate line of text. 35 ; + a scalar string: we are looking for the "separate line 36 ; character" '!C' 37 ; 38 ; @param PROPOSEDANSWER 39 ; A string proposing a answer 40 ; 41 ; 42 ; @keyword CHKWIDGET 43 ; Active this keyword if you whant that xquestion 44 ; check if managed widget are present. If not, xquestion do not 45 ; open a widget but print the question in the IDL window. 46 ; 47 ; @keyword _EXTRA 48 ; Used to pass your keywords 49 ; 50 ; @returns 51 ; answer: a string 52 ; 53 ; @restrictions 54 ; The function does not return to its caller until the user 55 ; press "Enter" key in the widget. 56 ; 57 ; @examples 58 ; IDL> help, xquestion('Postscript name') 59 ; <Expression> STRING = 'toto.ps' 60 ; 61 ; @history 62 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 63 ; 13/10/1999 64 ; 65 ; @version 66 ; $Id$ 67 ; 68 ;- 69 ;------------------------------------------------------------ 70 ;------------------------------------------------------------ 71 ;------------------------------------------------------------ 70 72 FUNCTION xquestion, question, proposedanswer, CHKWIDGET = chkwidget, _extra = ex ; 71 73 ; -
trunk/SRC/ToBeReviewed/WIDGET/xx.pro
r134 r150 1 1 ;+ 2 ; @file_comments 3 ; 4 ; 5 ; @categories 6 ; 7 ; 8 ; @keyword JOUR 9 ; 10 ; 11 ; @keyword MESHFILENAME 12 ; 13 ; 14 ; @keyword LISTVAR 15 ; 16 ; 17 ; @keyword LISTGRID 18 ; 19 ; 20 ; @keyword FUNCLEC_NAME 21 ; 22 ; 23 ; @keyword CALENDAR 24 ; 25 ; 26 ; @keyword _EXTRA 27 ; Used to pass your keywords 28 ; 29 ; 30 ; @uses 31 ; 32 ; 33 ; @restrictions 34 ; 35 ; 36 ; @examples 37 ; 38 ; 39 ; @history 40 ; 41 ; 42 ; @version 43 ; $Id$ 44 ; 45 ; @todo 46 ; seb documenter 47 ; 48 ;- 49 ; 2 50 PRO xx, JOUR = jour, MESHFILENAME = meshfilename, LISTVAR = listvar, LISTGRID = listgrid, FUNCLEC_NAME = funclec_name, CALENDAR = calendar, _extra = ex 3 ;4 51 ; 5 52 compile_opt idl2, strictarrsubs … … 8 55 ;---------------------------------------------------------------------- 9 56 ;---------------------------------------------------------------------- 10 ; partie a changer57 ; Name of the part to be changed 11 58 ;---------------------------------------------------------------------- 12 59 ;---------------------------------------------------------------------- 13 ; nom de la fonction de lecture:60 ; Name of the reading function 14 61 if NOT keyword_set(funclec_name) then funclec_name = 'slec' 15 62 varexp = 'INF' 16 ; list e desvariables63 ; list of variables 17 64 if NOT keyword_set(listvar) then listvar = ['tn','sn','un','vn', 'taux', 'tauy','hdep20','hdep28','hdep15','hturb','hpycn','htoth','emp','qn','qs', 'smltot11', 'smltot12', 'smltot13', 'smltot14', 'smltot15', 'smltot16', 'tmltot11', 'tmltot12', 'tmltot13', 'tmltot14', 'tmltot15', 'tmltot16'] 18 ; list e des grilles auxquelles elles se rapportent les variables65 ; list of grids to which variables refer to. 19 66 if NOT keyword_set(listgrid) then BEGIN 20 67 listgrid = replicate('T', n_elements(listvar)) … … 22 69 listgrid[[3, 5]] = 'V' 23 70 ENDIF 24 ; calend rier a utiliser (en jours juliens d''IDL71 ; calendar to be used (in IDL julian days 25 72 ;++++ if NOT keyword_set(calendar) then BEGIN 26 73 ;++++ if keyword_set(jour) then calendar = calendriertotem(/julian_day) ELSE calendar = calendriertotem(/julian_day, /mensuel) 27 74 ;++++ ENDIF 28 ; nom du fichier se rapportant au masque75 ; Name of the file refering to the mask 29 76 if NOT keyword_set(meshfilename) then meshfilename = '/usr1/com/smasson/IDL/INIT/inittotem.pro' 30 77 ;++++ meshparameters = whichgrid(meshfilename) 31 ; parameter es specifiant comment doit etre lu le champ78 ; parameters specifing how the field must be read 32 79 readparameters= {funclec_name: funclec_name $ 33 80 , jpidta: jpidta, jpjdta: jpjdta, jpkdta: jpkdta $ … … 37 84 ;---------------------------------------------------------------------- 38 85 ;---------------------------------------------------------------------- 39 ; fin de la partie a changer86 ; End of the part to be change 40 87 ;---------------------------------------------------------------------- 41 88 ;---------------------------------------------------------------------- -
trunk/SRC/ToBeReviewed/WIDGET/xxx.pro
r134 r150 1 ;------------------------------------------------------------2 ;------------------------------------------------------------3 ;------------------------------------------------------------4 ;+5 ; NAME:xxx6 ;7 ; PURPOSE:un maximum de possibilites avec un minimum de clics8 ;9 ; CATEGORY:super widget10 ;11 ; CALLING SEQUENCE:xxx12 ;13 ; INPUTS:none14 ;15 ; KEYWORD PARAMETERS:16 ;17 ; /SEPARATE: pour separer la partie boutons de la partie dessin18 ; en 2 fenetres. Utile pour les petits ecrans, mais attention19 ; peut saturer la memoire video de certains Tx un peu vetustes.20 ;21 ; RESTORE='toto.dat' ou toto.dat est un fichier cree lors d''une22 ; precedente utilisation de xxx grace a la commande "Widget" du23 ; menu "save as".24 ;25 ; OUTPUTS:26 ;27 ; COMMON BLOCKS:common.pro28 ;29 ; SIDE EFFECTS:30 ;31 ; RESTRICTIONS:32 ;33 ; EXAMPLE:34 ;35 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)36 ;37 ;-38 ;------------------------------------------------------------39 ;------------------------------------------------------------40 ;------------------------------------------------------------41 1 42 2 PRO xxx_event, event … … 48 8 ;------------------------------------------------------------ 49 9 ; = widget_info(event.top,find_by_uname = '') 50 ; quel est le type d''evenement?10 ; What is the type of evenment ? 51 11 ; if event.id EQ 622 then help, event, /struct 52 12 widget_control, event.id, get_uvalue=uval … … 55 15 ;help, event, /struct 56 16 ;help, uval , /struct 57 ; case sur le type d''evenement17 ; case on the type of evenment 58 18 widget_control, event.top, get_uvalue = top_uvalue 59 ; si on a active le mot cles separate a l''appelle dexxx19 ; If we activate the keyword separate at the call of xxx 60 20 if size(top_uvalue, /type) EQ 3 then begin 61 21 event.top = top_uvalue 62 22 widget_control, event.top, get_uvalue = top_uvalue 63 23 endif 64 ; on tue le petit widget cree par notice.pro si il existe24 ; we delete the small widget created by notice.pro if it exists 65 25 noticebase = extractatt(top_uvalue, 'noticebase') 66 26 if noticebase NE 0 then BEGIN … … 128 88 ;------------------------------------------------------------ 129 89 ;------------------------------------------------------------ 90 ;+ 91 ; 92 ; @file_comments 93 ; A maximum of possibilities with a minimum of clics 94 ; 95 ; @categories 96 ; widget 97 ; 98 ; @param DATAFILENAME 99 ; 100 ; 101 ; @param IDLFILE 102 ; 103 ; 104 ; @param ARGSPRO 105 ; 106 ; 107 ; @keyword SEPARATE 108 ; To separate the button part and the drawing part in 2 windows. 109 ; Useful for small screens, but be careful to do not saturate the 110 ; video memory of some antiquated Tx. 111 ; 112 ; @keyword RESTORE 113 ; 'toto.dat' or toto.dat is a file created at the time of a precedent 114 ; use of xxx thanks to the command "Widget" of the menu "save as". 115 ; 116 ; @keyword _EXTRA 117 ; Used to pass your keywords 118 ; 119 ; @uses 120 ; common.pro 121 ; 122 ; @history 123 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 124 ; 125 ; @version 126 ; $Id$ 127 ; 128 ; @todo 129 ; seb: documenter le reste des keywords 130 ; 131 ;- 132 ;------------------------------------------------------------ 133 ;------------------------------------------------------------ 134 ;------------------------------------------------------------ 135 ;------------------------------------------------------------ 136 ;------------------------------------------------------------ 137 ;------------------------------------------------------------ 130 138 PRO xxx, datafilename, idlfile, argspro, CALLERWIDID = CallerWidId $ 131 139 , REDRAW = redraw, SEPARATE = separate, UVALUE = uvalue $ … … 154 162 ;------------------------------------------------------------ 155 163 ;------------------------------------------------------------ 156 ; list e des fichiers que l''on veut regarder164 ; list of files we want to look at 157 165 ; 158 166 if keyword_set(uvalue) then BEGIN … … 368 376 ;------------------------------------------------------------ 369 377 if keyword_set(uvalue) then BEGIN ; 370 ; on recopie le pointeur uvalue dans top_uvalue. 371 ; Attention, il faut completement redefinir top_uvalue a partir des 372 ; variables pointees par uvalue. Sinon si on fait simplement 373 ; top_uvalue = uvalue, qd on detruit par uvalue et les variables 374 ; surlesquelles il pointe on detruit aussi les variables sur 375 ; lesquelles pointent top_uvalue. 378 ; We recopy the pointer uvalue in top_uvalue. 379 ; Beware, we have to redefine completely top_value from variables 380 ; pointed by uvalue. Otherwise, if we simply do top_value = uvalue, 381 ; when we delete by uvalue and variables on which it point, we 382 ; also delete variables on which point top_value. 376 383 case 1 of 377 384 keyword_set(redraw):BEGIN … … 380 387 ; we find homedir 381 388 homedir = isadirectory(io = homedir, title = 'Bad definition of homedir') 382 ; on recupere la liste desinstructions389 ; We recuperae the list of instructions 383 390 globalcommand = extractatt(top_uvalue, 'globalcommand') 384 ; on complete par le premiere et les dernieres lignes du programme391 ; We complete by first and last lines of the program 385 392 createpro, globalcommand, filename = myuniquetmpdir + 'xxx2ps.pro' $ 386 393 , KWDLIST = ', NOERASE = noerase, POSTSCRIPT = postscript' $ … … 395 402 wset, win 396 403 tv, image, /true 397 ; etat des widgets404 ; widgets's state 398 405 updatewidget, base 399 ; menage406 ; 400 407 END 401 408 ELSE:BEGIN … … 416 423 for i = 0, nbredessin-1 do *(*top_uvalue[1, 28])[i] = *(*uvalue[1, 28])[i] 417 424 widget_control, base, set_uvalue = top_uvalue 418 ; copie l''ecran du widget de uvalue dans celui de top_uvalue425 ; Copy the screen of the widget of uvalue in top_value's one 419 426 if keyword_set(CallerWidId) then begin 420 427 widget_control, extractatt(uvalue, 'graphid'), get_value = win … … 431 438 *top_uvalue[1, findline(top_uvalue, 'graphid')] = graphid 432 439 ; 433 434 ; sinon on va definit tous les elements que l''on acroche au widget435 ; grace a la top_uvalue qui est un tableau de pointeurs a 2 colonnes:436 ; les noms et des variables437 ; on initialie tous ceselements.438 ; variables concernant le widget ds sa generalite440 ENDIF ELSE BEGIN 441 ; Otherwise we will define all elements we will hook at the widget 442 ; thanks to the top_value which is a pointer array with 2 443 ; columns: names and variables. 444 ; We initialize all these elements. 445 ; Variables concerning the widget in its generality. 439 446 if NOT keyword_set(ex) then ex = {nothing:0} 440 447 ; variables se rapportant aux differents fichiers que l''on peut lire … … 442 449 ; 443 450 444 ; creation du pointeur que l''on va attache auwidget.451 ; creation of the pointer we will hook at the widget. 445 452 top_uvalue = ptrarr(2, 29, /allocate_heap) 446 ; variables se rapportant au widget en general453 ; variables refering to the widget 447 454 *top_uvalue[0, 0] = 'options' & *top_uvalue[1, 0] = options 448 455 *top_uvalue[0, 1] = 'smallin' & *top_uvalue[1, 1] = smallin … … 458 465 *top_uvalue[0, 11] = 'noticebase' & *top_uvalue[1, 11] = 0l 459 466 *top_uvalue[0, 12] = 'extra' & *top_uvalue[1, 12] = ex 460 ; variables se rapportant aux differents fichiers que l''on peut lire467 ; variables refering to different files we can read 461 468 *top_uvalue[0, 13] = 'currentfile' & *top_uvalue[1, 13] = currentfile 462 469 *top_uvalue[0, 14] = 'filelist' & *top_uvalue[1, 14] = filelist … … 464 471 *top_uvalue[0, 16] = 'readparameters' & *top_uvalue[1, 16] = readparameters 465 472 *top_uvalue[0, 17] = 'meshparameters' & *top_uvalue[1, 17] = meshparameters 466 ; variables se rapportant aux differents dessins que l''on peut faire473 ; variables refering to different drawing we can do 467 474 *top_uvalue[0, 18] = 'penvs' & *top_uvalue[1, 18] = replicate(!p, nbredessin) 468 475 *top_uvalue[0, 19] = 'xenvs' & *top_uvalue[1, 19] = replicate(!x, nbredessin)
Note: See TracChangeset
for help on using the changeset viewer.