Changeset 87 for SH_SHM/trunk/util


Ignore:
Timestamp:
12/10/2008 08:46:37 AM (14 years ago)
Author:
marcus
Message:

r69 | svn | 2008-12-07 15:30:25 +0100 (So, 07 Dez 2008) | 1 line

more tests in check_evt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • SH_SHM/trunk/util/check_evt.c

    r86 r87  
    4040#include "eventdsc.h" 
    4141#include "tcusrdef.h" 
     42#include "earthloc.h" 
    4243 
    4344 
     
    5051#define EVTYPE_PKP   3 
    5152 
    52 /* next error number currently 024 */ 
     53/* next error number currently 031 */ 
    5354 
    5455 
    5556 
    5657/* global variables */ 
     58static float   efv_reflat=49.0;           /* reference latitude */ 
     59static float   efv_reflon=11.0;           /* reference longitude */ 
    5760static char    efv_infile[BC_FILELTH+1];  /* name of input file */ 
    5861static char    efv_uncorrphase[EvPHASELTH+1]; /* name of phase on uncorr beam */ 
    5962static BOOLEAN efv_first_arrival=FALSE;   /* first arrival phase selected */ 
    6063static BOOLEAN efv_only_grf=TRUE;         /* only GRF stations used */ 
     64static BOOLEAN efv_gra1_picked=FALSE;     /* pick on GRA1 found */ 
    6165static BOOLEAN efv_uncorr_loc=FALSE;      /* uncorrected beam for location */ 
    6266static BOOLEAN efv_telex_phase=FALSE;     /* telex phase found */ 
     
    7074static int     efv_pkp_count=0;           /* number of PKP phases */ 
    7175static BOOLEAN efv_illegal_origin;        /* illegal origin time */ 
    72  
     76static BOOLEAN efv_foundPg=FALSE;         /* Pg phase found */ 
     77static BOOLEAN efv_foundPnSn=FALSE;       /* Pn/Sn found */ 
     78static BOOLEAN efv_foundTele=FALSE;       /* teleseismic phase found */ 
     79static float   efv_latitude=0.0;          /* epicentre latitude */ 
     80static float   efv_longitude=0.0;         /* epicentre longitude */ 
     81static char    efv_analyst[EvANALYSTLTH+1]=""; /* analysts initials */ 
     82static BOOLEAN efv_showinitials=FALSE;    /* show initials */ 
    7383 
    7484 
     
    91101        /* executable code */ 
    92102 
    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] ); 
    95106                return 1; 
    96107        } /*endif*/ 
    97108 
    98109        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); 
    100119 
    101120        /* efv_infile is used for messages, directory will be removed */ 
     
    151170        /* is a location given here ? */ 
    152171        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*/ 
    153176 
    154177        /* is this an L phase ? */ 
     
    162185        /* is this a PKP phase ? */ 
    163186        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; 
    164201 
    165202        if  (event->event_type != EvcEventTypeUndefined) 
     
    170207 
    171208        /* 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') 
    173211                efv_only_grf = FALSE; 
     212        if  (strcmp(event->station,"GRA1") == 0) 
     213                efv_gra1_picked = TRUE; 
    174214 
    175215        /* is a first arrival phase there ? */ 
     
    315355        } /*endif*/ 
    316356 
     357        if  (event->analyst[0] != '\0') 
     358                strcpy( efv_analyst, event->analyst ); 
     359 
    317360} /* end of EfPutCheck */ 
    318361 
     
    365408 */ 
    366409{ 
     410        /* local variables */ 
     411        char     expl[cBcLongStrLth+1];   /* explanation string */ 
     412 
    367413        /* executable code */ 
    368414 
    369415        /* 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 ); 
    370420 
    371421        /* a first arrival must be specified */ 
    372422        if  (!efv_first_arrival) 
    373                 fprintf( out, "F014 %s: no first arrival phase selected\n", efv_infile ); 
     423                fprintf( out, "F014 %s: no first arrival phase selected\n", expl ); 
    374424 
    375425        /* beam with uncorrected slowness at GRF is at least suspicious */ 
    376426        if  (efv_only_grf && efv_uncorr_loc) 
    377427                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 ); 
    379433 
    380434        /* no telex phase */ 
    381435        /* disabled 12-Nov-2008 K.S. 
    382436        if  (!efv_telex_phase) 
    383                 fprintf( out, "F016 %s: no telex phase found\n", efv_infile ); 
     437                fprintf( out, "F016 %s: no telex phase found\n", expl ); 
    384438        */ 
    385439 
    386440        /* mb determined? */ 
    387441        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 ); 
    390443 
    391444        /* Ms determined? */ 
     
    393446                !efv_ms_found) 
    394447                fprintf( out, "F018 %s: no Magnitude Ms determined for magn %3.1f event\n", 
    395                         efv_infile, efv_magn ); 
     448                        expl, efv_magn ); 
    396449        if  (efv_subtype == EVTYPE_PKP && efv_depth <= 50.0 && efv_pkp_count > 3 && 
    397450                !efv_ms_found) 
    398451                fprintf( out, "F019 %s: no Magnitude Ms determined for PKP event\n", 
    399                         efv_infile ); 
     452                        expl ); 
    400453        if  (efv_ms_found && efv_depth > 50.0) 
    401454                fprintf( out, "F020 %s: Magnitude Ms determined for depth %5.1f event\n", 
    402                         efv_infile, efv_depth ); 
     455                        expl, efv_depth ); 
    403456 
    404457        /* Mbb determined? */ 
    405458        if  (efv_mb_found && efv_magn > 6.2 && !efv_mbb_found) 
    406459                fprintf( out, "F021 %s: no Broadband Magnitude determined for magn %3.1f event\n", 
    407                         efv_infile, efv_magn ); 
     460                        expl, efv_magn ); 
    408461 
    409462        /* depth ok? */ 
    410463        if  (efv_evtype == EvcEventTypeMining && Abs(efv_depth-1.0) > 0.1) 
    411464                fprintf( out, "F022 %s: depth %5.1f given for mining event\n", 
    412                         efv_infile, efv_depth ); 
     465                        expl, efv_depth ); 
    413466        if  (efv_evtype == EvcEventTypeBlast && Abs(efv_depth) > 0.1) 
    414467                fprintf( out, "F023 %s: depth %5.1f given for blast\n", 
    415                         efv_infile, efv_depth ); 
     468                        expl, efv_depth ); 
    416469        if  (efv_evtype == EvcEventTypeTeleQuake && (efv_depth < 10.0)) 
    417470                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 ); 
    419479        if  (efv_evtype == EvcEventTypeUndefined) 
    420                 fprintf( out, "F024 %s: no event type specified\n", efv_infile ); 
     480                fprintf( out, "F024 %s: no event type specified\n", expl ); 
    421481        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*/ 
    423515 
    424516} /* end of EfFInalCheck */ 
Note: See TracChangeset for help on using the changeset viewer.