Пример #1
0
    def test_util_pspier(self):
        """ Tests pspier and pspier2. """
        slat = np.array([-10, 0])
        slon = np.array([-160, 10])
        slowness = np.array([6.4, 3.2])
        azi = np.array([13., 170.])
        depth = np.array([200, 200])
        rpier, plat, plon = util.pspier(depth, slat, slon, slowness, azi)
        rpier2, plat2, plon2 = util.pspier2(200, slat, slon, slowness, azi)

        np.testing.assert_array_almost_equal(rpier2, np.array([ 53.25370502, 25.95027721]))
        np.testing.assert_array_almost_equal(plat2, np.array([-9.53337395, -0.22982045]))
        np.testing.assert_array_almost_equal(plon2, np.array([-159.890609, 10.04052357]))
        np.testing.assert_array_almost_equal(rpier, rpier2, decimal=2)
        np.testing.assert_array_almost_equal(plat, plat2, decimal=2)
        np.testing.assert_array_almost_equal(plon, plon2, decimal=2)
Пример #2
0
    def test_util_trace3(self):
        from obspy.taup.taup import getTravelTimes
        iasp91 = Iasp91(5., 5000)
        slat = np.array([-10, 0])
        slon = np.array([-160, 10])
        slowness = np.array([6.4, 3.2])
        azi = np.array([13., 170.])
        depth = np.array([200, 200])
        rpier, plat, plon = iasp91.pspier(depth, slat, slon, slowness, azi, phase='S')
        rpier2, plat2, plon2 = util.pspier(depth, slat, slon, slowness, azi)
        np.testing.assert_array_almost_equal(rpier, rpier2, 0)
        np.testing.assert_array_almost_equal(plat, plat2, 2)
        np.testing.assert_array_almost_equal(plon, plon2, 2)

        tp, rp, phip = iasp91.trace3(6.4, phase='P', till_turn=False)
        taup = getTravelTimes(phip[-1] * 180 / np.pi, 0)
        self.assertTrue(abs(tp[-1] - taup[0]['time']) < 2)