subroutine tv4rea(string,ndat,realvec) ! TV4REA SUBROUTINE IO C.TYPSCN SBP 2008.04.30 !tpl call tv4rea('string',ndat,realvec) !put string and real vars. ! free form output of descriptive string and real*4 vector on terminal. ! # of digits shown after decimal depends on data magnitude. implicit none real val,argn,realvec(100),f integer och,i,ndat,nch,iw,ifw character*(*) string,form*10,out*78 out=string !transfer string nch=min(20,len_trim(out)) do i=1,ndat val=realvec(i) f=abs(val) iw=9 if(val.lt.0.) iw=10 if(f.ge.1000.) then ifw=3 if(f.ge.10000.000) ifw=2 if(f.ge.100000.00) ifw=1 if(f.ge.1000000.0) ifw=0 elseif(f.ge.1.0000) then ifw=6 if(f.ge.10.000) ifw=5 if(f.ge.100.00) ifw=4 else ifw=7 if(f.ge.1.000000) ifw=6 if(f.ge.10.00000) ifw=5 endif if(f.ge.0.9999e6) then iw=12 ifw=-1 endif och=nch+1 !start pt nch=och+iw if(nch.gt.72) then !full, dump print 1002,out out=' ' !clear nch=iw+1 !reinit with latest added och=1 !but set dest at start endif form=' ' if((ifw.ge.0).and.(iw.lt.10)) write(form,999) iw,ifw if((ifw.ge.0).and.(iw.ge.10)) write(form,998) iw,ifw if(ifw.lt.0) write(form,997) write(out(och:nch-1),form) val 999 format('(','f',i1,'.',i1,')') 998 format('(','f',i2,'.',i1,')') 997 format('(es12.4)') 1002 format(1x,a) enddo if(out(2:2).ne.' ') print 1002,out return end