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

Last change on this file since 370 was 370, checked in by pinsard, 16 years ago

improvemnts of headers (typo, links)

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