Changeset 87 for SH_SHM/trunk/util
- Timestamp:
- 12/10/2008 08:46:37 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
SH_SHM/trunk/util/check_evt.c
r86 r87 40 40 #include "eventdsc.h" 41 41 #include "tcusrdef.h" 42 #include "earthloc.h" 42 43 43 44 … … 50 51 #define EVTYPE_PKP 3 51 52 52 /* next error number currently 0 24*/53 /* next error number currently 031 */ 53 54 54 55 55 56 56 57 /* global variables */ 58 static float efv_reflat=49.0; /* reference latitude */ 59 static float efv_reflon=11.0; /* reference longitude */ 57 60 static char efv_infile[BC_FILELTH+1]; /* name of input file */ 58 61 static char efv_uncorrphase[EvPHASELTH+1]; /* name of phase on uncorr beam */ 59 62 static BOOLEAN efv_first_arrival=FALSE; /* first arrival phase selected */ 60 63 static BOOLEAN efv_only_grf=TRUE; /* only GRF stations used */ 64 static BOOLEAN efv_gra1_picked=FALSE; /* pick on GRA1 found */ 61 65 static BOOLEAN efv_uncorr_loc=FALSE; /* uncorrected beam for location */ 62 66 static BOOLEAN efv_telex_phase=FALSE; /* telex phase found */ … … 70 74 static int efv_pkp_count=0; /* number of PKP phases */ 71 75 static BOOLEAN efv_illegal_origin; /* illegal origin time */ 72 76 static BOOLEAN efv_foundPg=FALSE; /* Pg phase found */ 77 static BOOLEAN efv_foundPnSn=FALSE; /* Pn/Sn found */ 78 static BOOLEAN efv_foundTele=FALSE; /* teleseismic phase found */ 79 static float efv_latitude=0.0; /* epicentre latitude */ 80 static float efv_longitude=0.0; /* epicentre longitude */ 81 static char efv_analyst[EvANALYSTLTH+1]=""; /* analysts initials */ 82 static BOOLEAN efv_showinitials=FALSE; /* show initials */ 73 83 74 84 … … 91 101 /* executable code */ 92 102 93 if (argc != 3) { 94 fprintf( stderr, "Usage: %s <input> <output>\n", argv[0] ); 103 if (argc < 2) { 104 fprintf( stderr, "Usage: %s <input> [<output>] [<showinitials>]\n", 105 argv[0] ); 95 106 return 1; 96 107 } /*endif*/ 97 108 98 109 strcpy( infile, argv[1] ); 99 strcpy( outfile, argv[2] ); 110 if (argc > 2) 111 strcpy( outfile, argv[2] ); 112 if (*outfile == '\0') 113 strcpy( outfile, "TT" ); 114 else 115 strcpy( outfile, "TT" ); 116 efv_showinitials = FALSE; 117 if (argc > 3) 118 efv_showinitials = (strcmp(argv[3],"showinitials") == 0); 100 119 101 120 /* efv_infile is used for messages, directory will be removed */ … … 151 170 /* is a location given here ? */ 152 171 loc_given = (event->latitude > 0.0 && event->longitude > 0.0); 172 if (loc_given) { 173 efv_latitude = event->latitude; 174 efv_longitude = event->longitude; 175 } /*endif*/ 153 176 154 177 /* is this an L phase ? */ … … 162 185 /* is this a PKP phase ? */ 163 186 is_pkp_phase = (strstr(event->phase,"PKP") != NULL); 187 if (is_pkp_phase) 188 efv_foundTele = TRUE; 189 190 /* a depth phase can found only in teleseismic events */ 191 if (event->phase[0] == 'p' || event->phase[0] == 's') 192 efv_foundTele = TRUE; 193 194 /* check for local and regional phases */ 195 if (strcmp(event->phase,"Pg") == 0) 196 efv_foundPg = TRUE; 197 if (strcmp(event->phase,"Pn") == 0) 198 efv_foundPnSn = TRUE; 199 if (strcmp(event->phase,"Sn") == 0) 200 efv_foundPnSn = TRUE; 164 201 165 202 if (event->event_type != EvcEventTypeUndefined) … … 170 207 171 208 /* is it a GRF station ? */ 172 if (strncmp(event->station,"GR",2) != 0) 209 if (strncmp(event->station,"GR",2) != 0 210 || event->station[2] < 'A' || event->station[2] > 'C') 173 211 efv_only_grf = FALSE; 212 if (strcmp(event->station,"GRA1") == 0) 213 efv_gra1_picked = TRUE; 174 214 175 215 /* is a first arrival phase there ? */ … … 315 355 } /*endif*/ 316 356 357 if (event->analyst[0] != '\0') 358 strcpy( efv_analyst, event->analyst ); 359 317 360 } /* end of EfPutCheck */ 318 361 … … 365 408 */ 366 409 { 410 /* local variables */ 411 char expl[cBcLongStrLth+1]; /* explanation string */ 412 367 413 /* executable code */ 368 414 369 415 /* fprintf( out, "--> final check\n" ); */ 416 if (efv_showinitials) 417 sprintf( expl, "%s (%s)", efv_infile, efv_analyst ); 418 else 419 strcpy( expl, efv_infile ); 370 420 371 421 /* a first arrival must be specified */ 372 422 if (!efv_first_arrival) 373 fprintf( out, "F014 %s: no first arrival phase selected\n", e fv_infile);423 fprintf( out, "F014 %s: no first arrival phase selected\n", expl ); 374 424 375 425 /* beam with uncorrected slowness at GRF is at least suspicious */ 376 426 if (efv_only_grf && efv_uncorr_loc) 377 427 fprintf( out, "F015 %s: GRF location with uncorrected beam at phase %s\n", 378 efv_infile, efv_uncorrphase ); 428 expl, efv_uncorrphase ); 429 430 /* only GRF picked but no GRA1? */ 431 if (efv_only_grf && !efv_gra1_picked) 432 fprintf( out, "F035 %s: only GRF picks but none at GRA1\n", expl ); 379 433 380 434 /* no telex phase */ 381 435 /* disabled 12-Nov-2008 K.S. 382 436 if (!efv_telex_phase) 383 fprintf( out, "F016 %s: no telex phase found\n", e fv_infile);437 fprintf( out, "F016 %s: no telex phase found\n", expl ); 384 438 */ 385 439 386 440 /* mb determined? */ 387 441 if (efv_subtype == EVTYPE_P && !efv_mb_found) 388 fprintf( out, "F017 %s: no Magnitude mb determined for P phase\n", 389 efv_infile ); 442 fprintf( out, "F017 %s: no Magnitude mb determined for P phase\n", expl ); 390 443 391 444 /* Ms determined? */ … … 393 446 !efv_ms_found) 394 447 fprintf( out, "F018 %s: no Magnitude Ms determined for magn %3.1f event\n", 395 e fv_infile, efv_magn );448 expl, efv_magn ); 396 449 if (efv_subtype == EVTYPE_PKP && efv_depth <= 50.0 && efv_pkp_count > 3 && 397 450 !efv_ms_found) 398 451 fprintf( out, "F019 %s: no Magnitude Ms determined for PKP event\n", 399 e fv_infile);452 expl ); 400 453 if (efv_ms_found && efv_depth > 50.0) 401 454 fprintf( out, "F020 %s: Magnitude Ms determined for depth %5.1f event\n", 402 e fv_infile, efv_depth );455 expl, efv_depth ); 403 456 404 457 /* Mbb determined? */ 405 458 if (efv_mb_found && efv_magn > 6.2 && !efv_mbb_found) 406 459 fprintf( out, "F021 %s: no Broadband Magnitude determined for magn %3.1f event\n", 407 e fv_infile, efv_magn );460 expl, efv_magn ); 408 461 409 462 /* depth ok? */ 410 463 if (efv_evtype == EvcEventTypeMining && Abs(efv_depth-1.0) > 0.1) 411 464 fprintf( out, "F022 %s: depth %5.1f given for mining event\n", 412 e fv_infile, efv_depth );465 expl, efv_depth ); 413 466 if (efv_evtype == EvcEventTypeBlast && Abs(efv_depth) > 0.1) 414 467 fprintf( out, "F023 %s: depth %5.1f given for blast\n", 415 e fv_infile, efv_depth );468 expl, efv_depth ); 416 469 if (efv_evtype == EvcEventTypeTeleQuake && (efv_depth < 10.0)) 417 470 fprintf( out, "F026 %s: depth %5.1f for teleseismic event\n", 418 efv_infile, efv_depth ); 471 expl, efv_depth ); 472 if ((efv_evtype == EvcEventTypeLocalQuake 473 || efv_evtype == EvcEventTypeRegioQuake) && (efv_depth < 2.0)) 474 fprintf( out, "F027 %s: depth %5.1f for local/regional event\n", 475 expl, efv_depth ); 476 if (efv_evtype == EvcEventTypeLocalQuake && efv_depth > 50.0) 477 fprintf( out, "F036 %s: depth %5.1f given for local event\n", 478 expl, efv_depth ); 419 479 if (efv_evtype == EvcEventTypeUndefined) 420 fprintf( out, "F024 %s: no event type specified\n", e fv_infile);480 fprintf( out, "F024 %s: no event type specified\n", expl ); 421 481 if (efv_depth < -99.0) 422 fprintf( out, "F025 %s: no depth specified\n", efv_infile ); 482 fprintf( out, "F025 %s: no depth specified\n", expl ); 483 484 /* proper event type? */ 485 if (efv_foundPg && efv_evtype == EvcEventTypeTeleQuake) 486 fprintf( out, "F028 %s: improper teleseismic event type: found Pg\n", 487 expl ); 488 if (efv_foundPnSn && efv_evtype == EvcEventTypeTeleQuake) 489 fprintf( out, "F029 %s: improper teleseismic event type: found Pn/Sn\n", 490 expl ); 491 if (efv_foundTele && efv_evtype == EvcEventTypeLocalQuake) 492 fprintf( out, "F030 %s: improper local event type: found tele phase\n", 493 expl ); 494 if (efv_foundTele && efv_evtype == EvcEventTypeRegioQuake) 495 fprintf( out, "F031 %s: improper regional event type: found tele phase\n", 496 expl ); 497 498 /* check distance and event type */ 499 if (efv_latitude != 0.0 || efv_longitude != 0.0) { 500 double dist, azim, bazim; /* result of distance computation */ 501 float fdist; /* single precision distance */ 502 mb_locdiff( (double)efv_reflat, (double)efv_reflon, (double)efv_latitude, 503 (double)efv_longitude, &dist, &azim, &bazim ); 504 fdist = dist; 505 if (dist > 15.0 && efv_evtype == EvcEventTypeLocalQuake) 506 fprintf( out, "F032 %s: improper local event type (distance %f deg)\n", 507 expl, dist ); 508 if (dist > 30.0 && efv_evtype == EvcEventTypeRegioQuake) 509 fprintf( out, "F033 %s: improper regional event type (distance %f deg)\n", 510 expl, dist ); 511 if (dist < 25.0 && efv_evtype == EvcEventTypeTeleQuake) 512 fprintf( out, "F034 %s: improper teleseismic event type (distance %f deg)\n", 513 expl, dist ); 514 } /*endif*/ 423 515 424 516 } /* end of EfFInalCheck */
Note: See TracChangeset
for help on using the changeset viewer.