void MWcheck_timing(Arr *a,Arr *arrsta,Arr *bcarr) { Tbl *stakeys; char *name; int i; stakeys = keysarr(a); for(i=0;i<maxtbl(stakeys);++i) { Bad_Clock *bc; MWstation *sta; double *atime; name=gettbl(stakeys,i); bc=(Bad_Clock *)getarr(bcarr,name); sta=(MWstation *)getarr(arrsta,name); if(sta==NULL) elog_complain(0,"MWcheck_timing: no match in station table for arrival at station %s\n",name); else { if(bc==NULL) sta->clock_is_bad=0; else { atime = (double *)getarr(a,name); if(clock_is_bad(bc->badtimes,*atime)) sta->clock_is_bad=1; else sta->clock_is_bad=0; } } } }
StachanCalib * get_StachanCalib( char *site_id, char *channel_identifier ) { char key_specific[STRSZ]; char key_default[STRSZ]; StachanCalib *scc; sprintf( key_specific, "%s:%s", site_id, channel_identifier ); sprintf( key_default, "%s:%s", "default", channel_identifier ); scc = (StachanCalib *) getarr( Stachan_calibs, key_specific ); if( scc == (StachanCalib *) NULL ) { if( VeryVerbose ) { elog_notify( 0, "Couldn't find customized " "offsets for %s:%s; " "using defaults.\n", site_id, channel_identifier ); } scc = (StachanCalib *) getarr( Stachan_calibs, key_default ); scc = dup_StachanCalib( scc ); setarr( Stachan_calibs, key_specific, (void *) scc ); } return scc; }
/* companion to the above, but this version will copy entries in *in to *o. Errors are issued only if *o does not contain an entry for the same key as *in. If *o is null the dup function above is called and the function returns immediately after returning from it. */ void copy_arrival_array(Arr *in,Arr **o) { Tbl *t; double *value,*copy; char *key; int i; if((*o) == NULL) { *o = newarr(0); dup_arrival_array(in,o); } else { t = keysarr(in); for(i=0;i<maxtbl(t);++i) { key = gettbl(t,i); value = (double *)getarr(in,key); copy = (double *)getarr(*o,key); if(copy == NULL) { setarr(*o,key,value); } else { *copy = *value; } } freetbl(t,0); } }
static Orb_relic * get_Orb_relic( int orbfd ) { Orb_relic *or; char key[STRSZ]; sprintf( key, "%d", orbfd ); if( Orb_relics == (Arr *) NULL ) { elog_complain( 0, "Unexpected failure finding orb relic\n" ); return (Orb_relic *) NULL; } or = getarr( Orb_relics, key ); if( or == (Orb_relic *) NULL ) { elog_complain( 0, "Unexpected failure finding orb relic\n" ); return (Orb_relic *) NULL; } return or; }
int pfpeek( Pf *pf, char *name, Pf **value ) { switch( pf->type ) { case PFFILE: case PFARR: *value = (Pf *) getarr( pf->value.arr, name ); break; case PFTBL: *value = (Pf *) gettbl( pf->value.tbl, (long) name ); break; #ifdef PFPROMPT case PFPROMPT: #endif case PFSTRING: /* Can't have named child of a prompt or a string */ *value = 0; break; } if( *value == 0 ) { return PFINVALID; } else { return (*value)->type; } }
/* This routine computes initial ray coordinate direction definition based on slowness vector u0 and surface velocity tagged to the reference station. It returns the spherical coordinates of the propagation vector in 3-space. Note this is theoretical particle motion direction for a P wave and orthogonal to theoretical motion of an S phase. Note also algorithm does try to use correct angle for P or S phases. */ Spherical_Coordinate estimate_initial_polarization(MWSlowness_vector u0, Arr *stations, char *refsta, char *phase) { Spherical_Coordinate x; MWstation *s; double slow; double pv; x.radius = 1.0; s = getarr(stations,refsta); if(s == NULL) { elog_complain(0,"estimate_initial_polarization function could not locate reference station %s\nSetting initial emergence angle to vertical\n", refsta); x.theta = 0.0; } else { slow = hypot(u0.ux,u0.uy); if(is_S(phase)) pv = slow*(s->vs0); else pv = slow*(s->vp0); x.theta = asin(pv); } x.phi = atan2(u0.ux,u0.uy); return(x); }
int ATM_cggrid_unregister( CGGrid *cgg ) { char *key; if( ATM_CGGrid_Registry == (Arr *) NULL ) { mexWarnMsgTxt( "internal error, cggrid registry " "not initialized" ); return 0; } allot( char *, key, STRSZ ); sprintf( key, "%x", (unsigned long) cgg ); if( getarr( ATM_CGGrid_Registry, key ) == NULL ) { free( key ); mexWarnMsgTxt( "cggrid is already unregistered" ); return 1; } delarr( ATM_CGGrid_Registry, key ); free( key ); return 1; }
/* This function is used to exactly duplicate the arrival array of doubles from i to o. If *o is not a null pointer it is assumed the arr already exists and freearr is called to clear it's contents before calling setarr to copy contents.*/ void dup_arrival_array(Arr *in,Arr **o) { Tbl *t; double *value,*copy; char *key; int i; if((*o) == NULL) *o = newarr(0); else { freearr(*o,free); *o=newarr(0); } t = keysarr(in); for(i=0;i<maxtbl(t);++i) { key = gettbl(t,i); value = (double *)getarr(in,key); allot(double *,copy,1); *copy = *value; setarr(*o,key,copy); } freetbl(t,0); }
/* This small function returns an associative array of pointers to doubles keyed by station names that are the arrival times read from the database. Because we are dealing with this db bundle pointer this is simpler than manipulating the db directly Author: G Pavlis */ Arr *get_arrivals(Dbptr dbbundle) { int is, ie; Arr *a; double time,*t; char sta[20]; dbget_range(dbbundle,&is,&ie); a = newarr(0); for(dbbundle.record=is;dbbundle.record<ie;++dbbundle.record) { if(dbgetv(dbbundle,0, "sta",sta, "arrival.time", &time,0) == dbINVALID) { elog_complain(0,"dbgetv error reading arrival information from row %d\n", dbbundle.record); continue; } /* the idea here is to skip this step if an arrival is already set. This often because only every third trace or a three-component set yields a unique station name */ if(getarr(a,sta) == NULL) { t=malloc(sizeof(double)); if(t==NULL)elog_die(0,"get_arrivals malloc failure for simple double\n"); *t = time; setarr(a,sta,(void *)t); } } return(a); }
int ATM_cggrid_is_registered( CGGrid *cgg ) { char *key; int retcode; if( ATM_CGGrid_Registry == (Arr *) NULL ) { mexWarnMsgTxt( "internal error, cggrid registry " "not initialized" ); return 0; } allot( char *, key, STRSZ ); sprintf( key, "%x", (unsigned long) cgg ); if( getarr( ATM_CGGrid_Registry, key ) != NULL ) { retcode = 1; } else { retcode = 0; } free( key ); return retcode; }
int load_surface_velocity(Pf *pf, Arr *a) { int nset; Tbl *t; char sta[10]; double vp,vs; char *line; MWstation *s; int i; t = pfget_tbl(pf,"surface_velocities"); if(t == NULL) elog_die(0,"surface_velocities table missing from parameter file\n"); for(i=0,nset=0;i<maxtbl(t);i++) { line = gettbl(t,i); if((sscanf(line,"%s %lf %lf",sta,&vp,&vs)) != 3) { elog_notify(0,"Syntax error reading line from surface_velocity table\nOffending line->%s\n", line); continue; } s = (MWstation *)getarr(a,sta); if(s == NULL) { elog_notify(0,"Station %s listed in surface_velocity table not found in master table\n", sta); continue; } s->vp0 = vp; s->vs0 = vs; ++nset; } return(nset); }
void init( ) { Pf *Param; Tbl *Site; DAS *das; struct Site site; char *istr; char dasid[6]; int pkttype; int ntrec, i, j; int nsite; int *num = 0; if(pfread( pfile, &Param) != 0) die(0, "Can't read parameter file\n"); /* Get Input & Network tables */ Site = pfget_tbl(Param, "Site"); nsite = maxtbl(Site); if( nsite <= 0 ) die( 0, "init(): parameter file is not complete.\n"); Dases = newarr( 0 ); Dasid = newarr( 0 ); for( i = 0; i < nsite; i++ ) { istr = (char *) gettbl(Site, i); sscanf(istr, STE_SCS, STE_RVL(&site)); if( !strcmp(site.up, "Y") ) { sprintf( dasid, "%d\0", site.sid ); if( ( das = ( DAS *) getarr( Dases, dasid ) ) == NULL ) { das = new_das( site.sid, site.name ); setarr(Dases, (char *) &dasid[0], (char *) das ); } if( (num = ( int *) getarr( Dasid, site.name ) ) == NULL ) { allot( int *, num, 1 ); *num = site.sid; setarr(Dasid, (char *) site.name, (char *) num ); } }
static PyObject * pf2PyObject( Pf *pf ) { PyObject *obj; Pf *pfvalue; Tbl *keys; char *key; int ivalue; switch( pf->type ) { case PFSTRING: obj = string2PyObject( pfexpand( pf ) ); break; case PFTBL: obj = PyTuple_New( pfmaxtbl( pf ) ); for( ivalue = 0; ivalue < pfmaxtbl( pf ); ivalue++ ) { pfvalue = (Pf *) gettbl( pf->value.tbl, ivalue ); PyTuple_SetItem( obj, ivalue, pf2PyObject( pfvalue ) ); } break; case PFFILE: case PFARR: keys = keysarr( pf->value.arr ); obj = PyDict_New(); for( ivalue = 0; ivalue < maxtbl( keys ); ivalue++ ) { key = gettbl( keys, ivalue ); pfvalue = (Pf *) getarr( pf->value.arr, key ); PyDict_SetItem( obj, Py_BuildValue( "s", key ), pf2PyObject( pfvalue ) ); } break; case PFINVALID: default: obj = (PyObject *) NULL; break; } return obj; }
/* trap needed because wfdisc and site are required tables. */ void check_for_required_tables(Arr *tabarray) { int *test; int need_to_die=0; test = (int *)getarr(tabarray,"site"); if( (test == NULL) || ((*test) == 0) ) { elog_complain(0,"Cannot find required table site in db\n"); ++need_to_die; } test = (int *)getarr(tabarray,"wfdisc"); if( (test == NULL) || ((*test) == 0) ) { elog_complain(0,"Cannot find required table wfdisc in db\n"); ++need_to_die; } if(need_to_die) elog_die(0,"Cannot proceed without required tables\n"); }
char *get_fixlist(Arr *a,int evid) { char *o; char *key; key = make_evid_key(evid); o=(char *)getarr(a,key); free(key); return(o); }
static int dbrows2orb(Dbptr db, int orb, char *prefix) { Packet *pkt; char srcname[ORBSRCNAME_SIZE]; double time; char *packet; int nbytes, packetsize = 0; Dbptr tmpdb; long t, nrecords, r, ntables; Arr *records = NULL; Tbl *tables = NULL, *static_tables; char *thistablename; Stbl *stbl; char *s; dbuntangle(db, &records); tables = keysarr(records); ntables = maxtbl(tables); if (ntables > 0) pkt = newPkt(); if (prefix) strncpy(pkt->parts.src_net, prefix, PKT_TYPESIZE); pkt->pkttype = suffix2pkttype("db"); for (t = 0; t < ntables; t++) { thistablename = gettbl(tables, t); tmpdb = dblookup(db, 0, thistablename, 0, 0); stbl = (Stbl *) getarr(records, thistablename); nrecords = maxstbl(stbl); if (nrecords > 0) { for (r = 0; r < nrecords; r++) { tmpdb.record = (long) getstbl(stbl, r); pkt->db = tmpdb; if (stuffPkt(pkt, srcname, &time, &packet, &nbytes, &packetsize) < 0) { elog_complain(0, "stuffPkt fails for pf packet"); return (-1); } if (orbput(orb, srcname, time, packet, nbytes) < 0) { elog_complain(0, "Couldn't send packet to orb\n"); return (-1); } } } } freetbl(tables, 0); dbfree_untangle(records); freePkt(pkt); if (verbose) { elog_notify(0, "%s: %d patcket(s) sent with sourcename: %s\n", s = strtime(now()), nrecords, srcname); free(s); } return (0); }
/* This is the translation routine similar to dbload_arrival_table and load_arrival_table in libgenloc. Arguments: hyp - input structure stations - associative array of station structures arrphase - associate array of phase handles. Function returns tbl of Arrival objects used by genloc routines. Author: G Pavlis written: january 30, 1998 */ Tbl *orbhypo_to_genloc(ORB_Hypocenter *hyp, Arr *arrphase, Arr *stations) { Arrival *a; Tbl *t; int i; t = newtbl(0); for(i=0;i<hyp->nass;++i) { a = (Arrival *) malloc(sizeof(Arrival)); if(a == NULL) elog_die(1,"orbhypo_to_genloc cannot malloc Arrival structure\n"); a->sta = (Station *) getarr(stations,hyp->assocs[i].sta); if(a->sta == NULL) { elog_complain(1,"Cannot find coordinates for station %s\n%s phase arrival for this station skipped\n", hyp->assocs[i].sta, hyp->assocs[i].iphase); free(a); continue; } a->arid = hyp->assocs[i].arid; a->time = hyp->assocs[i].time; a->phase = (Phase_handle *) getarr(arrphase, hyp->assocs[i].iphase); if(a->phase == NULL) { if ( strcmp(hyp->assocs[i].iphase, "D") != 0 ) { elog_complain(1,"Don't know how to handle phase '%s'" " -- Arrival at %s at time %lf skipped\n", hyp->assocs[i].iphase,hyp->assocs[i].sta, hyp->assocs[i].time); } free(a); continue; } /* the current real-time system has no uncertainty estimate on the picks so we always use the default */ a->deltat = (double)a->phase->deltat0; pushtbl(t,a); } return(t); }
int unstuffpkt( double time, char *srcid, char *packet, Packet **Pkt ) { uchar_t *hdr; struct DataPar dphdr; char hdrbuf[512]; Raw *raw; short hdrsize, pktsize; ushort_t hdrtype, pkttype; int code , ret ; char key[64]; if( !strncmp( srcid, "/", 1) && strncmp( srcid, "/dcdas", 6) ) return 2; hdr = (uchar_t *) &hdrbuf[0]; memcpy( hdr, packet, sizeof( struct PreHdr) ); memcpy( &hdrsize, hdr, sizeof( short ) ); hdr += sizeof( short ); hdrsize = ntohs( hdrsize); dphdr.hdrsize = hdrsize; memcpy( &pktsize, hdr, sizeof( short ) ); hdr += sizeof( short ); pktsize = ntohs( pktsize); dphdr.pktsize = pktsize; memcpy( &hdrtype, hdr, sizeof( short ) ); hdr += sizeof( short ); hdrtype = ( ushort_t ) ntohs( hdrtype); dphdr.hdrtype = hdrtype; memcpy( &pkttype, hdr, sizeof( short ) ); pkttype = ( ushort_t ) ntohs( pkttype); dphdr.pkttype = pkttype; if( hdrtype == -1 ) { complain( 0, "Can't get packet/header type.\n" ); return 0; } sprintf( key, "%d\0", pkttype ); if( RawPkts == NULL ) init_RawPkts(); raw = ( Raw *) getarr( RawPkts, (char *) &key[0] ); if( raw == NULL ) { complain( 0, " unstuffpkt(): Can't get RawPkts info for %s\n", key ); return 0; } return read_raw( time, srcid, (uchar_t *)packet, Pkt, (void *) &dphdr,raw->read); }
/* This is the routine that uses the Arr produced by build_stachan_list. It returns and integer index of the station/channel defined by sta,chan. If that station and channel are not found in the Arr, it returns -1. */ int get_channel_index(Arr *a, char *sta, char *chan) { char *key; int *ichan; key = make_key(sta,chan); ichan = (int *)getarr(a,key); if(ichan == NULL) return(-1); else return(*ichan); }
void set_shot_variable(Dbptr db, Arr *tables, int evid, SEGYTraceHeader *h) { int *ok; char ss_string[30]; long int ntest; double dnorth, deast, elev, edepth; ok = getarr(tables,"shot"); if(ok) { db = dblookup(db,0,"shot",0,0); sprintf(ss_string,"evid == %d",evid); db = dbsubset(db,ss_string,0); dbquery(db,dbRECORD_COUNT,&ntest); if(ntest <= 0) { elog_complain(0,"evid %d not found in shot table\nShot coordinates will not be saved in segy headers\n", evid); dbfree(db); return; } else if(ntest > 1) { elog_notify(0,"multiple rows in shot found for evid %d\n", evid); } db.record = 0; if(dbgetv(db,0, "dnorth",&dnorth, "deast", &deast, "elev", &elev, "edepth",&edepth, NULL) == dbINVALID) { elog_complain(0,"dbgetv error for evid %d\nShot coordinates will not be saved in segy headers\n", evid); return; } /*convert to m from km */ deast *= 1000.0; dnorth *= 1000.0; h->sourceLongOrX = htonl((int32_t) deast); h->sourceLatOrY = htonl((int32_t) dnorth); h->sourceSurfaceElevation = htonl((int32_t) elev); h->sourceDepth = htonl((int32_t) edepth); /* WARNING: This assumes receiver coordinates have already been set */ h->sourceToRecDist = htonl( (int32_t) hypot( dnorth - ((double)(ntohl(h->recLatOrY ))), deast - ((double)(ntohl(h->recLongOrX))) )); } dbfree(db); }
StaStatus * get_StaStatus( char *sta ) { StaStatus *ss; mutex_lock( &Sta_statuses_mutex ); ss = (StaStatus *) getarr( Sta_statuses, sta ); mutex_unlock( &Sta_statuses_mutex ); return ss; }
int get_priority( char * alert_name, orbinfo * oi ) { int i; int size; Arr * level; Tbl * alerttbl; alerttbl = valsarr( oi->alert_stages ); size = maxtbl( alerttbl ); for ( i = 0; i < size; i++ ) { level = (Arr*) poptbl( alerttbl ); if ( strcmp( getarr( level, NAME ), alert_name ) == 0 ) { freetbl( alerttbl, 0 ); return atoi( getarr( level, PRIORITY )); } } freetbl( alerttbl, 0 ); return -1; }
/* Edits the array of phase handles to keep only phases named in the keeplist Tbl of phase names strings. This is complicated by the fact that keeplist is a simple list. The algorithm used converts the keeplist to a temporary associative array then passes through the array of phase handles calling the free routine on phases not found in the keeplist. Author: G Pavlis Written: August 2001 */ void edit_phase_handle(Arr *a,Tbl *keeplist) { Tbl *akeys; Arr *akeeper; int dummy; /* used purely as a placeholder in akeeper*/ char *phase; int i,n; Phase_handle *ph; n = maxtbl(keeplist); if(n<=0) elog_die(0,"List of phases to keep is empty.\n\ Check phases_to_keep parameter setting\n"); akeeper = newarr(0); for(i=0; i<maxtbl(keeplist); ++i) { phase = (char *)gettbl(keeplist,i); setarr(akeeper,phase,&dummy); ph = (Phase_handle *)getarr(a,phase); if(ph==NULL)elog_die(0, "Don't know how to handle required phase %s\n", phase); } akeys = keysarr(a); for(i=0; i<maxtbl(akeys); ++i) { phase = gettbl(akeys,i); if(getarr(akeeper,phase) == NULL) { ph = (Phase_handle *)getarr(a,phase); free_phase_handle(ph); delarr(a,phase); } } freearr(akeeper,0); freetbl(akeys,0); }
char *get_refsta(Arr *s) { char *ref; MWstation *station; char *key; Tbl *t; t = keysarr(s); key = gettbl(t,0); station = (MWstation *) getarr(s,key); ref = strdup(station->refsta); freetbl(t,0); return(ref); }
Dbptr join_tables(Dbptr db, Pf *pf, Arr *tables) { char *table_name; int *ilogic; Tbl *t; Dbptr dbj; long int nrec; int i; int ntables=0; /* This is an exact copy of above, but it is duplicated because this function could get stolen by another future program because it is pretty general */ t = pfget_tbl(pf,"join_tables"); if(t == NULL) { elog_die(0,"No list of tables to be joined\n"); } for(i=0;i<maxtbl(t);++i) { table_name = gettbl(t,i); ilogic = (int *)getarr(tables,table_name); if(ilogic == NULL) { elog_die(0,"Table %s was not handled previously by check_tables.\nProgramming logic error\n", table_name); } else if(*ilogic) { if(ntables == 0) dbj = dblookup(db,0,table_name,0,0); else dbj=dbjoin(dbj,dblookup(db,0,table_name,0,0), NULL,NULL,0,NULL,0); ++ntables; dbquery(dbj,dbRECORD_COUNT,&nrec); if(nrec == 0) { elog_complain(0, "join_tables error\njoined database has 0 length after joining table %s\n", table_name); dbj.record = dbINVALID; return(dbj); } } } return(dbj); }
static int report_nonroutable( char *address ) { if( Nonroutable == (Arr *) NULL ) { Nonroutable = newarr( 0 ); } if( getarr( Nonroutable, address ) == NULL ) { setarr( Nonroutable, address, 0x1 ); return 1; } else { return 0; } }
int whatis_pkttype( uchar_t *packet ) { Raw *raw; PktPar *pkt; ushort_t *val; ushort_t code; char *parse; int i, nelem; char key[64]; val = ( ushort_t *) packet; code = *val; Par.raw.pkttype = code; if( RawPkts == NULL) init_RawPkts(); sprintf( key, "%d\0", code ); if( code == 0 ) { complain( 0, " whatis_pkttype(): Can't recognize a packet type %0x%0x\n", packet[0], packet[1] ); return -1; } raw = ( Raw *) getarr( RawPkts, (char *) &key[0] ); if( raw == NULL ) { complain( 0, " whatis_pkttype(): Can't get RawPkts info for %0x%0x\n", packet[0], packet[1] ); return -1; } memcpy( (char *) &Par.raw, (char *) raw, sizeof( Raw ) ); switch( parse_raw( packet, raw->parse, raw->pkttype ) ) { case -1: complain( 0, " whatis_pkttype(): Can't parse raw packet - %0x%0x\n", packet[0], packet[1] ); return -1; case 0: return 0; case 1: return (int) raw->pkttype; } }
int load_initial_statics(Pf *pf, Arr *a) { int nset; Tbl *t; char sta[10]; double statics; char *line; MWstation *s; int i; t = pfget_tbl(pf,"initial_statics"); if(t == NULL) { elog_notify(0,"initial_statics table missing from parameter file. initial statics all set to 0.0\n"); return(0); } for(i=0,nset=0;i<maxtbl(t);i++) { line = gettbl(t,i); if((sscanf(line,"%s %lf %lf",sta,&statics)) != 2) { elog_notify(0,"Syntax error reading line from initial_statics Tbl\nOffending line->%s\n", line); continue; } s = (MWstation *)getarr(a,sta); if(s == NULL) { elog_notify(0,"Station %s listed in initial_statics table not found in master table\n", sta); continue; } elog_log(0,"Setting initials static for %s to %lf\n", sta,statics); s->initial_static = statics; ++nset; } return(nset); }
/* This is the function actually called to build and fill the multiwavelet station objects. It basically calls all three functions defined above in the correct sequence. This was an intentional modularization done to simply code maintenance by separating out some parts linked to different input objects (i.e. pfs versus dbs). The function returns an assembled Arr containing pointers to MWstation objects keyed by the station name. Arguments: db - Database pointer to css3.0 database with a site table pf - parameter object previously loaded time - epoch time of start of this data set. The "time" variable is needed due to a peculiarity of how site is keyed in css3.0. (see the load_station_geometry function comments above for details.) Author: G. Pavlis Written: March 1999 */ Arr *build_station_objects(Dbptr db, Pf *pf, double time) { int nsta_pf,nsta; /* nsta_pf is the number of stations defined in the parameter file descriptions while nsta is used for comparison from each function */ int nbands; /* number of frequency bands (needed to define weight vectors */ Arr *a; char *refsta; MWstation *s; nbands = pfget_int(pf,"number_frequency_bands"); a = create_station_objects(pf,nbands); nsta_pf = cntarr(a); nsta = load_surface_velocity(pf, a); if(nsta != nsta_pf) elog_complain(0,"Surface velocity defined for only %d of %d stations\n", nsta,nsta_pf); nsta = load_station_geometry(db,a,time); if(nsta<=0) elog_die(0,"load_station_geometry failed to match any stations in parameter file with database site table\n"); if(nsta != nsta_pf) elog_complain(0,"Missing entries in site table\nMatched only %d of %d defined in the parameter file\n", nsta,nsta_pf); /* This is an extra sanity check. We require refsta to be in the site table or all hell will break loose. */ refsta = get_refsta(a); s = (MWstation *)getarr(a,refsta); if(s == NULL) elog_die(0,"Station site table error: reference station %s must appear in site table\n", refsta); free(refsta); nsta = load_initial_statics(pf, a); elog_log(0,"Set initial statics on %d stations\n",nsta); return(a); }
/* This simple procedure returns if a list of evids is found as a fixed depth entry already in the existing list */ int in_fixdepthlist(Arr *a, int *evid, int nevents) { int result; char *o; char *key; int i; for(i=0;i<nevents;++i) { key=make_evid_key(evid[i]); o=(char *)getarr(a,key); if(o!=NULL) { /* Accept any fixed coordinate as true. Could spell trouble, but this whole features is a bit of a bell and whistle. */ free(key); return(1); } free(o); } return(0); }