pro movy_driver_32,year,week=week,strt_date=strt_date,$ end_date=end_date,nfils=nfils,bgst=bgst,clip=clip,$ al_only=al_only,dg_only=dg_only,grid=grid,$ sst=sst,debug=debug,$ xdaoutdir=xdaoutdir,fitsoutdir=fitsoutdir,$ prefixx=prefixx,indir=indir,$ depit=depit ;+ ; NAME: movy_driveri_31 ; ; PURPOSE: Front end program to read and process SSC ; files for purpose of eliminating bad ones and creating ; SXT movie files (i.e., what we used to call SSS files). ; The default is to produce one file per image. ; ; This version creates both xda and fits format level-3 ; "movie" products. This is now the "standard" version. ; ; CALLING EXAMPLE: ; movy_driver_32,year,week=week,strt_date=strt_date,$ ; end_date=end_date,nfils=nfils,bgst=bgst,clip=clip,$ ; al_only=al_only,dg_only=dg_only,grid=grid,$ ; sst=sst,debug=debug,$ ; xdaoutdir=xdaoutdir,fitsoutdir=fitsoutdir,$ ; prefixx=prefixx,indir=indir,$ ; depit=depit ; ; INPUT: ; year, year to be analyzed (Note: year is ALWAYS required.) ; ; SEMI-OPTIONAL KEYWORD INPUT: ; prefixx, if not specified then prefix is sxtf. ; E.g., prefixx='sx2m_' for doublets ; prerixx='sx3m_' for triplets ; ; OPTIONAL KEYWORD INPUT: ; indir, directory to find the SSCs. ; Default: '/disk/hl3/ylegacy/ssc25/' ; nfils, vector of files to be analyzed ; Default: all available files for that year. ; bgst, Alog10 of brightest feature for use in max=bgst in bytscl. ; Default bgst (set in mk_movy.pro) is 7.5e4. ; clip, lower cutoff in final bytscl step. ; Default clip (set in mk_movy.pro) is 12. ; strt_date, day to begin the movie, e.g., '12-jun-96' ; end_date, day to end the movie, e.g., '30-aug-98' ; Note: If strt_date and no end_date code proceeds on in time. ; /al_only, do only Al.1 images ; /dg_only, do only AlMg images ; sst, use Triplet composites (Default is to make doublets.) ; grid, use to create desired image cadence (units: minutes) ; /depit, Check for and remove cases where compositing with ; sxt_decon has produced negative "pits" around short-exposure ; features that are substantially brighter than the same ; feature in the long exposure, perhaps because of a flare ; in the up to 11 minutes between the long and short exposures ; of the SSC. ; xdaoutdir, directory for xda output (Default is '/yla/xdamov32') ; fitsoutdir, directory for fits output (Default is '/yla/sxtmov32') ; ; OUTPUT: ; Movie and index structures created by mk_movy.pro. ; Filename of format sx2m_19911001_133212_121.fts is created. ; Filename of format sx2m_19911001_133212_121.xda is created. ; ; RESTRICTIONS: ; Beware of hardwired directories! ; ; HISTORY: ; 2-Jul-2020 LWA Created from movy_driver.pro. ; Special version making both XDA and FITS format ; files and writing to sunbeam directories. ; Default output to /yla/sxtmov30a and /yla/xdamov30a. ; 8-Jul-2010 LWA Deleted keywords and text dealing with one_big_movy. ; 18-Aug-2010 LWA Set up to process only SAA images. ; 31-Aug-2010 LWA New standard version. Created from movy_driver_30a_saa ; by deletion of SAA selection section. ; 26-Oct-2010 LWA Output to /yla/sxtmov32 and /yla/xdamov32. ; 27-Oct-2010 LWA Removed noroll and decaday keywords and functionality. ; 29-Oct-2010 LWA Changed all /yla to /disk/sb1. ;- start_time = systime(1) run_time = 0. sst=keyword_set(sst) al_only = keyword_set(al_only) dg_only = keyword_set(dg_only) depit = keyword_set(depit) if sst then prefixx='sx3m_' else prefixx='sx2m_' ; ---- List of reject image times. ---- badimg=rd_tfile('/disk/sb1/ssc_work/badimg.txt') ; ---- Set up I/O stuff. --- if not keyword_set(indir) then begin dir='/disk/hl3/ylegacy/ssc25/'+strtrim(year,2) endif else begin dir=indir+strtrim(year,2) endelse if keyword_set(xdaoutdir) then xdaoutdir=xdaoutdir else $ xdaoutdir='/disk/sb1/xdamov32' if keyword_set(fitsoutdir) then fitsoutdir=fitsoutdir else $ fitsoutdir='/disk/sb1/sxtmov32' if keyword_set(week) then week=week else week=0 ; ---- Obtain files and roadmap for desired interval. ---- ;Get the sst or ssc file names for the entire year. if keyword_set(sst) then $ fil=file_search(dir+'/sst'+'*') else $ fil=file_search(dir+'/ssc'+'*') unc=strwhere(fil,'*_unc') if unc(0) ne -1 then begin nunc=delind(indgen(n_elements(fil)),unc) fil=fil(nunc) endif rd_roadmap,fil,rdm ;Determine strt_date and end_date if not input. ---- if not keyword_set(strt_date) then strt_date=fmt_tim(rdm(0)) if not keyword_set(end_date) then $ end_date=fmt_tim(rdm(n_elements(rdm)-1)) help,dir help,fil print,'strt_date = ',strt_date print,'end_date = ',end_date if fil(0) eq '' then goto,nofils ; ---- Redefine strt_date & end_date if week is input. ---- if keyword_set(week) then pr_week2tim,week,strt_date,end_date end_date=anytim(end_date)+(24.*60.*60.) end_date=anytim(end_date,/yoh) ; ---- Determine the beginning image from strt_date. ---- if keyword_set(strt_date) then begin help,strt_date rd_roadmap,fil,road aas=anytim(strt_date) beg=where(anytim(road) ge aas,nbeg) endif if nbeg eq 0 then begin print,'*** All data before STRT_DATE. Returning.***' return endif ; ---- Determine the last image from end_date. ---- if keyword_set(end_date) then begin help,end_date aae=anytim(end_date) eed=where(anytim(road) le aae,need) endif if need eq 0 then begin print,'*** All data after END_DATE. Returning.***' return endif ; ---- Get indices of all images within strt/end time interval. ---- bend=lindgen(n_elements(eed))+beg(0) bbx=lindgen(n_elements(road)) bbi=where(bbx ge beg(0) and bbx le eed(n_elements(eed)-1),nbbi) if nbbi le 0 then begin print,'*** No data match time constraints. Returning. ***' return endif ; ---- Down-select to get only the desired images in interval. ---- bend=bbx(bbi) rdm=road(bend) fmt_timer,road fmt_timer,rdm gg=indgen(n_elements(rdm)) bb=tim2dset(rdm,badimg,delta_sec=off) bbx=where(off lt 5,nbbx) if nbbx gt 0 then gg=kill_index(gg,bb(bbx)) if gg(0) eq -1 then goto,skipit case 1 of al_only eq 0 and dg_only eq 0 : gg=gg al_only : begin ff=where(gt_filtb(rdm(gg)) eq 2,nff) case 1 of nff le 0 : goto,skipit nff gt 0 : gg=gg(ff) endcase end dg_only : begin ff=where(gt_filtb(rdm(gg)) eq 3,nff) case 1 of nff le 0 : goto,skipit nff gt 0 : gg=gg(ff) endcase end endcase print print,'Total number of images to be processed =',n_elements(gg) nj=0 ;Make the movie one SSC at a time. for j=0,n_elements(gg)-1 do begin rd_xda,fil,bend(gg(j)),index,data mj=j/100 if mj eq nj then begin print,'Processing image '+strtrim(j,2) print,get_info(index,/non) nj=mj+1 endif moov=mk_movy(index,data,ioutoo,clip=clip, $ rasho=rasho,bgst=bgst,grid=grid,junk=junk, $ udata=udata,uthresh=uthresh,depit=depit,sst=sst) if junk then goto,junk_img nam=sxt_index2filename(ioutoo) if sst then nam=strmid(nam,0,2)+'3m'+strmid(nam,4,21)+'xda' $ else nam=strmid(nam,0,2)+'2m'+strmid(nam,4,21)+'xda' full_path=yo_index2path(index,parent_dir=xdaoutdir,$ /concat_dirx,/make_dir,/day) sav_sda,full_path+'/'+nam,ioutoo,moov yo_xda2legacy,ioutoo,moov,prefixx=prefixx,outdir=fitsoutdir junk_img : endfor skipit: nofils : end_time = systime(1) run_time = (end_time-start_time)/60. print, 'MOVY_DRIVER_32: ', run_time, ' minutes to process your request' end