FUNCTION getlims,nimages,utsec,start=start,finish=finish lims=INTARR(2) IF KEYWORD_SET(start) THEN BEGIN sstart=SIZE(start) IF sstart(0) EQ 0 THEN startut=start $ ELSE BEGIN IF sstart(1) LT 3 THEN start=INTARR(3)+start startut=TOTAL([3600.,60.,1.]*start) ENDELSE after=WHERE(utsec GT startut,nafter) IF nafter GT 0 THEN lims(0)=MIN(after) ELSE $ MESSAGE,'No data after '+STRTRIM(startut,2)+' s UT!' ENDIF ELSE lims(0)=0 IF KEYWORD_SET(finish) THEN BEGIN sfinish=SIZE(finish) IF sfinish(0) EQ 0 THEN finishut=finish $ ELSE BEGIN IF sfinish(1) LT 3 THEN finish=INTARR(3)+finish finishut=TOTAL([3600.,60.,1.]*finish) ENDELSE before=WHERE(utsec LT finishut,nbefore) IF nbefore GT 0 THEN lims(1)=MAX(before) ELSE $ MESSAGE,'No data before '+STRTRIM(finishut,2)+' s UT!' ENDIF ELSE lims(1)=nimages-1 RETURN,lims END