source: trunk/SRC/ToBeReviewed/HOPE/read_hope.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:keywords set to Id
File size: 24.5 KB
Line 
1;+
2;
3; @file_comments
4;
5; @categories
6;
7; @param EVENT
8;
9; @returns
10;
11; @restrictions
12;
13; @examples
14;
15; @history
16;
17; @version
18; $Id$
19;
20;-
21PRO read_hope_event, event
22;
23  compile_opt idl2, strictarrsubs
24;
25   widget_control, event.id, get_uvalue=uval
26   widget_control, event.top, get_uvalue=top_uvalue
27   case uval.name OF
28;---------------------------------
29      'cancel':begin
30; close the file
31         cdfid=*top_uvalue[1, findline(top_uvalue, 'cdfid')]
32         ncdf_close, cdfid
33; clear the pointer
34         for i=0,n_elements(top_uvalue)-1 do ptr_free, top_uvalue[i]
35; kill the widget
36         widget_control,event.top,/destroy
37      end
38;---------------------------------
39      'type choice':begin
40; find the new type of selected section
41         typeindex=widget_info(event.id,/droplist_select)
42         selectedtype=(*top_uvalue[1, findline(top_uvalue, 'type choice')])[typeindex]
43; find the available variables for this type of section
44         sectype = *top_uvalue[1, findline(top_uvalue, 'sectype')]
45         goodvar = where(sectype EQ selectedtype)
46         namevar = *top_uvalue[1, findline(top_uvalue, 'namevar')]
47         goodnamevar = namevar[goodvar]
48; find the selected var name
49         varchoiceid = widget_info(event.top,find_by_uname = 'var choice')
50         varindex = widget_info(varchoiceid,/droplist_select)
51         varchoice = *top_uvalue[1, findline(top_uvalue, 'var choice')]
52         selectedvarname=varchoice[varindex]
53; do we change the variable?
54         if (where(goodnamevar EQ selectedvarname))[0] EQ -1 then begin
55            selectedvarname = goodnamevar[0]
56            varindex = (where(varchoice EQ selectedvarname))[0]
57            widget_control, varchoiceid, set_droplist_select = varindex
58         ENDIF
59; displays the different domains
60         selected = goodvar[where(goodnamevar EQ selectedvarname)]
61         rh_alldomains, event.top, selected
62      end
63;---------------------------------
64      'var choice':BEGIN
65; find the new variable
66         varindex=widget_info(event.id,/droplist_select)
67         selectedvar=(*top_uvalue[1, findline(top_uvalue, 'var choice')])[varindex]
68; find the available variables for this type of section
69         namevar = *top_uvalue[1, findline(top_uvalue, 'namevar')]
70         goodvar = where(namevar EQ selectedvar)
71         sectype = *top_uvalue[1, findline(top_uvalue, 'sectype')]
72         goodtype = sectype[goodvar]
73; find the selected type of section
74         typechoiceid = widget_info(event.top,find_by_uname = 'type choice')
75         typeindex = widget_info(typechoiceid,/droplist_select)
76         typechoice = *top_uvalue[1, findline(top_uvalue, 'type choice')]
77         selectedtype=typechoice[typeindex]
78; do we change the type of section ?
79         if (where(goodtype EQ selectedtype))[0] EQ -1 then begin
80            selectedtype = goodtype[0]
81            typeindex = (where(typechoice EQ selectedtype))[0]
82            widget_control, typechoiceid, set_droplist_select = typeindex
83         ENDIF
84; displays the different domains
85         selected = goodvar[where(goodtype EQ selectedtype)]
86         rh_alldomains, event.top, selected
87      END
88;---------------------------------
89      'plot':BEGIN
90; plot the array
91         res = createhopestruct(event)
92; type of section
93         selected = *top_uvalue[1, findline(top_uvalue, 'selected')]
94         type = (*top_uvalue[1, findline(top_uvalue, 'sectype')])[selected]
95; get the informations of cw_specifie
96         specifieid=widget_info(event.top,find_by_uname = 'specifie')
97         widget_control, specifieid, get_value = specifie
98         specifie = struct2string(specifie,/direct2string)
99         case type of
100            'x':command = 'plt1d,res,''x'','+specifie
101            'y':command = 'plt1d,res,''y'','+specifie
102            'z':command = 'plt1d,res,''z'','+specifie
103            't':command = 'pltt,res,''t'' ,'+specifie
104            'xy':command = 'plt, res,'+specifie
105            'xz':command = 'pltz, res,''xz'','+specifie
106            'yz':command = 'pltz, res,''yz'','+specifie
107            'xt':command = 'pltt,res,''xt'','+specifie
108            'yt':command = 'pltt,res,''yt'','+specifie
109            'zt':command = 'pltt,res,''zt'','+specifie
110            'xyz':
111            'xyt':
112            'yzt':
113            'xyzt':
114         ENDCASE
115         test = execute(command)
116         if test EQ 0 then stop
117      end
118;---------------------------------
119      'linechoice':BEGIN
120         if event.select EQ 1 then begin
121            sensitive = bytarr(3)
122            sensitive[where(['odd', 'even', 'odd-even'] eq event.value)] = 1
123            basedomainodd=widget_info(event.top,find_by_uname = 'basedomainodd')
124            widget_control, basedomainodd, sensitive = sensitive[0]
125            basedomaineven=widget_info(event.top,find_by_uname = 'basedomaineven')
126            widget_control, basedomaineven, sensitive = sensitive[1]
127            basedomainoddeven=widget_info(event.top,find_by_uname = 'basedomainodd-even')
128            widget_control, basedomainoddeven, sensitive = sensitive[2]
129            case (where(sensitive EQ 1))[0] of
130               0:BEGIN
131                  widget_control, basedomainodd, get_uvalue = oddsecchoice
132                  oddsecchoiceid=widget_info(event.top,find_by_uname = 'oddsecchoice')
133                  if oddsecchoiceid NE 0 then $
134                   index = widget_info(oddsecchoiceid, /droplist_select) $
135                  ELSE index = 0
136                  *top_uvalue[1, findline(top_uvalue, 'selected')] = oddsecchoice[index]
137               END
138               1:BEGIN
139                  widget_control, basedomaineven, get_uvalue = evensecchoice
140                  evensecchoiceid=widget_info(event.top,find_by_uname = 'evensecchoice')
141                  if evensecchoiceid NE 0 then $
142                   index = widget_info(evensecchoiceid, /droplist_select) $
143                  ELSE index = 0
144                  *top_uvalue[1, findline(top_uvalue, 'selected')] = evensecchoice[index]
145               END
146               2:BEGIN
147                  widget_control, basedomainodd, get_uvalue = oddevensecchoice
148                  oddevensecchoiceid=widget_info(event.top,find_by_uname = 'odd-evensecchoice')
149                  if oddevensecchoiceid NE 0 then $
150                   index = widget_info(oddevensecchoiceid, /droplist_select) $
151                  ELSE index = 0
152                  *top_uvalue[1, findline(top_uvalue, 'selected')] = oddevensecchoice[index]
153               END
154            endcase
155         endif
156      END
157;---------------------------------
158      'oddsecchoice':BEGIN
159         widget_control, event.top, update=0
160         basedomainodd=widget_info(event.top,find_by_uname = 'basedomainodd')
161         widget_control, basedomainodd, get_uvalue = oddsecchoice
162         domainpart, top_uvalue, basedomainodd, oddsecchoice[event.index]
163         *top_uvalue[1, findline(top_uvalue, 'selected')] = oddsecchoice[event.index]
164         widget_control, event.top, update=1
165      END
166;---------------------------------
167      'evensecchoice':BEGIN
168         widget_control, event.top, update=0
169         basedomaineven=widget_info(event.top,find_by_uname = 'basedomaineven')
170         widget_control, basedomaineven, get_uvalue = evensecchoice
171         domainpart, top_uvalue, basedomaineven, evensecchoice[event.index]
172         *top_uvalue[1, findline(top_uvalue, 'selected')] = evensecchoice[event.index]
173         widget_control, event.top, update=1
174      END
175;---------------------------------
176      'odd-evensecchoice':BEGIN
177         widget_control, event.top, update=0
178         basedomainoddeven=widget_info(event.top,find_by_uname = 'basedomainodd-even')
179         widget_control, basedomainoddeven, get_uvalue = oddevensecchoice
180         domainpart, top_uvalue, basedomainoddeven, oddevensecchoice[event.index]
181         *top_uvalue[1, findline(top_uvalue, 'selected')] = oddevensecchoice[event.index]
182         widget_control, event.top, update=1
183      END
184;---------------------------------
185      'date1':BEGIN
186         date2id = widget_info(event.top, find_by_uname = 'date2')
187         widget_control, date2id, get_value = date2
188         if event.value GT date2 then widget_control, date2id, set_value = event.value
189      END
190;---------------------------------
191      'date2':BEGIN
192         date1id = widget_info(event.top, find_by_uname = 'date1')
193         widget_control, date1id, get_value = date1
194         if event.value LT date1 then widget_control, date1id, set_value = event.value
195      END
196;---------------------------------
197      else:
198   endcase
199   return
200end
201;
202;+
203;
204; @file_comments
205; Read the Hope grid file converted in NetCdf by xconv
206;
207; @categories
208; Reading
209;
210; @param TYPEIN {in}{required}{type=string}
211; A string specifying from which type of section the 4D
212; array based: 'xy, 'xz', 'yz'
213;
214; @param VARNAMEIN {in}{required}{type=string}
215; A string the name of the variable to be read (in
216; lower or upper case)
217;
218; @keyword FILENAME {type=string}
219; The name of the file to be read
220;
221; @keyword XLIMITS {type=vector}
222; A two elements vector [lonmin, lonmax]]
223; the boundary of the longitudes (from 0 to 360)
224;
225; @keyword YLIMITS {type=vector}
226; A two elements vector [latmin, latmax]]
227; the boundary of the latitudes (from -90 to 90)
228;
229; @keyword ZLIMITS {type=vector}
230; A two elements vector [depthmin, depthmax]]
231; the boundary of the depth
232;
233; @keyword TLIMITS {type=vector}
234; A two elements vector [date1, date2]]
235; the boundary of the calendar with date1 and date2
236; following the syntax yyyymmdd
237;
238; @keyword ODDPT
239; Activate to read only the sections located on ODD
240; points
241;
242; @keyword EVENPT
243; Activate to read only the sections located on even
244; points
245;
246; @keyword ODDEVENPT
247; Activate to read only the sections located on
248; both even and odd points (horizontal sections)
249;
250; @keyword _EXTRA
251; Used to pass keywords
252;
253; @returns
254; -1 if typein and varnamein are undefined (this is the widget
255; version)
256;
257; A structure which but be read by <pro>litchamp</pro> and is
258; necessary to complete the grid associated to the data (see
259; the example).
260;
261; @uses
262; common.pro (useful only for the definition of iodir)
263;
264; @restrictions
265; 'x', 'y', 'z', 't', 'xt', 'yt' and 'zt' section not coded, xconv
266; must be able to works with this kind of function.
267; The grid file has no zoom possibilities on horizontal dimensions.
268;
269; @restrictions
270;
271; When typein and varnamein are defined, the method to find the
272; good variable is:
273;  1) find the variables which are available on this type of
274; sections with this name
275;  2) if ODDPT, EVENPT or ODDEVENPT are specified, consider only
276; these types of sections
277;  3) For an XY section the chosen variable is the one which has
278; the most level in the vertical domain specified by ZLIMITS.
279;     For an XZ section the chosen variable is the one which has
280; the most points in the latitude domain specified by YLIMITS.
281;     For an YZ section the chosen variable is the one which has
282; the most points in the longitude domain specified by XLIMITS.
283;
284;
285; @examples
286;
287;     IDL> a=read_hope('xy','ocpt',filename='CLIM_CNT_1993-1998.nc')
288;     IDL> help, a,/struct
289;     ** Structure <82ec344>, 6 tags, length=1860176, refs=1:
290;        ARRAY           FLOAT     Array[128, 242, 15]
291;        UNIT            STRING    'deg C'
292;        NAME            STRING    'Ocean potential temperature'
293;        DATE            FLOAT     Array[1]
294;        GRID            STRING    'T'
295;        HOPEGRID        STRUCT    -> <Anonymous> Array[1]
296;     IDL> help, a.hopegrid,/struct
297;     ** Structure <82eb9cc>, 8 tags, length=1588, refs=2:
298;        XAXIS           FLOAT     Array[128]
299;        YAXIS           FLOAT     Array[242]
300;        ZAXIS           FLOAT     Array[15]
301;        FIRSTS          LONG      Array[3]
302;        LASTS           LONG      Array[3]
303;        TYPE            STRING    'xy'
304;        LINETYPE        STRING    'odd-even'
305;        PTTYPE          STRING    'T'
306;     IDL> help, litchamp(a)
307;     <Expression>    FLOAT     = Array[128, 242, 15]
308;
309; @history
310; Sebastien Masson (smasson\@lodyc.jussieu.fr)
311;                      June 2001
312;
313; @version
314; $Id$
315;
316;-
317FUNCTION read_hope, typein, varnamein, FILENAME = filename, XLIMITS = xlimits, YLIMITS = ylimits,  ZLIMITS = zlimits, TLIMITS = tlimits, ODDPT = oddpt, ODDEVENPT = oddevenpt, EVENPT = evenpt, _EXTRA = ex
318;
319  compile_opt idl2, strictarrsubs
320;
321@common                         ; usefull only for the definition of iodir
322  if n_elements(filename) EQ 0 then filename = isafile(iodirectory = iodir, _extra = ex)
323  IF size(filename, /type) NE 7 THEN return, -1
324  filename = isafile(filename = filename, iodirectory = iodir, _extra = ex)
325;
326  cdfid = ncdf_open(filename)       ; id of the netcdf file
327  wathinside = ncdf_inquire(cdfid)  ; structure with global informations
328;-------------------------------
329;  dimensions
330;-------------------------------
331  namedim = strarr(wathinside.ndims)  ; name of the dimensions
332  typedim = strarr(wathinside.ndims)  ; type of the dimensions (x,y,z,t)
333  sizedim = lonarr(wathinside.ndims)  ; size of each dimension
334; loop on the dimensions to get the names and sizes
335  for dimiq = 0, wathinside.ndims-1 do begin
336    ncdf_diminq, cdfid, dimiq, name, value
337    namedim[dimiq] = name
338    case 1 of
339      STRCMP(name, 'lon', 3, /FOLD_CASE):typedim[dimiq] = 'x'
340      STRCMP(name, 'lat', 3, /FOLD_CASE):typedim[dimiq] = 'y'
341      STRCMP(name, 'z', 1, /FOLD_CASE):typedim[dimiq] = 'z'
342      STRCMP(name, 't', 1, /FOLD_CASE):typedim[dimiq] = 't'
343      ELSE:BEGIN
344        ncdf_close, cdfid
345        return, report('Unknown name of dimension')
346      END
347    endcase
348    sizedim[dimiq] = value
349  endfor
350; dimlist: structure which contains the name and the value of each
351; dimension
352; we suppose that there is always a variable which has the
353; same name that the dimension and which gives the values of
354; this dimension
355  ncdf_varget, cdfid, namedim[0], value
356  dimlist = create_struct(namedim[0], value)
357  for dimiq = 1, wathinside.ndims-1 do begin
358    ncdf_varget, cdfid, namedim[dimiq], value ;get the value
359    dimlist = create_struct(dimlist, namedim[dimiq], value)
360  endfor
361;-------------------------------
362;  variables
363;-------------------------------
364  namevar = strarr(wathinside.nvars)   ; names of the variables
365  ndimsvar = lonarr(wathinside.nvars)  ; number of dim for each variable
366  dimvar = replicate(-1, wathinside.ndims, wathinside.nvars) ; dims of each variables
367; loop over the variable ids to fill namevar, ndimsvar and dimvar
368  for varid = 0, wathinside.nvars-1 do begin
369    res = ncdf_varinq(cdfid, varid)
370    namevar[varid] = res.name
371    namevar[varid] = strjoin(strsplit(namevar[varid], '_[0-99]', /EXTRACT, /REGEX))
372    ndimsvar[varid] = res.ndims
373    dimvar[0:res.ndims-1, varid] = res.dim
374  ENDFOR
375; we cut dimvar to select only the interessant part
376  dimvar = dimvar[0:max(ndimsvar)-1, *]
377; selection of the data variables which are different from the
378; dimension variables
379; we suppose that that data variables are 4D array (with sometime
380; dimensions equal to 1). they must be different from dimension
381; variables which have only 1 dimension
382  datavarid = where(ndimsvar eq 4)
383  numberofvar = n_elements(datavarid)
384  namevar = namevar[datavarid]
385  ndimsvar = ndimsvar[datavarid]
386  dimvar = dimvar[*, datavarid]
387;
388  sectype = strarr(numberofvar) ; the type of section for each variable :'xy', 'xz', 'yz'...
389  linetype = strarr(numberofvar) ; the line of the points : odd, even or odd-even
390  pointtype = strarr(numberofvar) ; the type of variable : scalar ('T') or vector ('U')
391  for i = 0, numberofvar-1 do begin
392    dimofthevar = dimvar[*, i]
393    sectype[i] = typedim[dimofthevar[0]]+typedim[dimofthevar[1]]
394    xaxisid = dimofthevar[where(typedim[dimofthevar] EQ 'x')]
395    yaxisid = dimofthevar[where(typedim[dimofthevar] EQ 'y')]
396    lineandpt = findlineandpointtype(sectype[i], dimlist.(xaxisid[0]), dimlist.(yaxisid[0]), iodir)
397    linetype[i] = lineandpt.linetype
398    pointtype[i] = lineandpt.pointtype
399  endfor
400;
401;---------------------------------------------------
402;---------------------------------------------------
403;---------------------------------------------------
404;  definition of the widget
405;---------------------------------------------------
406;---------------------------------------------------
407;---------------------------------------------------
408  base = widget_base(/column)
409;---------------------------------------------------
410; first base:
411;    droplist to select the type of section
412;    droplist to select the variable
413;    button to select type of line : odd, even or odd-even
414;---------------------------------------------------
415  base1 = widget_base(base, /row, /frame)
416  typechoice = sectype[uniq(sectype, sort(sectype))]
417  if n_elements(typechoice) GT 1 then typechoice = typechoice[sortdim(typechoice)]
418  base11 = widget_droplist(base1, title = 'Type of section', value = typechoice, uvalue = {name:'type choice'}, uname = 'type choice')
419  if n_elements(typein) NE 0 then BEGIN
420    selectedtype = strmid(typein, 0, 2)
421    widget_control, base11, set_droplist_select $
422                    = 0L > (where(typechoice EQ selectedtype))[0]
423  ENDIF ELSE selectedtype = typechoice[0]
424;
425  varchoice = namevar[uniq(namevar, sort(namevar))]
426  base12 = widget_droplist(base1, title = 'Available data', value = varchoice, uvalue = {name:'var choice'}, uname = 'var choice')
427  if n_elements(varnamein) NE 0 THEN BEGIN
428    selectedname = varnamein
429    widget_control, base12, set_droplist_select $
430                    = 0L > (where(strlowcase(varchoice) EQ strlowcase(varnamein)))[0]
431  ENDIF ELSE selectedname = varchoice[0]
432;
433  base13 = widget_base(base1, /row, uname = 'linechoicebase')
434;---------------------------------------------------
435; base 2: base to select the domain of the odd points
436;---------------------------------------------------
437  base2 = widget_base(base, /column, uname = 'basedomainodd', /frame)
438;---------------------------------------------------
439; base 3: base to select the domain of the even points
440;---------------------------------------------------
441  base3 = widget_base(base, /column, uname = 'basedomaineven', /frame)
442;---------------------------------------------------
443; base 4: base to select the domain of the odd-even points
444;---------------------------------------------------
445  base4 = widget_base(base, /column, uname = 'basedomainodd-even', /frame)
446;---------------------------------------------------
447; base 5: calendar
448;---------------------------------------------------
449  base5 = widget_base(base, /row, uname = 'baset', /frame)
450  timename = strlowcase((tag_names(dimlist))[wathinside.recdim])
451; read the time axis in julina days
452  time = ncdf_gettime(filename, cdfid)
453; update the dimlist structure
454  dimlist.(wathinside.recdim) = time
455  base51 = cw_calendar(base5, time, uname = 'date1', uvalue = {name:'date1'})
456  base52 = cw_calendar(base5, time, uname = 'date2', uvalue = {name:'date2'})
457;---------------------------------------------------
458;  base 6: base to select the min, max, ... and others keywords
459;---------------------------------------------------
460  base6 = cw_specifie(base, /column, uname = 'specifie', uvalue = {name:'specifie'})
461;---------------------------------------------------
462;  base 7: last base with the action buttons
463;---------------------------------------------------
464  base7 = widget_base(base, /row, uname = 'finalaction')
465  base71 = widget_button(base7, value = 'Plot', uvalue = {name:'plot'})
466  base72 = widget_button(base7, value = 'Cancel', uvalue = {name:'cancel'})
467;---------------------------------------------------
468; determination of the selected variable ......
469;---------------------------------------------------
470  goodname = 0 > where(strlowcase(namevar) EQ strlowcase(selectedname))
471  goodtype = 0 > where(sectype EQ selectedtype)
472  selected = inter(goodname, goodtype)
473  if selected[0] EQ -1 then BEGIN
474    widget_control, base, /destroy
475    ncdf_close, cdfid
476    return, report('impossible combinaison : type of section '+selectedtype+', variable name '+selectedname)
477  ENDIF
478  if n_elements(typein) NE 0 then BEGIN
479    if NOT keyword_set(xlimits) then xlimits = [-1e9, 1e9]
480    if NOT keyword_set(ylimits) then ylimits = [-1e9, 1e9]
481    if NOT keyword_set(zlimits) then zlimits = [-1e9, 1e9]
482    if NOT keyword_set(tlimits) then tlimits = [-1e9, 1e9]
483  ENDIF
484  if n_elements(typein) NE 0 AND n_elements(selected) NE 1 then BEGIN
485    if keyword_set(oddpt) then selected = inter(selected, where(linetype EQ 'odd'))
486    if keyword_set(evenpt) then selected = inter(selected, where(linetype EQ 'even'))
487    if keyword_set(oddevenpt) then selected = inter(selected, where(linetype EQ 'odd-even'))
488    if selected[0] EQ -1 then BEGIN
489      widget_control, base, /destroy
490      ncdf_close, cdfid
491      return, report('impossible combinaison : type of section '+selectedtype+', variable name '+selectedname+' and line type ')
492    endif
493    if n_elements(selected) NE 1 then begin
494      case selectedtype of
495        'xy':BEGIN
496; choice on the vertical axis
497; choice based on the variable which has the most available levels
498; between the zlimits.
499          if NOT keyword_set(zlimits) then begin
500            print, 'case not coded...'
501            stop
502          ENDIF
503          number = lonarr(n_elements(selected))
504          for i = 0, n_elements(selected)-1 do begin
505            zdim = dimvar[2, selected[i]]
506            zaxis = dimlist.(zdim)
507            nothing = where(zaxis GE zlimits[0] AND zaxis LE zlimits[1], count)
508            number[i] = count
509          ENDFOR
510          selected = selected[where(number EQ max(number))]
511          if n_elements(selected) NE 1 then begin
512            print, 'case not coded...'
513            stop
514          endif
515        END
516        'xz':BEGIN
517; choice on the latitude axis
518          if NOT keyword_set(ylimits) then begin
519            print, 'case not coded...'
520            stop
521          ENDIF
522          number = lonarr(n_elements(selected))
523          for i = 0, n_elements(selected)-1 do begin
524            ydim = dimvar[2, selected[i]]
525            yaxis = dimlist.(ydim)
526            nothing = where(yaxis GE ylimits[0] AND yaxis LE ylimits[1], count)
527            number[i] = count
528          ENDFOR
529          selected = selected[where(number EQ max(number))]
530          if n_elements(selected) NE 1 then begin
531            print, 'case not coded...'
532            stop
533          endif
534        END
535        'yz':BEGIN
536; choice on the longitude axis
537          if NOT keyword_set(xlimits) then begin
538            print, 'case not coded...'
539            stop
540          ENDIF
541          number = lonarr(n_elements(selected))
542          for i = 0, n_elements(selected)-1 do begin
543            xdim = dimvar[2, selected[i]]
544            xaxis = dimlist.(xdim)
545            nothing = where(xaxis GE xlimits[0] AND xaxis LE xlimits[1], count)
546            number[i] = count
547          ENDFOR
548          selected = selected[where(number EQ max(number))]
549          if n_elements(selected) NE 1 then begin
550            print, 'case not coded...'
551            stop
552          endif
553        END
554      endcase
555    endif
556  ENDIF
557;---------------------------------------------------
558; definition of the uvalue of the base which allows to share the
559; variables between programs.
560;---------------------------------------------------
561  top_uvalue = ptrarr(2, 18, /allocate_heap)
562  *top_uvalue[0, 0] = 'type choice' & *top_uvalue[1, 0] = temporary(typechoice)
563  *top_uvalue[0, 1] = 'var choice' & *top_uvalue[1, 1] = temporary(varchoice)
564  *top_uvalue[0, 2] = 'namevar' & *top_uvalue[1, 2] = temporary(namevar)
565  *top_uvalue[0, 3] = 'dimvar' & *top_uvalue[1, 3] = temporary(dimvar)
566  *top_uvalue[0, 4] = 'sectype' & *top_uvalue[1, 4] = temporary(sectype)
567  *top_uvalue[0, 5] = 'linetype' & *top_uvalue[1, 5] = temporary(linetype)
568  *top_uvalue[0, 6] = 'pointtype' & *top_uvalue[1, 6] = temporary(pointtype)
569  *top_uvalue[0, 7] = 'dimlist' & *top_uvalue[1, 7] = temporary(dimlist)
570  *top_uvalue[0, 8] = 'typedim' & *top_uvalue[1, 8] = temporary(typedim)
571  *top_uvalue[0, 9] = 'sizedim' & *top_uvalue[1, 9] = temporary(sizedim)
572  *top_uvalue[0, 10] = 'cdfid' & *top_uvalue[1, 10] = cdfid
573  *top_uvalue[0, 11] = 'datavarid' & *top_uvalue[1, 11] = datavarid
574  *top_uvalue[0, 12] = 'selected' & *top_uvalue[1, 12] = selected
575  *top_uvalue[0, 13] = 'filename' & *top_uvalue[1, 13] = filename
576  *top_uvalue[0, 14] = 'xlimits' & *top_uvalue[1, 14] = testvar(var = xlimits)
577  *top_uvalue[0, 15] = 'ylimits' & *top_uvalue[1, 15] = testvar(var = ylimits)
578  *top_uvalue[0, 16] = 'zlimits' & *top_uvalue[1, 16] = testvar(var = zlimits)
579  *top_uvalue[0, 17] = 'tlimits' & *top_uvalue[1, 17] = testvar(var = tlimits)
580
581
582  widget_control, base, set_uvalue = top_uvalue
583  rh_alldomains, base, selected
584
585  if n_params() EQ 0 then BEGIN
586; we use the widget
587    widget_control, base, /REALIZE
588    xmanager, 'read_hope', base, /no_block
589    return,  -1
590  ENDIF
591; get the output
592  output = createhopestruct({top:base})
593; clear the pointer
594  for i = 0, n_elements(top_uvalue)-1 do ptr_free, top_uvalue[i]
595; close the file
596  ncdf_close, cdfid
597  return, output
598end
Note: See TracBrowser for help on using the repository browser.