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

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

typo

  • 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, IODIR = iodir, SHIFT = shift,  STRIDE = stride, VAR = var
69;
70  compile_opt idl2, strictarrsubs
71;
72   COMMON wididbase, base
73   COMMON infovariable, cdfid, listename, contient, nomdim, tailledim, varid, varcontient
74   COMMON resultat, res
75   COMMON motcle, mcatt, mccount, mcoffset, mciodir, mcshift, mcstride, mcvar
76;------------------------------------------------------------
77; Trick for using keywords (we pass by variables declared in a common)
78;------------------------------------------------------------
79   res = -1
80   if keyword_set(att) then mcatt = att ELSE mcatt = 0
81   if keyword_set(count) then mccount =count  ELSE mccount = 0
82   if keyword_set(offset) then mcoffset = offset ELSE mcoffset = 0
83   if keyword_set(shift) then mcshift = shift ELSE mcshift = 0
84   if keyword_set(stride) then mcstride = stride ELSE mcstride = 0
85   if keyword_set(var) then mcvar = var ELSE mcvar = 0
86;------------------------------------------------------------
87; choice of the file's name
88;------------------------------------------------------------
89; What type of machine is used
90   thisOS = strupcase(strmid(!version.os_family, 0, 3))
91   CASE thisOS of
92      'MAC':sep = ':'
93      'WIN':sep = '\'
94      ELSE: sep = '/'
95   ENDCASE
96; If IODIR is not defined, we initialize it at the current directory
97   if NOT keyword_set(iodir) then cd,  current = iodir
98   mciodir = iodir
99; We complete IODIR with a separating character if needed.
100   IF rstrpos(iodir, sep) NE strlen(iodir)-1 THEN iodir = iodir+sep
101   if n_elements(name) EQ 0 then BEGIN ; If NAME is not defined, we find one thanks to the program dialog_pickfile.
102      name = dialog_pickfile(filter = iodir+'*.nc')
103      if name[0] EQ '' then return,  -1 ;If we do not have find anything, we go out.
104;We complete NAME by IODIR if NAME does not contain any directory separating character.
105   ENDIF ELSE if strpos(name, sep) EQ -1 then name = iodir+name
106   test = findfile(name)         ; Does the name looked for correspond to a file?
107   while test[0] EQ '' OR n_elements(test) GT 1 do BEGIN ; We look for one as long as it correspond to nothing!
108      test = test[0]
109      name = dialog_pickfile(filter = iodir+'*.nc')
110      if name EQ '' then return,  -1
111      test = findfile(name)
112   endwhile
113;------------------------------------------------------------
114; Opening of the file name.
115;------------------------------------------------------------
116   cdfid=ncdf_open(name)
117   contient=ncdf_inquire(cdfid)
118;------------------------------------------------------------
119; What does this file contain??
120;------------------------------------------------------------
121; Opening of the base window as columns
122   if n_elements(group) EQ 0 then base = widget_base(/column, title='Fichier: '+name, /align_left) $
123   ELSE base = widget_base(/column, title='Fichier: '+name, /align_left, GROUP_LEADER = group)
124; Opening of base sub-windows ;
125;------------------------------------------------------------
126; base 1 title having the file's name
127;------------------------------------------------------------
128   base1 = widget_base(base, /column, /align_center)
129   rien = widget_label(base1, value = 'NetCdf filename', /align_center)
130   rien = widget_text(base1, value = name, /align_center, uvalue=1, /editable) ;File's name we can change
131   rien = widget_label(base1, value = ' ') ; We jump a line
132;------------------------------------------------------------
133; base 2 General informations on the file
134;------------------------------------------------------------
135   base2 = widget_base(base, /column)
136;------------------------------------------------------------
137; Informations on global attributes
138;------------------------------------------------------------
139   if contient.ngatts NE -1 then begin
140      rien = widget_label(base2, value = 'Nombre de attributs globaux: '+ strtrim(contient.ngatts,1), /align_left)
141      for attiq=0,contient.ngatts-1 do BEGIN ; Loop on  the number of global attributes
142         name=ncdf_attname(cdfid,attiq,/global) ;Attribute's name
143         ncdf_attget,cdfid,name,value,/global ;Attribute's value
144         rien = widget_text(base2, value = name+': '+strtrim(string(value),1), xsize = 60, /scroll, /wrap, /align_right)
145      endfor
146      rien = widget_label(base2, value = ' ')
147   endif
148;------------------------------------------------------------
149;  Informations on dimensions
150;------------------------------------------------------------
151   rien = widget_label(base2, value = 'Nombre de dimensions: '+strtrim(contient.ndims,1), /align_left)
152   if contient.recdim NE -1 then begin ;  Loop on  the number of global attributes
153      ncdf_diminq,cdfid,contient.recdim,name,value ; Name and value of the dimension
154      rien = widget_label(base2, value = 'name de la dimension infinie: '+name, /align_left)
155   endif
156;
157   nomdim   =strarr(contient.ndims) ; Vector containing dimensions's name
158   tailledim=lonarr(contient.ndims) ; Vector containing dimensions's value
159   for dimiq=0,contient.ndims-1 do begin ; Loop on the number of dimensions
160      ncdf_diminq,cdfid,dimiq,name,value ; Name and value of the dimension
161      nomdim[dimiq]=name
162      tailledim[dimiq]=value
163      rien = widget_label(base2, value = name+' de taille: '+strtrim(value,1), /align_right)
164   ENDFOR
165   rien = widget_label(base2, value = ' ') ; We jump a line
166;------------------------------------------------------------
167; base 3 choice of the variable
168;------------------------------------------------------------
169   base3 = widget_base(base, /column)
170   rien = widget_label(base3, value = 'Nombre de variables: '+strtrim(contient.nvars,1), /align_left)
171   base31 = widget_base(base3, /row, /align_center)
172;Creation of a listename containing the name of all file's variables
173   listename = strarr(contient.nvars)
174   for varid=0,contient.nvars-1 do begin
175      varcontient=ncdf_varinq(cdfid,varid) ; that the variable contain
176      listename[varid] = varcontient.name
177   endfor
178   rien= widget_label(base31, value = 'variable')
179; Creation of a button with a pop-up menu.
180   base311=widget_droplist(base31,value=listename, uvalue=2)
181   rien = widget_label(base3, value = '')
182;------------------------------------------------------------
183; base 4 button done
184;------------------------------------------------------------
185   base4 = widget_base(base, /row)
186   base42=widget_button(base4,value='done', uvalue=3, /align_right)
187;Execution of the base window and of sub-windows
188   widget_control,base,/realize
189;------------------------------------------------------------
190   xmanager,'xncdf_lec',base
191;------------------------------------------------------------
192;------------------------------------------------------------
193;------------------------------------------------------------
194   return, res
195end
196;
197; La lecture de ce programme se fait de bas en haut:
198;   1) xncdf_lec
199;    -->2) xncdf_lec_event
200;       |--> 3) wid_var
201;            --> wid_var_event
202;
203;+
204;
205; @file_comments
206; Procedure called by xmanager when we press on a button of a second widget created by wid_var.
207;
208; @param EVENT {in}{required}
209; A structure characterizing the type of event which arrive to a widget number1 2
210;
211; @uses
212; wididbase,resultat,infovariable,indicewid,motcle
213;
214; @version
215; $Id$
216;-
217;
218PRO wid_var_event,  event
219;
220  compile_opt idl2, strictarrsubs
221;
222   COMMON wididbase, base
223   COMMON resultat, res
224   COMMON infovariable, cdfid, listename, contient, nomdim, tailledim, varid, varcontient
225   COMMON indicewid_var, widbase1, widbase2111, widbase212, widbase213, selectatt
226   COMMON motcle, mcatt, mccount, mcoffset, mciodir, mcshift, mcstride, mcvar
227;
228; What is the type of event?
229   widget_control, event.id, get_uvalue=uval
230   tailledimvar = tailledim[varcontient.dim]
231   if n_elements(uval) EQ 0 then return
232; case on the type of event.
233   case uval OF
234      1:BEGIN                   ; We change values in the array
235; We check that values put in the array are not totally false.
236         widget_control, widbase1, get_value = table
237; Is it the good type of argument?
238; If the type is wrong, we automatically change it by default values.
239         if event.x GT (size(table))[1] then return
240         if event.y GT (size(table))[2] then return
241         if size(table[event.x, event.y], /type) GE 6 $
242          OR size(table[event.x, event.y], /type) EQ 0 then BEGIN
243            if event.x EQ 1 then $
244             widget_control, widbase1, use_table_select = [1, event.y,1, event.y] $
245             , set_value = tailledimvar[event.y] $
246            ELSE widget_control, widbase1 $
247             , use_table_select = [event.x, event.y, event.x, event.y], set_value = 0
248         endif
249; Argument with a wrong name value?
250         table = fix(table)
251         case event.x of
252            0:BEGIN             ; We touched the offset
253               if table[0, event.y] LT 0 then BEGIN
254                  table[0, event.y] = 0
255                  widget_control, widbase1, use_table_select = [0, event.y, 0, event.y] $
256                   , set_value = 0
257              endif
258; If it exceed the dimension of the array, we put it at the max and the cont at 1.
259               if table[0, event.y] GT tailledimvar[event.y]/table[3, event.y] then begin
260                  widget_control, widbase1, use_table_select = [0, event.y,1, event.y] $
261                   , set_value = [tailledimvar[event.y]/table[3, event.y], 1]
262              ENDIF ELSE BEGIN
263; If, with the new offset, the cont is too big, we reduce it  until it goes well!
264                  if table[1, event.y] GT $
265                   (tailledimvar[event.y]/table[3, event.y])-table[0, event.y] then begin
266                     widget_control, widbase1, use_table_select = [1, event.y, 1, event.y] $
267                      , set_value = (tailledimvar[event.y]/table[3, event.y])-table[0, event.y]
268                  endif
269               ENDELSE
270            END
271            1:BEGIN             ;We touched the cont.
272               if table[1, event.y] LT 1 then BEGIN
273                  table[1, event.y] = 1
274                  widget_control, widbase1, use_table_select = [1, event.y, 1, event.y] $
275                   , set_value = 1
276               endif
277; If it is too big, we reduce it  until it goes well!
278               if table[1, event.y] GT $
279                (tailledimvar[event.y]/table[3, event.y])-table[0, event.y] then BEGIN
280                  widget_control, widbase1, use_table_select = [1, event.y, 1, event.y] $
281                   , set_value = (tailledimvar[event.y]/table[3, event.y])-table[0, event.y]
282               endif
283            END
284            2:BEGIN             ;We touched the shift.
285               widget_control, widbase1, use_table_select = [2, event.y, 2, event.y] $
286                , set_value = table[2, event.y] MOD (tailledimvar[event.y]/table[3, event.y])
287            END
288            3:BEGIN             ;We touched the stride.
289               if table[3, event.y] LT 1 then BEGIN
290                  table[3, event.y] = 1
291                  widget_control, widbase1, use_table_select = [3, event.y, 3, event.y] $
292                   , set_value = 1
293               endif
294               if table[3, event.y] EQ 0 then $ ;It must not be null.
295                widget_control, widbase1, use_table_select = [3, event.y, 3, event.y] $
296                , set_value = 1
297; It must not be too big.
298               if table[3, event.y] GT tailledimvar[event.y] then $
299                widget_control, widbase1, use_table_select = [0, event.y,3, event.y] $
300                , set_value = [0, 1, 0, tailledimvar[event.y]] $
301               ELSE BEGIN
302                  if table[1, event.y] GT $
303                   (tailledimvar[event.y]/table[3, event.y])-table[0, event.y] then begin
304                     widget_control, widbase1, use_table_select = [1, event.y, 1, event.y] $
305                      , set_value = (tailledimvar[event.y]/table[3, event.y])-table[0, event.y]
306                  endif
307               ENDELSE
308            END
309            ELSE:
310         endcase
311      END
312      2111:BEGIN                ;We touched buttons yes/no
313; We update the vector selectatt at 0 or 1 for the concerned attribute (number event.id).
314         selectatt[where(widbase2111 EQ event.id)] = event.select
315      end
316      31:BEGIN                  ;We pressed on 'get'
317         widget_control, widbase1, get_value = table
318         table = fix(table)
319         mcshift = where(table[2, *] NE 0)
320         mcoffset = table[0, *]
321         mccount = table[1, *]
322         mcstride = table[3, *]
323         if mcshift[0] NE -1 then BEGIN ; There are some shifts.
324; We read the wholeness of dimensions for which ones there is a shift.
325            mcoffset[mcshift] = 0
326            mccount[mcshift] = tailledimvar[mcshift]
327; We do not activate stride when there is no need because it makes write something weird on the screen.
328            if total(mcstride) EQ n_elements(mcstride) then $
329             ncdf_varget, cdfid, varid, res, OFFSET = mcoffset, COUNT = mccount $
330            ELSE $
331             ncdf_varget, cdfid, varid, res, OFFSET = mcoffset, COUNT = mccount, STRIDE = mcstride
332; To do the shift
333            mcshift = table[2, *]
334            mcoffset = table[0, *]
335            mccount = table[1, *]
336; We define the command allowing to do a shift.
337            commande = 'res=shift(res'
338            for dim = 0, varcontient.ndims-1 do commande = commande+','+string(table[2,dim])
339            commande = commande+')'
340            rien = execute(commande)
341; We redefine the command allowing to cut dimensions which has not been cut yet (ones we shift).
342            commande = 'res=res[' ; initialization of the command
343            for dim = 0, varcontient.ndims-1 do BEGIN
344               if mcshift[dim] EQ 0 then commande = commande+'*,' $
345               ELSE commande=commande+string(mcoffset[dim])+':'+string(mccount[dim]+mcoffset[dim]-1)+','
346            ENDFOR
347            commande = strmid(commande, 0, strlen(commande)-1)+']'
348            rien = execute(commande)
349; Case without shift, we read directly the good part of the array.
350         ENDIF ELSE BEGIN
351            if total(mcstride) EQ n_elements(mcstride) then $
352             ncdf_varget, cdfid, varid, res, OFFSET = mcoffset, COUNT = mccount $
353            ELSE $
354             ncdf_varget, cdfid, varid, res, OFFSET = mcoffset, COUNT = mccount, STRIDE = mcstride
355         ENDELSE
356; Do we have to constitute a structure with selected attributes.
357         if total(selectatt) NE 0 then BEGIN ; There are selected attributes
358            res = create_struct(varcontient.name, res) ; We create the structure
359            selectatt = where(selectatt EQ 1) ; We find selected attributes
360            for attid = 0,  n_elements(selectatt)-1 do BEGIN ; for which we take
361               widget_control, widbase212[selectatt[attid]], get_value = attname ; the name
362               widget_control, widbase213[selectatt[attid]], get_value = attvalue ; the value
363              res = create_struct(res, attname[0], attvalue[0]) ; We concatenate the structure
364            endfor
365         endif
366         widget_control, event.top, /destroy ;We shut the second widget.
367         widget_control, base, /destroy ;We shut the first widget.
368         ncdf_close,cdfid
369      END
370      32:                       ;Case of the display of a held (with xdisplayfile)
371      33:widget_control, event.top, /destroy ;We shut the second widget.
372      ELSE:
373   endcase
374   return
375end
376;
377;+
378;
379; @file_comments
380; This procedure manage the second created widget when we call xncdf_lec.
381; This widget concern the reading of the variable.
382;
383; @param WIDID_PERE {type=scalar}{in}{required}
384; It contains the identity of the father widget which was
385; created by xncdf_lec and which has allowed to select the variable to be read.
386;
387; @results
388; indirectement res (le tableau ou la structure resultat)
389;
390; @uses
391; resultat,infovariable,indicewid_var,motcle
392;
393; @version
394; $Id$
395;-
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 par 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.