PROGRAM distr2 IMPLICIT none INTEGER*4 ndp,i,j real*8 xmin,xmax,an,dd,p1,p2,fac,ymin,ymax,dy real*8,allocatable:: probd(:) character*80 fin,fout,st C WRITE(6,*)'2D-distribution analysis' call getarg(1,fin) call getarg(2,fout) if(iargc().gt.2)then call getarg(3,st) read(st,*)ndp call getarg(4,st) read(st,*)xmin call getarg(5,st) read(st,*)xmax call getarg(6,st) read(st,*)ymin call getarg(7,st) read(st,*)ymax else ndp=100 xmin=-180.0d0 xmax= 180.0d0 endif allocate(probd(ndp**2)) do 10 i=1,ndp**2 10 probd(i)=0.0d0 an=0.0d0 dd=(xmax-xmin)/dble(ndp) dy=(ymax-ymin)/dble(ndp) open(9,file=fin) 1 read(9,*,end=999,err=999)p1,p1,p2 an=an+1.0d0 if(p1.le.xmax.and.p1.ge.xmin)then i=int((p1-xmin+dd)/dd) if(i.lt.1)i=1 if(i.gt.ndp)i=ndp endif if(p2.le.ymax.and.p2.ge.ymin)then j=int((p2-ymin+dy)/dy) if(j.lt.1)j=1 if(j.gt.ndp)j=ndp endif probd(i+(j-1)*ndp)=probd(i+(j-1)*ndp)+1.0d0 goto 1 999 close(9) open(33,file=fout) fac=1.0d0/an/dd/dd do 17 i=1,ndp do 17 j=1,ndp 17 write(33,3333)xmin+dd*dble(2*i-1)/2.0d0, 1ymin+dy*dble(2*j-1)/2.0d0,probd(i+(j-1)*ndp)*fac 3333 format(2f12.3,' ',G12.6) close(33) write(6,6009)int(an) 6009 format(i7,' points') end subroutine report(s) character*(*) s write(6,*)s stop end