c..................................................................... c c c c..................................................................... c character*72 file_mag,file_roa,file_out character*8 cf*85,ctime*8 logical inicio,traco integer isecob(20000) real fmob(20000) c namelist /par/ file_mag,file_roa,file_out,n_aver c....................................................................... n_aver=1 open(unit=10, file='roa02.in', status='old') read(10,par) close(10) c open(9,file=file_mag,status='old') open(10,file=file_roa,status='old') open(11,file=file_out,status='unknown') c ipon=0 inicio=.true. do 1 i=1,1000000 read(10,1100,err=1,end=2) idd,ctime,iffff 1100 format(t9,i2,t12,a8,t68,i6) ipon=ipon+1 read(ctime,'(i2,1x,i2,1x,i2)') ihh,imm,iss isecob(ipon)=ihh*3600+imm*60+iss+float(idd)*86400 fmob(ipon)=float(iffff) inicio=.false. 1 continue 2 npon=ipon write(*,*) npon,'points found' close(10) ipon=0 do 10 i=1,1000000 isum=0 fsum=0 do 8 k=1,n_aver read(9,'(a)',err=10,end=12) cf read(cf,1100,err=10,end=12) idd,ctime,iffff read(ctime,'(i2,1x,i2,1x,i2)') ihh,imm,iss isec=ihh*3600+imm*60+iss+float(idd)*86400 fmag=float(iffff) ipon=ipon+1 isum=isum+isec fsum=fsum+fmag 8 continue fmag=fsum/float(n_aver) x=float(isum)/float(n_aver) do 9 j=1,npon if (isec.lt.isecob(j)) then x1=float(isecob(j-1)) x2=float(isecob(j)) y1=fmob(j-1) y2=fmob(j) dx=x2-x1 dy=y2-y1 y=(x-x1)*dy/dx+y1 ano=fmag-y c write(*,*) x c write(*,*) x1,x2 c write(*,*) y1,y2 c write(*,*) y,fmag,ano c pause write(11,1200) cf,y,ano 1200 format(a73,2f7.1) goto 10 endif 9 enddo 10 continue 12 npont=ipon write(*,*) npont,'points found' close(9) c 999 stop end c c*********************************************************************** c subroutine getar2(iarg,arg,cf) c----------------------------------------------------------------------- c c Emulates the UNIX-FORTRAN subroutine "getarg". c c Input via call: c c iarg - index of desired command line argument c c c Output via call: c c arg - a character*80 variable with the command line argument c c Note: This version reads and parses the command line each time c the routine is called. This is not very satisfactory, c however I am at a loss as to how to do this and still c preserve the UNIX arguments. c c Requires you link with /lib/st.lib c c----------------------------------------------------------------------- implicit integer*2 (z) character*1 comlin(127) character*80 comlst(50), arg character*127 comand character*80 cf c if (iarg .le. 0) stop 'GETARG Error: Illegal iarg' if (iarg .eq. 0) stop 'GETARG Error: no command line parameters' comand = ' ' call parse2(cf,comlst,numarg) if (numarg .lt. iarg) stop 'GETARG Error: iarg too large' arg = comlst(iarg) c return end function iargc2(cf) c---------------------------------------------------------------------- c c Emulates the UNIX-FORTRAN fuction "iargc" c c Returns the number of arguments on the command line. c c c---------------------------------------------------------------------- implicit integer*2 (z) character comand*127, comlst*80, comlin*1 dimension comlst(50), comlin(127) character*80 cf c call parse2(cf,comlst,num) iargc2 = num c return end subroutine parse2(comand,comlst,numarg) c---------------------------------------------------------------------- c c Parses command line. c c Input via call: c comand -=- command string (must be character*127) c c Output via call c comlst -=- array containing each blank delimited element c of "comand" (must be dimensioned as below) c numarg -=- number of elements in comlst c c---------------------------------------------------------------------- implicit integer*2 (z) character comand*80, comlst*80 dimension comlst(50) c c Remove leading blanks (return if all blank), count trailing blanks c if (comand .eq. ' ') then numarg = 0 return endif zblank = 0 do 10 zi = 1, 80 if (comand(zi:zi) .ne. ' ') goto 20 zblank = zblank + 1 10 continue 20 if (zblank .ne. 0) then comand(1:80-zblank)=comand(zblank+1:80) comand(80-zblank+1:80)=' ' endif zblank = 0 zindex = 81 do 30 zi = 1, 80 zindex = zindex - 1 if (comand(zindex:zindex) .ne. ' ') goto 40 zblank = zblank + 1 30 continue c c Parse comand into individual pieces... c 40 zend = 80 - zblank numarg = 0 zsave = 1 c c First, look for end of first word c do 70 zi = 1, zend + 1 if (comand(zi:zi) .eq. ' ' .and. zi .gt. zsave) then c c Have reached end of word, so save it c numarg = numarg + 1 comlst(numarg) = comand(zsave:zi-1) c c Now, look for beginning of next word c do 50 zsave = zi+1, zend if (comand(zsave:zsave) .ne. ' ') goto 60 50 continue 60 continue endif c c Go back up and look for end of this word c 70 continue return c end