pro pltlin ; ; Read ascii data file made by ../tigcmdif/pltutlin.f ; ;def_file = '/d/foster/tigcmdif/lunar.days6-12.dat' ;def_file = 'lunar.days6-12.fof2.dat' def_file = 'lunar.days0-17.fof2.dat' ; ; Open data file: ; nfiles = 0 nframes = 0 iframe = 0 nextfile: print,' ' print,format="('Enter file name (stop to quit) [default=',a,']',$)",$ def_file flnm = '' read,flnm if flnm eq 'stop' then begin print,'bye' return endif if strlen(flnm) eq 0 then begin flnm = def_file print,'Using default file ',flnm endif if nfiles gt 0 then close,lu openr,lu,flnm,/get_lun,error=err if err ne 0 then begin print,'Error opening file ',flnm goto,nextfile endif else print,'Opened file=',flnm,' (unit=',lu,')' def_file = flnm ; ; Determine how many frames to plot from this file: ; print,' ' print,format="('Enter number of frames for this file',$)" nfr = '' read,nfr if strlen(nfr) eq 0 then begin print,'Will plot all frames in file' nframes = 999 endif else begin reads,nfr,nframes print,'Will plot ',nframes,' frames from file' endelse iframe = 0 ; ; Ask about making postscript: ; print,' ' print,format="('Make postscript files? [n]',$)" ps = '' & ips = 0 read,ps if ps eq 'y' then begin ips = 1 print,'Will make postscript files for each frame' endif else print,'Will NOT make postscript files' ; ; Read and echo header info: ; nextframe: while (not eof(lu)) do begin print,' ' histlab = '' readf,lu,histlab histlab = strtrim(histlab,2) print,histlab ; fieldlab = '' readf,lu,fieldlab fieldlab = strtrim(fieldlab,2) print,fieldlab ; framelab = '' readf,lu,framelab framelab = strtrim(framelab,2) print,framelab ; loclab = '' readf,lu,loclab loclab = strtrim(loclab,2) print,loclab ; xdatlab = '' readf,lu,xdatlab xdatlab = strtrim(xdatlab,2) print,xdatlab ydatlab = '' readf,lu,ydatlab ydatlab = strtrim(ydatlab,2) print,ydatlab ; ; ntms = number of times (x-axis) ; ut(ntms) will be converted to days ; ntms = 0 reads,ydatlab,ntms,format="(3x,i4)" ut = fltarr(ntms) readf,lu,ut ut = ut/24. dat = fltarr(ntms) readf,lu,dat rmin = min(dat,max=rmax) title='DIFFERENCE FIELD: ' + loclab + $ string(rmin,rmax,format="(' MIN,MAX = ',g8.2,', ',g8.2)") ;plot,ut,dat,xtitle='MODEL DAY',ytitle='DIFF '+ fieldlab,title=title,/xstyle,$ ; xminor=12,xtick_get=xtics,ytick_get=ytics plot,ut,dat,xtitle='MODEL DAY',ytitle='DIFF '+ fieldlab,title=title,/xstyle,$ xminor=10,xtick_get=xtics,ytick_get=ytics nytics = n_elements(ytics) & nxtics = n_elements(xtics) for i=0,nxtics-1 do plots,[xtics(i),xtics(i)],[ytics(0),ytics(nytics-1)],$ /linestyle if rmin lt 0. and rmax gt 0. then plots,[ut(0),ut(ntms-1)],[0.,0.],$ /linestyle iframe = iframe+1 print,' ' if ips gt 0 then begin psfile = string(iframe,format="('fr',i3.3,'.ps')") print,'Making postscript file ',psfile,'...' save_dev = !d.name set_plot,'ps' device,filename=psfile,xsize=7.,ysize=6.,yoffset=4.,/inches,/portrait ; plot,ut,dat,xtitle='MODEL DAY',ytitle=fieldlab,title=title,/xstyle,$ ; xminor=12,xtick_get=xtics,ytick_get=ytics,charsize=.9 plot,ut,dat,xtitle='MODEL DAY',ytitle=fieldlab,title=title,/xstyle,$ xminor=10,xtick_get=xtics,ytick_get=ytics,charsize=.9 for i=0,nxtics-1 do plots,[xtics(i),xtics(i)],[ytics(0),ytics(nytics-1)],$ /linestyle if rmin lt 0. and rmax gt 0. then plots,[xtics(0),xtics(nxtics-1)],[0.,0.],$ /linestyle device,/close set_plot,save_dev endif print,iframe,format=$ "('Completed frame ',i3,' (hit return to continue or stop to quit)',$)" ans = '' read,ans if ans eq 'stop' then goto,nextfile if nframes lt 999 then begin if iframe lt nframes then goto,nextframe else goto,nextfile endif goto,nextframe endwhile goto,nextfile return end