def create_arrival(pickresID, cinfo, phase, azimuth=None, dist=None): ''' create_arrival - function to create an Obspy Arrival :param pickresID: Resource identifier of the created pick :type pickresID: :class: `~obspy.core.event.ResourceIdentifier` object :param cinfo: An ObsPy :class: `~obspy.core.event.CreationInfo` object holding information on the creation of the returned object :type cinfo: :class: `~obspy.core.event.CreationInfo` object :param phase: name of the arrivals seismic phase :type phase: str :param azimuth: azimuth between source and receiver :type azimuth: float or int, optional :param dist: distance between source and receiver :type dist: float or int, optional :return: An ObsPy :class: `~obspy.core.event.Arrival` object ''' arrival = ope.Arrival() arrival.creation_info = cinfo arrival.pick_id = pickresID arrival.phase = phase if azimuth is not None: arrival.azimuth = float(azimuth) if azimuth > -180 else azimuth + 360. else: arrival.azimuth = azimuth arrival.distance = dist return arrival
def make_arrivals(picks): """Create arrivals for testing.""" counter = 1 params = {"phase": "P"} arrivals = [] picks = picks or [] for pick in picks: a = ev.Arrival( pick_id=pick.resource_id, time_correction=counter * 0.05, azimuth=counter * 5, distance=counter * 0.1, takeoff_angle=counter * 2, time_residual=counter * 0.15, horizontal_slowness_residual=counter * 0.2, backazimuth_residual=counter * 0.25, time_weight=counter * 0.3, horizontal_slowness_weight=counter * 0.4, backazimuth_weight=counter * 0.5, earth_model_id=ev.ResourceIdentifier(), creation_info=ev.CreationInfo( agency_id="dummy_agency", author="dummy", creation_time=UTCDateTime() ), **params, ) arrivals.append(a) counter += 1 return arrivals
def _create_arrival(ser): origin = get_object(ser.orid) arrival = oe.Arrival( pick_id=rid(ser.arid), time_residual=ser.timeres, time_weight=ser.wgt, azimuth=ser.esaz, phase=ser.phase, distance=ser.delta, ) origin.arrivals.append(arrival)
def event_non_orphaned_rejected_pick(self, event_rejected_pick): """ Change both picks to rejected but reference one from arrival. """ eve = event_rejected_pick.copy() picks = eve.picks for pick in picks: pick.evaluation_status = "rejected" first_pick_rid = str(picks[0].resource_id) # now create origin and arrival arrival = ev.Arrival(pick_id=first_pick_rid) origin = ev.Origin( latitude=0, longitude=0, depth=10, time=picks[0].time, arrivals=[arrival] ) eve.origins.append(origin) return eve
def _get_arrival(): return ev.Arrival( resource_id=ev.ResourceIdentifier('smi:local/Ar1'), pick_id=state['pick_id'], phase='P', time_correction=.2, azimuth=12, distance=10, takeoff_angle=15, takeoff_angle_errors={'uncertainty': 10.2}, time_residual=.02, horizontal_slowness_residual=12.2, backazimuth_residual=12.2, time_weight=.23, horizontal_slowness_weight=12, backazimuth_weight=12, earth_model_id=ev.ResourceIdentifier(), commens=[ev.Comment(x) for x in 'Nothing'], )