FUNCTION savqlimg COMMON KI_image,header_bytes,CCD_image COMMON qlistuff,aflun,qlif,ql_times save=0B KIh=gethd(header_bytes) itime=INTARR(4) FOR j=0,3 DO itime(j)=FIX(KIh.misc.tm.(j)) cam=KIh.misc.cam filt=KIh.misc.fw type=KIh.misc.exposure_type exptime=FIX(ROUND(KIh.misc.exp_scale*KIh.exp.exposure/1000.)) ; In the lines below, the first image of the hour in each selected ; category is saved CASE 1 OF (type EQ 1): BEGIN ; save only 785 nm auroral image (c0,f2) save=((cam EQ 1) AND (filt EQ 2) $ AND (itime(0) GT ql_times(1,4))) IF save THEN ql_times(1,4)=itime(0) END (type EQ 2): BEGIN ; save airglow images from all available channels save=(itime(0) GT ql_times(cam,2+filt)) IF save THEN ql_times(cam,2+filt)=itime(0) END (type EQ 5): BEGIN ; save both 10-s and 60-s dark frames save=(itime(0) GT ql_times(cam,exptime/60)) IF save THEN ql_times(cam,exptime/60)=itime(0) END ELSE: ENDCASE RETURN,save END