예제 #1
0
class SimpleModelTestCase(unittest.TestCase):

    def setUp(self):
        self.stream = RFStream(read())
        self.stream._write_test_header()
        self.model = load_model()

    def test_ppoint(self):
        xy_plat_P = 50.29670878  # 200km sppier
        xy_plon_P = -97.24776461  # 200km sppier
        xy_plat_S = 50.29862202  # 200km pspier
        xy_plon_S = -98.96394212  # 200km pspier

        st = self.stream[0].stats
        self.model.ppoint(st, 200, phase='P')
        self.assertLess(abs((st.plat - xy_plat_P) /
                            (st.plat - st.station_latitude)), 1)  # very big
        self.assertLess(abs((st.plon - xy_plon_P) /
                            (st.plon - st.station_longitude)), 0.05)

#        print 'station lon ', st.station_longitude
#        print 'xy lon    P ', xy_plon_P
#        print 'model lon P ', st.plon
#        print
#        print 'station lat ', st.station_latitude
#        print 'xy lat    P ', xy_plat_P
#        print 'model lat P ', st.plat
#        print

        self.model.ppoint(st, 200, phase='S')
        self.assertLess(abs((st.plat - xy_plat_S) /
                            (st.plat - st.station_latitude)), 1)  # very big
        self.assertLess(abs((st.plon - xy_plon_S) /
                            (st.plon - st.station_longitude)), 0.05)

#        print 'station lon ', st.station_longitude
#        print 'xy lon    S ', xy_plon_S
#        print 'model lon S ', st.plon
#        print
#        print 'station lat ', st.station_latitude
#        print 'xy lat    S ', xy_plat_S
#        print 'model lat S ', st.plat

    def test_moveout(self):
        self.model.moveout(self.stream)
        i = 20
        for tr in self.stream:
            tr.stats.distance = i
            i = i + 50
        self.model.moveout(self.stream)
예제 #2
0
class SimpleModelTestCase(unittest.TestCase):

    def setUp(self):
        self.stream = RFStream(read())
        self.stream._write_test_header()

    def test_ppoint(self):
        xy_plat_P = 50.29670878  # 200km sppier
        xy_plon_P = -97.24776461  #200km sppier
        xy_plat_S = 50.29862202  # 200km pspier
        xy_plon_S = -98.96394212  #200km pspier

        st = self.stream[0].stats
        ppoint(self.stream, 200, phase='P')
        self.assertLess(abs((st.plat - xy_plat_P) /
                            (st.plat - st.station_latitude)), 1)  # very big
        self.assertLess(abs((st.plon - xy_plon_P) /
                            (st.plon - st.station_longitude)), 0.05)

#        print 'station lon ', st.station_longitude
#        print 'xy lon    P ', xy_plon_P
#        print 'model lon P ', st.plon
#        print
#        print 'station lat ', st.station_latitude
#        print 'xy lat    P ', xy_plat_P
#        print 'model lat P ', st.plat
#        print

        ppoint(self.stream, 200, phase='S')
        self.assertLess(abs((st.plat - xy_plat_S) /
                            (st.plat - st.station_latitude)), 1)  # very big
        self.assertLess(abs((st.plon - xy_plon_S) /
                            (st.plon - st.station_longitude)), 0.05)

#        print 'station lon ', st.station_longitude
#        print 'xy lon    S ', xy_plon_S
#        print 'model lon S ', st.plon
#        print
#        print 'station lat ', st.station_latitude
#        print 'xy lat    S ', xy_plat_S
#        print 'model lat S ', st.plat

    def test_moveout(self):
#        st1 = self.stream.copy()
#        moveout(self.stream)
#        st2 = self.stream
#        st = st1[:1] + st2[:1]
#        st = st1 + st2
#        st.plot(automerge=False)
        moveout(self.stream)
예제 #3
0
파일: test_rfstream.py 프로젝트: seism/rf
 def test_io_header(self):
     def test_io_format(format):
         stream1 = stream.copy()
         fname = self.temp + '_IO_FORMAT.' + format.upper()
         if format == 'sh':
             format = 'q'
             fname = self.temp + '.QHD'
         stream1.write(fname, format.upper())
         stream2 = RFStream(stream=read(fname))
         st1 = stream1[0].stats
         st2 = stream2[0].stats
         for head in HEADERS:
             self.assertAlmostEqual(st1[head], st2[head], 4, msg=head)
     stream = RFStream(stream=read())[:1]
     stream._write_test_header()
     for format in FORMATHEADERS:
         test_io_format(format)
예제 #4
0
파일: test_rfstream.py 프로젝트: seism/rf
 def test_simple(self):
     stream = RFStream(stream=read())
     stream._write_test_header()
     stream.rf()
     stream.moveout()
     stream.ppoint(50)