source: trunk/SRC/ToBeReviewed/LECTURE/xncdf_lec.pro @ 325

Last change on this file since 325 was 325, checked in by pinsard, 17 years ago

modification of some headers (+some corrections) to prepare usage of the new idldoc

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 24.3 KB
Line 
1;+
2;
3; @file_comments
4; Reading of a NetCdf file with widgets
5;
6; @categories
7; Widget
8;
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
12; unix for example), the file will be looked for in the current directory.
13;
14; @keyword IODIR {type=string}
15; It contains the directory where to go look for the file to be read.
16; If NAME does not contain the separating character of directories ('/' under
17; unix for example), the file will be called iodir+nom_fichier.
18;
19; @keyword COUNT {type=vector}
20; An optional vector containing the counts to be used in
21; reading Value. COUNT is a 1-based vector with an element for
22; each dimension of the data to be written.The default matches
23; the size of the variable so that all data is written out.
24;
25; @keyword GROUP
26; The widget ID of the widget that calls XNCDF_LEC. When
27; this ID is specified, a death of the caller results in a death
28; of XNCDF_LEC.
29;
30; @keyword OFFSET {type=vector}{default=[0, 0,...]}
31; An optional vector containing the starting position
32; for the read. The default start position is [0, 0, ...].
33;
34; @keyword SHIFT {type=vector}{default=[0, 0,...]}
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 <proidl>shift</proidl> 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
39; created by the STRIDE.
40;
41; @keyword STRIDE {type=vector}{default=[1, 1,...]}
42; An optional vector containing the strides, or sampling
43; intervals, between accessed values of the netCDF variable. The
44; default stride vector is that for a contiguous read, [1, 1,...].
45;
46; @returns
47;  2 different cases:
48;       1) None attribute has been selected. In this case, res is the array we
49;       wanted to read.
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
52;       array and the other arguments are the select arguments.
53;
54; @uses
55; wididbase, infovariable, resultat, motcle
56;
57; @examples
58; IDL> help, xncdf_lec()
59;
60; @history
61; Sebastien Masson (smasson\@lodyc.jussieu.fr)
62;                      24/8/1999
63;
64; @version
65; $Id$
66;-
67FUNCTION xncdf_lec, name, ATT = att, COUNT = count, GROUP = group, OFFSET = offset, IODIR = iodir, SHIFT = shift,  STRIDE = stride, VAR = var
68;
69  compile_opt idl2, strictarrsubs
70;
71   COMMON wididbase, base
72   COMMON infovariable, cdfid, listename, contient, nomdim, tailledim, varid, varcontient
73   COMMON resultat, res
74   COMMON motcle, mcatt, mccount, mcoffset, mciodir, mcshift, mcstride, mcvar
75;------------------------------------------------------------
76; Trick for using keywords (we pass by variables declared in a common)
77;------------------------------------------------------------
78   res = -1
79   if keyword_set(att) then mcatt = att ELSE mcatt = 0
80   if keyword_set(count) then mccount =count  ELSE mccount = 0
81   if keyword_set(offset) then mcoffset = offset ELSE mcoffset = 0
82   if keyword_set(shift) then mcshift = shift ELSE mcshift = 0
83   if keyword_set(stride) then mcstride = stride ELSE mcstride = 0
84   if keyword_set(var) then mcvar = var ELSE mcvar = 0
85;------------------------------------------------------------
86; choice of the file's name
87;------------------------------------------------------------
88; What type of machine is used
89   thisOS = strupcase(strmid(!version.os_family, 0, 3))
90   CASE thisOS of
91      'MAC':sep = ':'
92      'WIN':sep = '\'
93      ELSE: sep = '/'
94   ENDCASE
95; If IODIR is not defined, we initialize it at the current directory
96   if NOT keyword_set(iodir) then cd,  current = iodir
97   mciodir = iodir
98; We complete IODIR with a separating character if needed.
99   IF rstrpos(iodir, sep) NE strlen(iodir)-1 THEN iodir = iodir+sep
100   if n_elements(name) EQ 0 then BEGIN ; If NAME is not defined, we find one thanks to the program dialog_pickfile.
101      name = dialog_pickfile(filter = iodir+'*.nc')
102      if name[0] EQ '' then return,  -1 ;If we do not have find anything, we go out.
103;We complete NAME by IODIR if NAME does not contain any directory separating character.
104   ENDIF ELSE if strpos(name, sep) EQ -1 then name = iodir+name
105   test = findfile(name)         ; Does the name looked for correspond to a file?
106   while test[0] EQ '' OR n_elements(test) GT 1 do BEGIN ; We look for one as long as it correspond to nothing!
107      test = test[0]
108      name = dialog_pickfile(filter = iodir+'*.nc')
109      if name EQ '' then return,  -1
110      test = findfile(name)
111   endwhile
112;------------------------------------------------------------
113; Opening of the file name.
114;------------------------------------------------------------
115   cdfid=ncdf_open(name)
116   contient=ncdf_inquire(cdfid)
117;------------------------------------------------------------
118; What does this file contain??
119;------------------------------------------------------------
120; Opening of the base window as columns
121   if n_elements(group) EQ 0 then base = widget_base(/column, title='Fichier: '+name, /align_left) $
122   ELSE base = widget_base(/column, title='Fichier: '+name, /align_left, GROUP_LEADER = group)
123; Opening of base sub-windows ;
124;------------------------------------------------------------
125; base 1 title having the file's name
126;------------------------------------------------------------
127   base1 = widget_base(base, /column, /align_center)
128   rien = widget_label(base1, value = 'NetCdf filename', /align_center)
129   rien = widget_text(base1, value = name, /align_center, uvalue=1, /editable) ;File's name we can change
130   rien = widget_label(base1, value = ' ') ; We jump a line
131;------------------------------------------------------------
132; base 2 General informations on the file
133;------------------------------------------------------------
134   base2 = widget_base(base, /column)
135;------------------------------------------------------------
136; Informations on global attributes
137;------------------------------------------------------------
138   if contient.ngatts NE -1 then begin
139      rien = widget_label(base2, value = 'Nombre de attributs globaux: '+ strtrim(contient.ngatts,1), /align_left)
140      for attiq=0,contient.ngatts-1 do BEGIN ; Loop on  the number of global attributes
141         name=ncdf_attname(cdfid,attiq,/global) ;Attribute's name
142         ncdf_attget,cdfid,name,value,/global ;Attribute's value
143         rien = widget_text(base2, value = name+': '+strtrim(string(value),1), xsize = 60, /scroll, /wrap, /align_right)
144      endfor
145      rien = widget_label(base2, value = ' ')
146   endif
147;------------------------------------------------------------
148;  Informations on dimensions
149;------------------------------------------------------------
150   rien = widget_label(base2, value = 'Nombre de dimensions: '+strtrim(contient.ndims,1), /align_left)
151   if contient.recdim NE -1 then begin ;  Loop on  the number of global attributes
152      ncdf_diminq,cdfid,contient.recdim,name,value ; Name and value of the dimension
153      rien = widget_label(base2, value = 'name de la dimension infinie: '+name, /align_left)
154   endif
155;
156   nomdim   =strarr(contient.ndims) ; Vector containing dimensions's name
157   tailledim=lonarr(contient.ndims) ; Vector containing dimensions's value
158   for dimiq=0,contient.ndims-1 do begin ; Loop on the number of dimensions
159      ncdf_diminq,cdfid,dimiq,name,value ; Name and value of the dimension
160      nomdim[dimiq]=name
161      tailledim[dimiq]=value
162      rien = widget_label(base2, value = name+' de taille: '+strtrim(value,1), /align_right)
163   ENDFOR
164   rien = widget_label(base2, value = ' ') ; We jump a line
165;------------------------------------------------------------
166; base 3 choice of the variable
167;------------------------------------------------------------
168   base3 = widget_base(base, /column)
169   rien = widget_label(base3, value = 'Nombre de variables: '+strtrim(contient.nvars,1), /align_left)
170   base31 = widget_base(base3, /row, /align_center)
171;Creation of a listename containing the name of all file's variables
172   listename = strarr(contient.nvars)
173   for varid=0,contient.nvars-1 do begin
174      varcontient=ncdf_varinq(cdfid,varid) ; that the variable contain
175      listename[varid] = varcontient.name
176   endfor
177   rien= widget_label(base31, value = 'variable')
178; Creation of a button with a pop-up menu.
179   base311=widget_droplist(base31,value=listename, uvalue=2)
180   rien = widget_label(base3, value = '')
181;------------------------------------------------------------
182; base 4 button done
183;------------------------------------------------------------
184   base4 = widget_base(base, /row)
185   base42=widget_button(base4,value='done', uvalue=3, /align_right)
186;Execution of the base window and of sub-windows
187   widget_control,base,/realize
188;------------------------------------------------------------
189   xmanager,'xncdf_lec',base
190;------------------------------------------------------------
191;------------------------------------------------------------
192;------------------------------------------------------------
193   return, res
194end
195;
196; La lecture de ce programme se fait de bas en haut:
197;   1) xncdf_lec
198;    -->2) xncdf_lec_event
199;       |--> 3) wid_var
200;            --> wid_var_event
201;
202;+
203;
204; @file_comments
205; Procedure called by xmanager when we press on a button of a second widget created by wid_var.
206;
207; @param EVENT {in}{required}
208; A structure characterizing the type of event which arrive to a widget number1 2
209;
210; @uses
211; wididbase,resultat,infovariable,indicewid,motcle
212;
213; @version
214; $Id$
215;-
216PRO wid_var_event,  event
217;
218  compile_opt idl2, strictarrsubs
219;
220   COMMON wididbase, base
221   COMMON resultat, res
222   COMMON infovariable, cdfid, listename, contient, nomdim, tailledim, varid, varcontient
223   COMMON indicewid_var, widbase1, widbase2111, widbase212, widbase213, selectatt
224   COMMON motcle, mcatt, mccount, mcoffset, mciodir, mcshift, mcstride, mcvar
225;
226; What is the type of event?
227   widget_control, event.id, get_uvalue=uval
228   tailledimvar = tailledim[varcontient.dim]
229   if n_elements(uval) EQ 0 then return
230; case on the type of event.
231   case uval OF
232      1:BEGIN                   ; We change values in the array
233; We check that values put in the array are not totally false.
234         widget_control, widbase1, get_value = table
235; Is it the good type of argument?
236; If the type is wrong, we automatically change it by default values.
237         if event.x GT (size(table))[1] then return
238         if event.y GT (size(table))[2] then return
239         if size(table[event.x, event.y], /type) GE 6 $
240          OR size(table[event.x, event.y], /type) EQ 0 then BEGIN
241            if event.x EQ 1 then $
242             widget_control, widbase1, use_table_select = [1, event.y,1, event.y] $
243             , set_value = tailledimvar[event.y] $
244            ELSE widget_control, widbase1 $
245             , use_table_select = [event.x, event.y, event.x, event.y], set_value = 0
246         endif
247; Argument with a wrong name value?
248         table = fix(table)
249         case event.x of
250            0:BEGIN             ; We touched the offset
251               if table[0, event.y] LT 0 then BEGIN
252                  table[0, event.y] = 0
253                  widget_control, widbase1, use_table_select = [0, event.y, 0, event.y] $
254                   , set_value = 0
255              endif
256; If it exceed the dimension of the array, we put it at the max and the cont at 1.
257               if table[0, event.y] GT tailledimvar[event.y]/table[3, event.y] then begin
258                  widget_control, widbase1, use_table_select = [0, event.y,1, event.y] $
259                   , set_value = [tailledimvar[event.y]/table[3, event.y], 1]
260              ENDIF ELSE BEGIN
261; If, with the new offset, the cont is too big, we reduce it  until it goes well!
262                  if table[1, event.y] GT $
263                   (tailledimvar[event.y]/table[3, event.y])-table[0, event.y] then begin
264                     widget_control, widbase1, use_table_select = [1, event.y, 1, event.y] $
265                      , set_value = (tailledimvar[event.y]/table[3, event.y])-table[0, event.y]
266                  endif
267               ENDELSE
268            END
269            1:BEGIN             ;We touched the cont.
270               if table[1, event.y] LT 1 then BEGIN
271                  table[1, event.y] = 1
272                  widget_control, widbase1, use_table_select = [1, event.y, 1, event.y] $
273                   , set_value = 1
274               endif
275; If it is too big, we reduce it  until it goes well!
276               if table[1, event.y] GT $
277                (tailledimvar[event.y]/table[3, event.y])-table[0, event.y] then BEGIN
278                  widget_control, widbase1, use_table_select = [1, event.y, 1, event.y] $
279                   , set_value = (tailledimvar[event.y]/table[3, event.y])-table[0, event.y]
280               endif
281            END
282            2:BEGIN             ;We touched the shift.
283               widget_control, widbase1, use_table_select = [2, event.y, 2, event.y] $
284                , set_value = table[2, event.y] MOD (tailledimvar[event.y]/table[3, event.y])
285            END
286            3:BEGIN             ;We touched the stride.
287               if table[3, event.y] LT 1 then BEGIN
288                  table[3, event.y] = 1
289                  widget_control, widbase1, use_table_select = [3, event.y, 3, event.y] $
290                   , set_value = 1
291               endif
292               if table[3, event.y] EQ 0 then $ ;It must not be null.
293                widget_control, widbase1, use_table_select = [3, event.y, 3, event.y] $
294                , set_value = 1
295; It must not be too big.
296               if table[3, event.y] GT tailledimvar[event.y] then $
297                widget_control, widbase1, use_table_select = [0, event.y,3, event.y] $
298                , set_value = [0, 1, 0, tailledimvar[event.y]] $
299               ELSE BEGIN
300                  if table[1, event.y] GT $
301                   (tailledimvar[event.y]/table[3, event.y])-table[0, event.y] then begin
302                     widget_control, widbase1, use_table_select = [1, event.y, 1, event.y] $
303                      , set_value = (tailledimvar[event.y]/table[3, event.y])-table[0, event.y]
304                  endif
305               ENDELSE
306            END
307            ELSE:
308         endcase
309      END
310      2111:BEGIN                ;We touched buttons yes/no
311; We update the vector selectatt at 0 or 1 for the concerned attribute (number event.id).
312         selectatt[where(widbase2111 EQ event.id)] = event.select
313      end
314      31:BEGIN                  ;We pressed on 'get'
315         widget_control, widbase1, get_value = table
316         table = fix(table)
317         mcshift = where(table[2, *] NE 0)
318         mcoffset = table[0, *]
319         mccount = table[1, *]
320         mcstride = table[3, *]
321         if mcshift[0] NE -1 then BEGIN ; There are some shifts.
322; We read the wholeness of dimensions for which ones there is a shift.
323            mcoffset[mcshift] = 0
324            mccount[mcshift] = tailledimvar[mcshift]
325; We do not activate stride when there is no need because it makes write something weird on the screen.
326            if total(mcstride) EQ n_elements(mcstride) then $
327             ncdf_varget, cdfid, varid, res, OFFSET = mcoffset, COUNT = mccount $
328            ELSE $
329             ncdf_varget, cdfid, varid, res, OFFSET = mcoffset, COUNT = mccount, STRIDE = mcstride
330; To do the shift
331            mcshift = table[2, *]
332            mcoffset = table[0, *]
333            mccount = table[1, *]
334; We define the command allowing to do a shift.
335            commande = 'res=shift(res'
336            for dim = 0, varcontient.ndims-1 do commande = commande+','+string(table[2,dim])
337            commande = commande+')'
338            rien = execute(commande)
339; We redefine the command allowing to cut dimensions which has not been cut yet (ones we shift).
340            commande = 'res=res[' ; initialization of the command
341            for dim = 0, varcontient.ndims-1 do BEGIN
342               if mcshift[dim] EQ 0 then commande = commande+'*,' $
343               ELSE commande=commande+string(mcoffset[dim])+':'+string(mccount[dim]+mcoffset[dim]-1)+','
344            ENDFOR
345            commande = strmid(commande, 0, strlen(commande)-1)+']'
346            rien = execute(commande)
347; Case without shift, we read directly the good part of the array.
348         ENDIF ELSE BEGIN
349            if total(mcstride) EQ n_elements(mcstride) then $
350             ncdf_varget, cdfid, varid, res, OFFSET = mcoffset, COUNT = mccount $
351            ELSE $
352             ncdf_varget, cdfid, varid, res, OFFSET = mcoffset, COUNT = mccount, STRIDE = mcstride
353         ENDELSE
354; Do we have to constitute a structure with selected attributes.
355         if total(selectatt) NE 0 then BEGIN ; There are selected attributes
356            res = create_struct(varcontient.name, res) ; We create the structure
357            selectatt = where(selectatt EQ 1) ; We find selected attributes
358            for attid = 0,  n_elements(selectatt)-1 do BEGIN ; for which we take
359               widget_control, widbase212[selectatt[attid]], get_value = attname ; the name
360               widget_control, widbase213[selectatt[attid]], get_value = attvalue ; the value
361              res = create_struct(res, attname[0], attvalue[0]) ; We concatenate the structure
362            endfor
363         endif
364         widget_control, event.top, /destroy ;We shut the second widget.
365         widget_control, base, /destroy ;We shut the first widget.
366         ncdf_close,cdfid
367      END
368      32:                       ;Case of the display of a held (with xdisplayfile)
369      33:widget_control, event.top, /destroy ;We shut the second widget.
370      ELSE:
371   endcase
372   return
373end
374;
375;+
376;
377; @file_comments
378; This procedure manage the second created widget when we call xncdf_lec.
379; This widget concern the reading of the variable.
380;
381; @param WIDID_PERE {type=scalar}{in}{required}
382; It contains the identity of the father widget which was
383; created by xncdf_lec and which has allowed to select the variable to be read.
384;
385; @results
386; indirectement res (le tableau ou la structure resultat)
387;
388; @uses
389; resultat,infovariable,indicewid_var,motcle
390;
391; @version
392; $Id$
393;-
394PRO wid_var, widid_pere
395;
396  compile_opt idl2, strictarrsubs
397;
398   COMMON resultat, res
399   COMMON infovariable, cdfid, listename, contient, nomdim, tailledim, varid, varcontient
400   COMMON indicewid_var, widbase1, widbase2111, widbase212, widbase213, selectatt
401   COMMON motcle, mcatt, mccount, mcoffset, mciodir, mcshift, mcstride, mcvar
402   res = -1
403;------------------------------------------------------------
404; Opening of the base window as columns.
405   widbase = widget_base(/column, title='variable: '+varcontient.name, /align_center, group_leader = widid_pere)
406;------------------------------------------------------------
407; Opening of the base subwindow
408;------------------------------------------------------------
409; widbase1 array of offsets
410;------------------------------------------------------------
411   rien = widget_label(widbase, value = ' ') ; We jump a line
412; Definition of labels of lines of the array
413   rowlab = string(tailledim[varcontient.dim])
414   for i = 0,  n_elements(rowlab)-1 do rowlab[i] = strtrim(rowlab[i], 1)
415   rowlab = nomdim[varcontient.dim]+replicate(': ', n_elements(varcontient.dim))+rowlab
416; Definition of array's initial values
417   valinit = lonarr(4, n_elements(varcontient.dim))
418; column 0 : offsets
419   if keyword_set(mcoffset) AND n_elements(mcoffset) EQ varcontient.ndims THEN $
420    valinit[0,*]=mcoffset ELSE valinit[0, *] = 0
421; colomn 1 : counts
422   if keyword_set(mccount) AND n_elements(mccount) EQ varcontient.ndims THEN  $
423    valinit[1,*]=mccount ELSE valinit[1, *] = tailledim[varcontient.dim]
424; column 2 : shifts
425   if keyword_set(mcshift) AND n_elements(mcshift) EQ varcontient.ndims THEN $
426    valinit[2,*]=mcshift ELSE valinit[2, *] = 0
427; column 3 : strides
428   if keyword_set(mcstride) AND n_elements(mcstride) EQ varcontient.ndims THEN $
429    valinit[3,*]=mcstride ELSE valinit[3, *] = 1
430; test of initial values of the array
431   valinit = fix(valinit)
432   valinit[3, *] = 1 > valinit[3, *] < tailledim[varcontient.dim] ; test of strides
433   valinit[0, *] = 0 > valinit[0, *] < tailledim[varcontient.dim] ; test of offsets
434; test of counts
435   valinit[1, *] = 1 > valinit[1, *] < ((tailledim[varcontient.dim]/valinit[3, *])-valinit[0, *])
436   valinit[2, *] = valinit[2, *] MOD (tailledim[varcontient.dim]/valinit[3, *]) ; test of shifts
437; declaration of the array
438   widbase1 = widget_table(widbase, row_labels = rowlab, value = valinit, /editable $
439                           , column_labels = ['Offset', 'Count', 'Shift', 'Stride'], uvalue = 1)
440; un petit blabla
441   rien = widget_label(widbase, value = 'ATTENTION: Faire des ''return'' pour que les valeurs', /align_center)
442   rien = widget_label(widbase, value = 'du tableau ou des textes soient bien prises en compte', /align_center)
443;------------------------------------------------------------
444; widbase2 choice of attributes
445;------------------------------------------------------------
446   rien = widget_label(widbase, value = ' ') ; We jump a line
447   widbase2 = widget_base(widbase, /column)
448; To each attribute, we created a widget (widbase21) containing in line a button
449; yes/no (widbase211), and two widget text (widbase212, widbase213) comprising the
450; name and the value of the attribute.
451   widbase21 = lonarr(varcontient.natts)
452   widbase211 = lonarr(varcontient.natts)
453   widbase2111 = lonarr(varcontient.natts)
454; Vector which will serve to know which yes/no are selected. see. wid_var_event
455   selectatt = lonarr(varcontient.natts)
456   selectatt[*] = 0
457   widbase212 = lonarr(varcontient.natts)
458   widbase213 = lonarr(varcontient.natts)
459   for attid = 0, varcontient.natts-1 do BEGIN ;Loop on the number of attribute.
460      widbase21[attid] = widget_base(widbase2, /row)
461      name=ncdf_attname(cdfid,varid,attid)
462      ncdf_attget,cdfid,varid,name,value
463      widbase211[attid] = widget_base(widbase21[attid], /nonexclusive)
464      widbase2111[attid]  = widget_button(widbase211[attid], value = ' ', uvalue = 2111)
465      widbase212[attid] = widget_text(widbase21[attid], value = name, /editable)
466      widbase213[attid] = widget_text(widbase21[attid], value=strtrim(string(value),1), /editable)
467   endfor
468;------------------------------------------------------------
469; widbase3 buttons of the bottom.
470;------------------------------------------------------------
471   widbase3 = widget_base(widbase, /row,/align_center)
472   widbase31=widget_button(widbase3,value='GET', uvalue=31)
473   widbase32=widget_button(widbase3,value='Help', uvalue=32)
474   widbase33=widget_button(widbase3,value='DONE', uvalue=33)
475;------------------------------------------------------------
476;execution of the base window and of sub-window.
477;------------------------------------------------------------
478   widget_control,widbase,/realize
479;------------------------------------------------------------
480   xmanager,'wid_var',widbase
481   return
482end
483;
484;+
485;
486; @file_comments
487; Procedure called by xmanager when we press a button of the first widget
488; created by par xncdf_lec
489;
490; @param EVENT
491; A structure characterising the event type which arrive at the widget number 1.
492;
493; @uses
494; resultat, infovariable, motcle
495;
496; @version
497; $Id$
498;-
499PRO xncdf_lec_event, event
500;
501  compile_opt idl2, strictarrsubs
502;
503   COMMON resultat, res
504   COMMON infovariable, cdfid, listename, contient, nomdim, tailledim, varid, varcontient
505   COMMON motcle, mcatt, mccount, mcoffset, mciodir, mcshift, mcstride, mcvar
506; What is the type of event?
507   widget_control, event.id, get_uvalue=uval
508; case on the type of event.
509   case uval of
510      1:BEGIN                   ; We want to read an other file
511         widget_control, event.id, get_value = nom ; We recuperate the name.
512         widget_control, event.top, /destroy ;We shut the widget.
513         ncdf_close,cdfid       ;We shut the wrong file which has been opened.
514;We call back xncdf_lec
515         res = xncdf_lec(nom[0], ATT = mcatt, COUNT = mccount, OFFSET = mcoffset, IODIR = mciodir $
516                         , SHIFT = mcshift,  STRIDE = mcstride, VAR = mcvar)
517         return
518      END
519      2:BEGIN                   ; A variable is selected.
520         varid = event.index    ; We recuperat its number in the file Netcdf
521         varcontient = ncdf_varinq(cdfid,varid)
522         wid_var, event.top     ; We call the program which launch the second widget. See sooner.
523      END
524      3:BEGIN                   ; button done
525         widget_control, event.top, /destroy ; We delete the widget
526         ncdf_close,cdfid       ; We shut the file.
527      END
528      ELSE:
529   endcase
530   return
531end
Note: See TracBrowser for help on using the repository browser.