Changeset 231 for trunk/SRC/ToBeReviewed/LECTURE/xncdf_lec.pro
- Timestamp:
- 03/19/07 18:15:51 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/ToBeReviewed/LECTURE/xncdf_lec.pro
r163 r231 1 ;------------------------------------------------------------2 ;------------------------------------------------------------3 ;------------------------------------------------------------4 1 ;+ 5 2 ; 6 3 ; @file_comments 7 ; Reading of a Net Cdf file with widgets ! 8 ; 9 ; @categories 4 ; Reading of a Net Cdf file with widgets ! 5 ; 6 ; @categories 10 7 ; Widget 11 8 ; 12 ; @param NAME {in}{optional}{type=string} 13 ; It give the name of the file to be opened. If NAME 14 ; does not contain the separating character of directories ('/' under 9 ; @param NAME {in}{optional}{type=string} 10 ; It give the name of the file to be opened. If NAME 11 ; does not contain the separating character of directories ('/' under 15 12 ; unix for example), the file will be looked for in the current directory. 16 13 ; 17 14 ; @keyword IODIR {type=string} 18 15 ; It contains the directory where to go look for the file to be read. 19 ; If NAME does not contain the separating character of directories ('/' under 16 ; If NAME does not contain the separating character of directories ('/' under 20 17 ; unix for example), the file will be called iodir+nom_fichier. 21 18 ; … … 29 26 ; The widget ID of the widget that calls XNCDF_LEC. When 30 27 ; this ID is specified, a death of the caller results in a death 31 ; of XNCDF_LEC. 28 ; of XNCDF_LEC. 32 29 ; 33 30 ; @keyword OFFSET {type=vector}{default=[0, 0,...]} … … 36 33 ; 37 34 ; @keyword SHIFT {type=vector}{default=[0, 0,...]} 38 ; A vector of integers, specifying 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 determined 41 ; by OFFSET and COUNT. On the other hand, it is done after the possible extraction 35 ; A vector of integers, specifying for each dimension how much we have to shift it. 36 ; By default, it is [0,0,...]. See the function shift for more explanations. BEWARE, 37 ; the shift is done on the biggest array before a possible reduction determined 38 ; by OFFSET and COUNT. On the other hand, it is done after the possible extraction 42 39 ; created by the STRIDE. 43 40 ; … … 51 48 ; 1) None attribute has been selected. In this case, res is the array we 52 49 ; 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 50 ; 2) Some attributes has been selected. In this case, res is a structure 51 ; whose the first element having the name of the variable is the values 55 52 ; array and the other arguments are the select arguments. 56 53 ; … … 68 65 ; $Id$ 69 66 ;- 70 ;------------------------------------------------------------ 71 ;------------------------------------------------------------ 72 ;------------------------------------------------------------ 67 ; 73 68 FUNCTION xncdf_lec, name, ATT = att, COUNT = count, GROUP = group, OFFSET = offset, IODIR = iodir, SHIFT = shift, STRIDE = stride, VAR = var 74 69 ; … … 103 98 mciodir = iodir 104 99 ; We complete IODIR with a separating character if needed. 105 IF rstrpos(iodir, sep) NE strlen(iodir)-1 THEN iodir = iodir+sep 100 IF rstrpos(iodir, sep) NE strlen(iodir)-1 THEN iodir = iodir+sep 106 101 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') 102 name = dialog_pickfile(filter = iodir+'*.nc') 108 103 if name[0] EQ '' then return, -1 ;If we do not have find anything, we go out. 109 104 ;We complete NAME by IODIR if NAME does not contain any directory separating character. … … 132 127 ;------------------------------------------------------------ 133 128 base1 = widget_base(base, /column, /align_center) 134 rien = widget_label(base1, value = 'Net Cdf filename', /align_center) 129 rien = widget_label(base1, value = 'Net Cdf filename', /align_center) 135 130 rien = widget_text(base1, value = name, /align_center, uvalue=1, /editable) ;File's name we can change 136 131 rien = widget_label(base1, value = ' ') ; We jump a line … … 207 202 ; 208 203 ;+ 204 ; 209 205 ; @file_comments 210 206 ; Procedure called by xmanager when we press on a button of a second widget created by wid_var. 211 ; 207 ; 212 208 ; @param EVENT {in}{required} 213 209 ; A structure caracterizing the type of event which arrive to a widget number1 2 … … 215 211 ; @uses 216 212 ; wididbase,resultat,infovariable,indicewid,motcle 217 ; 213 ; 218 214 ; @version 219 215 ; $Id$ 220 216 ;- 221 ;------------------------------------------------------------ 222 ;------------------------------------------------------------ 223 ;------------------------------------------------------------ 224 pro wid_var_event, event 217 ; 218 PRO wid_var_event, event 225 219 ; 226 220 compile_opt idl2, strictarrsubs … … 246 240 if event.y GT (size(table))[2] then return 247 241 if size(table[event.x, event.y], /type) GE 6 $ 248 OR size(table[event.x, event.y], /type) EQ 0 then BEGIN 242 OR size(table[event.x, event.y], /type) EQ 0 then BEGIN 249 243 if event.x EQ 1 then $ 250 244 widget_control, widbase1, use_table_select = [1, event.y,1, event.y] $ … … 347 341 ; We redefine the command allowing to cut dimensions which has not been cut yet (ones we shift). 348 342 commande = 'res=res[' ; initialization of the command 349 for dim = 0, varcontient.ndims-1 do BEGIN 343 for dim = 0, varcontient.ndims-1 do BEGIN 350 344 if mcshift[dim] EQ 0 then commande = commande+'*,' $ 351 345 ELSE commande=commande+string(mcoffset[dim])+':'+string(mccount[dim]+mcoffset[dim]-1)+',' … … 380 374 return 381 375 end 382 ;------------------------------------------------------------ 383 ;------------------------------------------------------------ 384 ;------------------------------------------------------------ 376 ; 385 377 ;+ 378 ; 386 379 ; @file_comments 387 ; This procedure manage the second created whiget when we call xncdf_lec. 380 ; This procedure manage the second created whiget when we call xncdf_lec. 388 381 ; This widget concern the reading of the variable. 389 382 ; 390 383 ; @param WIDID_PERE {type=scalar}{in}{required} 391 ; It contains the identity of the father widget which was 384 ; It contains the identity of the father widget which was 392 385 ; created by xncdf_lec and which has allowed to select the variable to be read. 393 386 ; 394 387 ; OUTPUTS: indirectement res (le tableau ou la structure resultat) 395 388 ; 396 ; @uses 389 ; @uses 397 390 ; resultat,infovariable,indicewid_var,motcle 398 391 ; … … 400 393 ; $Id$ 401 394 ;- 402 ;------------------------------------------------------------ 403 ;------------------------------------------------------------ 404 ;------------------------------------------------------------ 395 ; 405 396 PRO wid_var, widid_pere 406 397 ; … … 416 407 widbase = widget_base(/column, title='variable: '+varcontient.name, /align_center, group_leader = widid_pere) 417 408 ;------------------------------------------------------------ 418 ; Opening of the base subwindow 409 ; Opening of the base subwindow 419 410 ;------------------------------------------------------------ 420 411 ; widbase1 array of offsets … … 457 448 rien = widget_label(widbase, value = ' ') ; We jump a line 458 449 widbase2 = widget_base(widbase, /column) 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 450 ; To each attribute, we created a widget (widbase21) containing in line a button 451 ; yes/no (widbase211), and two wigdet text (widbase212, widbase213) comprising the 461 452 ; name and the value of the attribute. 462 453 widbase21 = lonarr(varcontient.natts) … … 492 483 return 493 484 end 494 ;------------------------------------------------------------ 495 496 ;------------------------------------------------------------ 497 ;------------------------------------------------------------ 498 ;------------------------------------------------------------ 485 ; 499 486 ;+ 487 ; 500 488 ; @file_comments 501 ; Procedure called by xmanager when we press a button of the first widget 489 ; Procedure called by xmanager when we press a button of the first widget 502 490 ; created by par xncdf_lec 503 ; 491 ; 504 492 ; @param EVENT 505 493 ; A structure caracterising the event type which arrive at the widget number 1. … … 511 499 ; $Id$ 512 500 ;- 513 ;------------------------------------------------------------ 514 ;------------------------------------------------------------ 515 ;------------------------------------------------------------ 501 ; 516 502 PRO xncdf_lec_event, event 517 503 ; … … 531 517 ;We call back xncdf_lec 532 518 res = xncdf_lec(nom[0], ATT = mcatt, COUNT = mccount, OFFSET = mcoffset, IODIR = mciodir $ 533 , SHIFT = mcshift, STRIDE = mcstride, VAR = mcvar) 519 , SHIFT = mcshift, STRIDE = mcstride, VAR = mcvar) 534 520 return 535 521 END
Note: See TracChangeset
for help on using the changeset viewer.