FUNCTION ami_mystruct,a
ds = size(a) & nds = n_elements(ds)
if (ds[nds-2] ne 8) then return,0
for i=0,n_elements(tag_names(a))-1 do begin
ds = size(a.(i)) & nds = n_elements(ds)
if (ds[nds-2] ne 8) then return,0
tnames = tag_names(a.(i))
w = where(tnames eq 'VARNAME',wc1) & w = where(tnames eq 'CDFTYPE',wc2)
w = where(tnames eq 'HANDLE' ,wc3) & w = where(tnames eq 'DAT',wc4)
if wc1 eq 0 then return,0
if wc2 eq 0 then return,0
if (wc3 + wc4) ne 1 then return,0
endfor
return,1
end
FUNCTION evaluate_image_struct,a,vname,$
THUMBSIZE=THUMBSIZE,XSIZE=XSIZE,COLORBAR=COLORBAR,$
TSTART=TSTART,TSTOP=TSTOP
if ami_mystruct(a) ne 1 then begin
print,'ERROR:input param not a properly formatted structure' & return,-1
endif
w = where(tag_names(a) eq strupcase(vname),wc)
if (wc eq 0) then begin
print,'ERROR=No variable with the name:',vname,' in structure' & return,-1
endif else vnum = w[0]
tn = tag_names(a.(vnum)) & w = where(tn eq 'DAT',wc)
if wc ne 0 then i = size(a.(vnum).DAT) else i = a.(vnum).idlsize
if i[0] eq 2 then nimages = 1 else nimages = i[i[0]]
firstframe = 0 & lastframe = nimages
tn = tag_names(a.(vnum)) & w = where(tn eq 'DEPEND_0',wc)
if wc ne 0 then begin
tname = a.(vnum).DEPEND_0 & tnum = tagindex(tname,tag_names(a))
endif else begin
print,'ERROR:',vname,' is missing DEPEND_0 vattr to point to timetag'
return,-1
endelse
tn = tag_names(a.(tnum)) & w = where(tn eq 'DAT',wc)
if wc ne 0 then tdat = a.(tnum).DAT else handle_value,a.(tnum).HANDLE,tdat
if (keyword_set(TSTART) or keyword_set(TSTOP)) then begin
if keyword_set(TSTART) then begin
w = where(tdat gt TSTART,wc)
if wc gt 0 then firstframe = w[0] $
else begin
print,'ERROR:No images frames after TSTART.' & return,-1
endelse
endif
if keyword_set(TSTOP) then begin
w = where(tdat le TSOP,wc)
if wc gt 0 then lastframe = w[wc-1] $
else begin
print,'ERROR:No images frames before TSTOP.' & return,-1
endelse
endif
nimages = lastframe - firstframe & t = 0
endif
if keyword_set(THUMBSIZE) then begin & i=size(THUMBSIZE) & j=i[n_elements(i)-2]
if ((j eq 0)OR(j ge 6)) then begin
print,'ERROR:THUMBSIZE keyword of illegal data type' & return,-1
endif
if i[0] eq 0 then tsizes=[THUMBSIZE,THUMBSIZE]
if i[0] eq 1 then tsizes=[THUMBSIZE[0],THUMBSIZE[1]]
if i[0] ge 2 then begin
print,'ERROR:THUMBSIZE keyword of illegal array size' & return,-1
endif
endif else tsizes = [50,50]
if keyword_set(COLORBAR) then xco = 80 else xco = 0
if keyword_set(XSIZE) then begin & i=size(XSIZE) & j=i[n_elements(i)-2]
if ((j eq 0)OR(j ge 6)) then begin
print,'ERROR:XSIZE keyword of illegal data type' & return,-1
endif else xs = XSIZE
endif else xs = 512
timetag_height = 12 & tsizes[1] = tsizes[1] + timetag_height
title_height = 15
subtitle_height = 50
ncols = (xs-xco) / tsizes[0] & nrows = (nimages / ncols) + 1
ys = (nrows * (tsizes[1] + timetag_height)) + title_height + subtitle_height
s = {vnum:vnum,tnum:tnum,tdat:tdat,nimages:nimages,xsize:xs,ysize:ys,$
nrows:nrows,ncols:ncols,tsizes:tsizes,timetag_height:timetag_height,$
title_height:title_height,subtitle_height:subtitle_height,$
firstframe:firstframe,lastframe:lastframe}
return,s
end