/* ---------------------------------------------------------------------- */ /* ttime.c return travel time for given depth and distance 26 Jan 98 dpa Created. Use traveltimes.dat file for table lookup trav arg1 arg2 > delta distance traveltime arg1 depth in km arg2 distance in degrees 27 Jan 98 dpa Added interpolation for time/distance. Modified to return "no_data" for invalid entries 11 Mar 98 dpa tt.c new function uses the table2.h travel times, including 0 and 10 km depths and 0 distance. 26 Jul 98 dpa callable as a subroutine Split into two files, tt.c and tttime.c 11 Dec 02 dpa Modified for distribution without levr code. /* ---------------------------------------------------------------------- */ #define VERSION "Vr 2.2" #include /* ---------------------------------------------------------------------- */ void main(int argc, char *argv[]) { int i,j; float depth, distance, otime, odist; if (argc != 3) { fprintf(stderr,"%s: %s\n",argv[0],VERSION); fprintf(stderr,"USEAGE: %s depth_in_km angular_distance\n", argv[0]); exit(-1); } i = sscanf(argv[1],"%f",&depth); i += sscanf(argv[2],"%f",&distance); if (i != 2) { fprintf(stderr,"%s: %s\n",argv[0],VERSION); fprintf(stderr,"USEAGE: %s depth_in_km angular_distance\n", argv[0]); exit(-1); } /* debug ... fprintf(stderr,"depth = %f\tdistance = %f\n",depth,distance); /**/ if ((depth < 0) || (depth > 2880)) { fprintf(stderr,"%s: depth error: allowed range is 0 thru 2880\n", argv[0]); exit(-2); } if ((distance < 0) || (distance > 98)) { fprintf(stderr, "%s: angular distance error: allowed range is 0.0 thru 98.0\n", argv[0]); exit(-3); } /* -------------------------------------------------------------- */ /* debug ... for (i = 0; i < SIZE; i++) { for (j = 0; j < ENTRIES; j++) { printf("%f\t%f\t%f\n",(float)i*10,(float)j+1, traveltimes[i][j]); } } /**/ /* -------------------------------------------------------------- */ i = tt_lookup(1,depth,distance,&otime,&odist); /* -------------------------------------------------------------- */ exit(0); } /* ---------------------------------------------------------------------- */ /* EOF tt.c */