c*********************************************************************** c*********************************************************************** c * c program point * c * c purpose: reads in a PLATES data file, counts the number of latitude* c longitude points in each string, and writes that number in# c the second line of the header * c * c PLATES * c U.T. Institute for Geophysics * c 4412 Spicewood Springs Road, Bldg. 600 * c Austin, Texas 78759-8500 * c * c written by: L.M. Gahagan 1993 * c * c*********************************************************************** c*********************************************************************** c * program point c character namin*50,namout*50,idtype*2, aref*4 character ageog*70 integer istr,id1,id2,iclr,ipen,ipoint,icnt integer imax dimension iptcnt(50000) real xlat,xlon,t1,t2 c c initialize variables c imax=0 istr=0 id=101 itype=0 idtype='DS' iclr=0 t1=999. t2=-999. ipen=3 do 52 i=1,50000 iptcnt(i) = 0 52 continue c write(*,*)' point' write(*,*)' ' write(*,*)' Institute for Geophysics' write(*,*)' University of Texas at Austin' write(*,*)' 4412 Spicewood Springs Road, Bldg. 600' write(*,*)' Austin, TX 78759-8500' write(*,*)' ' write(*,*)'This program reads in a PLATES data file,' write(*,*)'counts the number of points in each string,' write(*,*)'and writes that number to the second line of' write(*,*)'the string header.' write(*,*) ' ' c 2 write(*,*) 'Enter the name of the input data file' write(*,*) '(type quit to end program)' read(*,3,err=2) namin 3 format(a50) if(namin(1:4).eq.'quit') goto 99 c open(unit=2,file=namin,status='old',err=2) write(*,*) ' ' write(*,*) 'Enter the name of the output data file' read(*,3) namout open(unit=3,file=namout,status='unknown') write(*,*) ' ' c icnt=0 10 continue icnt=icnt+1 read(2,1001,err=97,end=20) aref,istr,ageog read(2,1002,err=97,end=20) * id1,t1,t2,idtype,itype,id2,iclr ipoint=0 15 continue read(2,1004,err=97,end=20) xlat,xlon,ipen if(xlat.ge.99) then iptcnt(icnt) = ipoint goto 10 endif ipoint=ipoint + 1 goto 15 c 20 continue rewind(unit=2) ipoint=1 30 continue read(2,1001,err=97,end=98) aref,istr,ageog read(2,1002,err=97,end=98) * id1,t1,t2,idtype,itype,id2,iclr write(3,1001) aref,istr,ageog write(3,1003) * id1,t1,t2,idtype,itype,id2,iclr,iptcnt(ipoint) ipoint=ipoint+1 if(iptcnt(ipoint).gt.9999) then write(*,*) 'Error. # points in string > 9,999!' write(*,1001) aref,istr,ageog write(*,1003) * id1,t1,t2,idtype,itype,id2,iclr,iptcnt(ipoint) endif if(imax.lt.iptcnt(ipoint)) imax=iptcnt(ipoint) c write(*,*) imax c 35 continue read(2,1004,end=98) xlat,xlon,ipen write(3,1004) xlat,xlon,ipen if(xlat.ge.99) goto 30 goto 35 c 97 continue write(*,*) 'error in format - fix file' write(*,1001) aref,istr,ageog write(*,1002) id1,t1,t2,idtype,itype,id2,iclr write(*,1004) xlat,xlon,ipen 98 continue close(unit=2) close(unit=3) goto 2 99 continue write(*,*) 'all done' close (unit=2) close (unit=3) c 1001 format(a4,1x,i4,1x,a70) 1002 format(x,i3,x,f6.1,x,f6.1,x,a2,i4,x,i3,x,i3) 1003 format(x,i3,x,f6.1,x,f6.1,x,a2,i4,x,i3,x,i3,x,i5) 1004 format(f9.4,x,f9.4,x,i1) c continue write(*,*)'imax=', imax stop end