program ex15 ** Counting the number of quakes in a circle with a radius of rcircle * and centered at (flon0, flat0) *** Define the parameters: flat0=35.0 flon0=-96.0 rcircle=30.0 !! circle radius in degrees ** Open the earthquake catalog file and compute the distance * from each quake to the center of the circle *1980/01/01 16:41:45.70 -31.2110 58.7170 10.00 5.00 *123456789012345678901234567890123456789012345678901234 * 1 2 3 4 5 nn=0 !! initiate the counter open(2,file='/home/sgao/compgeop/quakes.dat') do i=1,10000000 read(2,21,end=222) iy, mo, id, ih, im, & flat, flon, dep, fmag 21 format(i4, 1x, i2, 1x, i2, 1x, i2, 1x, i2, 7x, & f8.4, 1x, f9.4, f7.2, f6.2) * Compute the distance (in degree) using the subroutine of distazsub call distazsub(flat,flon,flat0,flon0,distkm, distdeg,az,baz) if(distdeg.le.rcircle) nn=nn+1 enddo 222 close(2) print*,'The number of quakes in the circle is ', nn stop end ** The code should be compiled using * gfortran ex15.f -m64 /home/sgao/subs/distazsub.f -o ex15.exe * or even better, a Makefile like (pay attention to the tab before gfortran): *ex15.exe:ex15.f * gfortran ex15.f -m64 /home/sgao/subs/distazsub.f -o ex15.exe