; pro gonzdat ; ; Read tgcmproc made ascii data file, and write output data files ; reformatted for Gonzalo (see ../frmgonz.data.request). ; Separate output files are written for each location, and for ; 2 emissions: OH 6-2 band (~8400A), and E5577 greenline. ; Each output file contains multiple days. ; Data written are the ht-integrated emission, and doppler t,u,v. ; init_path = "/d/foster/usr/gonz" filter = "*.dat" file = pickfile(path=init_path,filter=filter) ;file = '/d/foster/usr/gonz/gonz_d80-90.dat' ludat = newfile(file) ; ; Read 1st frame to establish frame structure, then allocate ; mxframes frames to be read. ; iframe = 1 istat = rdascii(ludat,file,frame) if (istat ne 0) then goto,done mxframes = 50 frames = replicate({frame_struct},mxframes) frames(iframe-1) = frame ;printhdr,frames(iframe-1),file,iframe iframe = iframe+1 ; ; Read remaining frames: ; while (istat eq 0) do begin istat = rdascii(ludat,file,frame) if (istat ne 0) then goto,done frames(iframe-1) = frame ; printhdr, frames(iframe-1),file,iframe iframe = iframe+1 if (iframe gt mxframes) then begin print,'>>> Too many frames: increase mxframes from ',mxframes return endif endwhile ; ; EOF or error on input file. ; If eof, call wrdat to write output files. ; done: if (istat eq 2) then begin print,'EOF encountered on file ',file,' iframe=',iframe wrdat,frames,iframe-1 ; write output files endif else begin print,'>>> Error reading frame from file ',file,' iframe=',iframe endelse return end