Example #1
0
    def ttak135pf(self, phase_list=['P','Pn','Pg','p']):    # travel time of first P arrivals with AK135 model
        model = TauPyModel(model="ak135")
        
        if self.evdp>0 and self.evdp<1.4:
            self.evdp = 0
        
        arrivals = model.get_travel_times(self.evdp, self.gcarc, phase_list=phase_list)
        arr = arrivals[0]
#         self.phase = arr.name
        self.tak135 = arr.time
Example #2
0
    def ttak135sf(self, phase_list=['S','Sn','Sg','s']):    # travel time of first S arrivals with AK135 model
        model = TauPyModel(model="ak135")
        
        if self.evdp>0 and self.evdp<1.4:
            self.evdp = 0
        
        arrivals = model.get_travel_times(self.evdp, self.gcarc, phase_list=phase_list)
#         print len(arrivals), self.date, self.time, self.stla, self.stlo, self.evla, self.evlo
        arr = arrivals[0]
#         self.phase = arr.name
        self.tak135 = arr.time
Example #3
0
    def ttak135pf(
        self,
        phase_list=['P', 'Pn', 'Pg',
                    'p']):  # travel time of first P arrivals with AK135 model
        model = TauPyModel(model="ak135")

        if self.evdp > 0 and self.evdp < 1.4:
            self.evdp = 0

        arrivals = model.get_travel_times(self.evdp,
                                          self.gcarc,
                                          phase_list=phase_list)
        arr = arrivals[0]
        #         self.phase = arr.name
        self.tak135 = arr.time
Example #4
0
    def ttak135sf(
        self,
        phase_list=['S', 'Sn', 'Sg',
                    's']):  # travel time of first S arrivals with AK135 model
        model = TauPyModel(model="ak135")

        if self.evdp > 0 and self.evdp < 1.4:
            self.evdp = 0

        arrivals = model.get_travel_times(self.evdp,
                                          self.gcarc,
                                          phase_list=phase_list)
        #         print len(arrivals), self.date, self.time, self.stla, self.stlo, self.evla, self.evlo
        arr = arrivals[0]
        #         self.phase = arr.name
        self.tak135 = arr.time
                    print("Warning no data found in ", invfile, " for station",
                          ref_sta)
                    continue

            eve_lat = eve_coord[0]
            eve_lon = eve_coord[1]
            eve_dep = eve_coord[2]
            # print "sta_lon, sta_lat, eve_lon, eve_lat==", sta_lon,
            # sta_lat, eve_lon, eve_lat
            epi_dist, az, baz = gps2dist_azimuth(eve_lat, eve_lon, slat, slon)
            epi_dist = epi_dist / 1000
            deg = kilometer2degrees(epi_dist)
            model = TauPyModel(model=taup_model)
            arrivals = model.get_travel_times(
                source_depth_in_km=eve_dep,
                distance_in_degree=deg,
                phase_list=["s", "S"],
            )
            print(arrivals)
            # arrP = arrivals[0]
            arrS = arrivals[0]
            # correction to be used to evaluate the origin time of event
            origin_time_shift = arrS.time - half_time
            print("OT...= ", origin_time_shift)

    for ii, tr in enumerate(st):
        Tshift[ii] = Tshift[ii] - origin_time_shift
        ssta = tr.stats.station
        schan = tr.stats.channel
        snet = tr.stats.network
        s1 = (str(snet) + "." + str(ssta) + "." + str(schan) + " " +
Example #6
0
        try:
            #calculate GCARC (for some reason obspy does not read gcarc header)
            gcarc1 = haversineD(tr1.stats.sac.evla, tr1.stats.sac.evlo,
                                tr1.stats.sac.stla, tr1.stats.sac.stlo)
        except:
            print "ERROR: Can\'t calculate event distance, quitting", tr1
            #unlikely that any other station will have a P arrival, so break
            sys.exit(1)

        if args.verbose:
            print "delta=", gcarc1, "depth=", tr1.stats.sac.evdp
        #t1 = np.arange(0, tr1.stats.npts / tr1.stats.sampling_rate, tr1.stats.delta)

        try:
            #tt1=getTravelTimes(delta=gcarc1, depth=tr1.stats.sac.evdp, model='ak135',phase_list=['P'])[0]['time']
            ar1 = taupmodel_1.get_travel_times(tr1.stats.sac.evdp, gcarc1,
                                               ['P'])[0]
            in_angle1_rad = np.deg2rad(ar1.incident_angle)
            #extra travel time due to elevation
            if args.station_db:
                try:
                    stel1 = stdict[tr1.stats.station]['stel'] / 1000.
                except:
                    print "WARNING: No elevation for station", tr2.stats.station, "in database file", args.station_db, ", skipping"
                    continue
            else:
                try:
                    stel1 = tr1.stats.sac.stel / 1000.
                except:
                    print "WARNING: No elevation for station", tr1.stats.station, "in SAC file", bhz1file, ", skipping"
                    continue