; Given an array of filenames, assemble an mpeg from gifs, set the ; colortable by using the colors from the first gif file. FUNCTION mpeg_myWICgifs, f, OUTDIR=OUTDIR id = mpeg_open([200,230]) ; open a new mpeg file idat = bytarr(3,200,230) ; allocate one frame of memory read_gif,f(0),a,r,g,b ; get colortable from first gif tvlct, r,g,b ; load the color table ; construct mpeg frame by frame from the gif files for i=0,n_elements(f)-1 do begin ; process each gif image read_gif, f(i),a ; read the gif file idat(0,*,*) = r[a] ; extract red data idat(1,*,*) = g[a] ; extract green data idat(2,*,*) = b[a] ; extract blue data mpeg_put, id, frame=i, image=idat, order=1 ; write frame to file endfor ; construct a name for the mpeg fole based on the datatime of first gif e = get_mytimefromfilename( f(0) ) p = parse_mystring( decode_cdfepoch(e) ) fname = 'im_k0_wic_' + p(0) + p(1) + p(2) + p(3) + '.mpg' if keyword_set(OUTDIR) then fname = OUTDIR + fname ; close the mpeg and exit mpeg_save,id,filename=fname mpeg_close,id return,fname end ; Search the input directory for a FUV/WIC gif file and rename and move. FUNCTION rename_myWICgif,etime,lsource,OUTDIR=OUTDIR f = findfile('/mission/image/burley/src/_f001.gif') ; search for file if f(0) eq '' then return,-1 ; didn't find the designated file ; determine the name of the new file p = parse_mystring(decode_cdfepoch(etime)) gname = lsource+'_'+p(0)+p(1)+p(2)+p(3)+p(4)+p(5)+'.gif' if keyword_set(OUTDIR) then gname = OUTDIR+gname $ else gname = '/mission/image/sci/incoming/'+gname ; rename and move the file spawn,'mv -f /mission/image/burley/src/_f001.gif '+gname return,gname end ; Given a mega-structure, make image by image gifs of the wic data FUNCTION gifplot_myWICimages, cdfname, OUTDIR=OUTDIR, DEBUG=DEBUG vnames = get_allvarnames(cname=cdfname) ; get the variable names vnames(0)='WIC_PIXELS' & vnames(2)='INSTRUMENT_ID' ; avoid read_mycdf bug a = read_mycdf('EPOCH',cdfname) & ntimes = n_elements(a.epoch.dat)-1 done = 0 & start_rec = 0L & gnames='' ; initialize loop control flag & counter while (done eq 0) do begin stop_rec = start_rec + 200 & if stop_rec gt ntimes then stop_rec = ntimes estart = a.epoch.dat(start_rec) & estop = a.epoch.dat(stop_rec) if keyword_set(DEBUG) then print,'INFO>gifplot_myWICimages>reading ',start_rec,' to ',stop_rec b = read_mycdf(vnames,cdfname,tstart=estart,tstop=estop) if ami_mystruct(b) ne 1 then return,-1 $ else begin for i = 0,n_elements(b.EPOCH.dat)-1 do begin c = plot_fuv_images(b,'wic_pixels',instrument='wic',frame=i+1,/gif) if (c ne -1) then begin ; plot map images did not return an error gname = rename_myWICgif(b.epoch.dat(i),b.(0).logical_source,OUTDIR=OUTDIR) if keyword_set(DEBUG) then print,'INFO>gifplot_myWICimages>gname=',gname if amia_string(gname) then begin ; file found and renamed and moved if gnames(0) eq '' then gnames = gname else gnames = [gnames,gname] endif endif endfor endelse ; update the start_rec and done flag start_rec = start_rec + 201 & if start_rec ge ntimes then done =1 endwhile return,gnames end ; Given start and stop times, in cdf-epoch timetags, create the fuv cdfs for that ; timespan. Ftype should be 'D' for a daily cfd and 'Q' for quicklook FUNCTION make_myFUVcdf, estart, estop, ftype, OUTDIR=OUTDIR, DEBUG=DEBUG ; convert the start and stop times into integers if keyword_set(DEBUG) then print,'INFO>make_myFUVcdf>estart=',decode_cdfepoch(estart) if keyword_set(DEBUG) then print,'INFO>make_myFUVcdf>estop =',decode_cdfepoch(estop) cdf_epoch,estart,y0,m0,d0,h0,n0,s0,/break & monday,y0,doy0,m0,d0,/yearday cdf_epoch,estop ,y1,m1,d1,h1,n1,s1,/break & monday,y1,doy1,m1,d1,/yearday ; convert the times into a command string for the fuvcdf program t = strcompress(string(y0) + string(doy0) + string(h0) + string(m0)) ; ; Temporary code added 2005/1/31, in order to terminate QL production of QL ; FUV cdfs and browse products in order to facilitate EUV/HARP experiment by ; reducing science run time. if (ftype eq 0) then return,0 ; ; change to Steve Gellers directory and execute his cdf-generation program cd,'/mission/image/geller',current=previous_directory ; ; generate the wic cdf showing system times before and after for performance checking if ftype eq 0 then begin ; quicklook product, use quicklook UDF database c='fuvcdf hwic'+t+' v01 IMAGE1Q' & print,'INFO>fuvcdf_wic>started at:',systime(0),' ',c spawn,c & print,'INFO>fuvcdf_wic>ended at:',systime(0) & spawn,'cat fuvcdf.log' c='fuvcdf si1218'+t+' v01 IMAGE1Q' & print,'INFO>fuvcdf_si1218>started at:',systime(0),' ',c spawn,c & print,'INFO>fuvcdf_si1218>ended at:',systime(0) & spawn,'cat fuvcdf.log' c='fuvcdf si1356'+t+' v01 IMAGE1Q' & print,'INFO>fuvcdf_si1356>started at:',systime(0),' ',c spawn,c & print,'INFO>fuvcdf_si1356>ended at:',systime(0) & spawn,'cat fuvcdf.log' c='fuvcdfg'+t+' v01 IMAGE1Q' & print,'INFO>fuvcdf_geo>started at:',systime(0),' ',c spawn,c & print,'INFO>fuvcdf_geo>ended at:',systime(0) & spawn,'cat fuvcdfg.log' endif else begin ; daily product, use daily UDF database c='fuvcdf hwic'+t+' v01 IMAGE1' & print,'INFO>fuvcdf_wic>started at:',systime(0),' ',c spawn,c & print,'INFO>fuvcdf_wic>ended at:',systime(0) & spawn,'cat fuvcdf.log' c='fuvcdf si1218'+t+' v01 IMAGE1' & print,'INFO>fuvcdf_si1218>started at:',systime(0),' ',c spawn,c & print,'INFO>fuvcdf_si1218>ended at:',systime(0) & spawn,'cat fuvcdf.log' c='fuvcdf si1356'+t+' v01 IMAGE1' & print,'INFO>fuvcdf_si1356>started at:',systime(0),' ',c spawn,c & print,'INFO>fuvcdf_si1356>ended at:',systime(0) & spawn,'cat fuvcdf.log' c='fuvcdfg'+t+' v01 IMAGE1' & print,'INFO>fuvcdf_geo>started at:',systime(0),' ',c spawn,c & print,'INFO>fuvcdf_geo>ended at:',systime(0) & spawn,'cat fuvcdfg.log' endelse ; ; find any cdf files which were generated and move them into OUTDIR f = findfile('/mission/image/geller/*.cdf') ; find the cdfs if f(0) eq '' then filesfound = 0 else filesfound = n_elements(f) if keyword_set(OUTDIR) then d = OUTDIR else d = '/mission/image/sci/incoming/' for i=0,filesfound-1 do spawn,'mv -f '+f(i)+' '+d ; cd,previous_directory ; return to the original directory return,0 end ; Given the input structure 'my_times' which includes tstart and tstop and ; filetype, generate all of the level-1 FUV science data products. FUNCTION make_myFUVproducts, my_times, OUTDIR=OUTDIR, DEBUG=DEBUG for i=0,n_elements(my_times.tstart)-1 do begin if keyword_set(DEBUG) then begin print,'INFO>make_myFUVproducts>Tstart=',decompute_cdfepoch(my_times.tstart(i)) print,'INFO>make_myFUVproducts>Tstop =',decompute_cdfepoch(my_times.tstop(i)) print,'INFO>make_myFUVproducts>Ftype =',my_times.ftype(i) endif ; ; set an output directory if keyword_set(OUTDIR) then d = OUTDIR else d = '/mission/image/sci/incoming/' ; ; execute the FUV provided s/w to generate cdfs for the given time period s = make_myFUVcdf(my_times.tstart(i),my_times.tstop(i),$ my_times.ftype(i),OUTDIR=d,DEBUG=DEBUG) ; ; Search the OUTDIR for FUV/WIC cdfs, and generate browse products ; for all of them which have been found f = findfile(d+'*wic*.cdf') if f(0) eq '' then filesfound=0 else filesfound=n_elements(f) for j=0,filesfound-1 do begin print,'INFO>make_myfuvproducts>Gifplotting the file:',f(j) gnames = gifplot_myWICimages(f(j),OUTDIR=d) ; if the returned value is/are strings, then gif's were created if gnames(0) ne '' then begin mpgnames = mpeg_myWICgifs(gnames,OUTDIR=d) ; move all files into the directory tree s = move_myimagefile(f(j)) ; move the cdf file for k=0,n_elements(gnames)-1 do s = move_myimagefile(gnames(k)) for k=0,n_elements(mpgnames)-1 do s = move_myimagefile(mpgnames(k)) endif endfor endfor return,0 end