pro clean_saa,yr,mnth

; INPUT
;	yr in the form '1993'
;	mnth in the form '06'

restgen,file='fil_list/ok_fts_'+yr+'_'+mnth+'.genx',fil
help,fil
print,fil(0)
mreadfits,fil,index,data,/silent
wdef
!p.charsize=1.7 & !p.charthick=2
loadct,3,/silent
over
tim2orbit,index,saa=saa
aa=where(saa eq 1)
ss=stepper2(index(aa),data(*,*,aa),pauz=0.25)
ndg=where(ss eq 1,nndg)
if nndg lt 1 then begin
   print,'No bad SAA images.  Exiting program.'
   goto,skipout
endif
ok=delind(indgen(n_elements(index)),aa(ndg))
fil0=fil(ok)
help,index,data,aa,ndg,ok,fil0
;stop
yn=''
read,prompt='*** write a file? ',yn
if yn eq 'y' then savegen,fil0, $
   file='fil_list/ok_fts_'+yr+'_'+mnth+'.genx'
skipout:

end
