pro nwin
end
function cdfx_time_string_of_epoch, epoch
cdf_epoch, epoch, yr, mo, day, hr, mi, sec, mil,/break
return, string(yr, mo, day, hr, mi, sec, mil,$
format='(i4.4,"/",i2.2,"/",i2.2," ",i2.2,":",i2.2,":",i2.2,".",i3.3)')
end
function cdfx_uniq_sort, array
return, array[uniq(array, sort(array))]
end
function determine_dataobject_letter
common cdfxcom, CDFxwindows, CDFxprefs
w = where(strpos(cdfxwindows.title,'Data Object') ne -1,wc)
if wc eq 0 then return, 'A'
b = bytarr(wc)
for i=0,wc-1 do begin
b[i] = byte(strtrim(strmid(cdfxwindows.title[w[i]],11,8),2))
endfor
p = bindgen(26) & p = p + 65B
for i=0,wc-1 do begin
w = where(p ne b[i])
p = p[w]
endfor
return, string(p[0])
end
function cdfx_prune_struct, s, usertag
sr = -1
tnames = tag_names(s)
ss=parse_mydepend0(s)
tn=tag_names(ss)
utag=where(tnames eq strupcase(usertag))
tags_utag=tag_names(s.(utag[0]))
dep0=-1
dep1=-1
dep2=-1
if (where(tags_utag eq 'DEPEND_0') ne -1) then dep0=s.(utag[0]).depend_0
q=where(tn eq strupcase(dep0))
ss=ss.(q[0])
if (where(tags_utag eq 'DEPEND_1') ne -1) then dep1=s.(utag[0]).depend_1
if (where(tags_utag eq 'DEPEND_2') ne -1) then dep2=s.(utag[0]).depend_2
alt = tagindex('ALT_CDAWEB_DEPEND_1',tags_utag)
if (alt[0] ne -1) then if (s.(utag[0]).ALT_CDAWEB_DEPEND_1 ne '') then dep1 = s.(utag[0]).ALT_CDAWEB_DEPEND_1
alt = tagindex('ALT_CDAWEB_DEPEND_2',tags_utag)
if (alt[0] ne -1) then if (s.(utag[0]).ALT_CDAWEB_DEPEND_2 ne '') then dep2 = s.(utag[0]).ALT_CDAWEB_DEPEND_2
for i=0, n_tags(s)-1 do begin
tname = tnames[i]
if ((tname eq strupcase(usertag)) or (tname eq strupcase(dep0)) or (tname eq strupcase(dep1)) $
or (tname eq strupcase(dep2))) then begin
if (size(sr))[0] eq 0 then $
sr = create_struct(tname, s.(i)) $
else $
sr = create_struct(sr, tname, s.(i))
endif
endfor
return, sr
end
PRO delete_myhandles, a
for i=0, n_elements(tag_names(a))-1 do begin
ti = tagindex('HANDLE', tag_names(a.(i)))
if ti ne -1 then begin
if handle_info(a.(i).HANDLE, /valid_id) then $
handle_free, a.(i).HANDLE
endif
endfor
end
function generate_varlist, a, ALL=ALL
atags = tag_names(a)
vnames = ''
for i=0, n_elements(atags)-1 do begin
btags = tag_names(a.(i))
d='DATA' & f='' & c=''
w = where(btags eq 'VAR_TYPE',wc) & if (wc gt 0) then d = a.(i).(w[0])
w = where(btags eq 'FIELDNAM',wc) & if (wc gt 0) then f = a.(i).(w[0])
w = where(btags eq 'CATDESC',wc) & if (wc gt 0) then c = a.(i).(w[0])
if keyword_set(ALL) or (strupcase(d) eq 'DATA') then begin
if (f eq '') then f = c
if (vnames[0] eq '') then $
vnames[0] = (atags[i] + ' :' + f) $
else $
vnames = [vnames,(atags[i] + ' :' + f)]
endif
endfor
return, vnames
end