Пример #1
0
    def test_read_velocity_model(self):
        for filename in ['iasp91.tvel', 'iasp91_w_comment.tvel', 'iasp91.nd',
                         'iasp91_w_comment.nd']:
            velocity_model = os.path.join(DATA, filename)
            test2 = VelocityModel.read_velocity_file(velocity_model)

            self.assertEqual(len(test2.layers), 129)
            self.assertEqual(len(test2), 129)

            self.assertEqual(test2.radius_of_planet, 6371.0)
            self.assertEqual(test2.moho_depth, 35)
            self.assertEqual(test2.cmb_depth, 2889.0)
            self.assertEqual(test2.iocb_depth, 5153.9)
            self.assertEqual(test2.min_radius, 0.0)
            self.assertEqual(test2.max_radius, 6371.0)

            self.assertEqual(test2.validate(), True)

            np.testing.assert_equal(
                test2.get_discontinuity_depths(),
                [0.0, 20.0, 35.0, 210.0, 410.0, 660.0, 2889.0, 5153.9, 6371.0])

            # check boundary cases
            self.assertEqual(test2.layer_number_above(6371), 128)
            self.assertEqual(test2.layer_number_below(0), 0)

            # evaluate at cmb
            self.assertEqual(test2.evaluate_above(2889.0, 'p'), 13.6908)
            self.assertEqual(test2.evaluate_below(2889.0, 'D'), 9.9145)
            self.assertEqual(test2.depth_at_top(50), 2393.5)
            self.assertEqual(test2.depth_at_bottom(50), 2443.0)
            self.assertEqual(test2.fix_discontinuity_depths(), False)
Пример #2
0
    def test_read_velocity_model(self):
        for filename in [
                'iasp91.tvel', 'iasp91_w_comment.tvel', 'iasp91.nd',
                'iasp91_w_comment.nd'
        ]:
            velocity_model = os.path.join(DATA, filename)
            test2 = VelocityModel.read_velocity_file(velocity_model)

            assert len(test2.layers) == 129
            assert len(test2) == 129

            assert test2.radius_of_planet == 6371.0
            assert test2.moho_depth == 35
            assert test2.cmb_depth == 2889.0
            assert test2.iocb_depth == 5153.9
            assert test2.min_radius == 0.0
            assert test2.max_radius == 6371.0

            assert test2.validate()

            np.testing.assert_equal(
                test2.get_discontinuity_depths(),
                [0.0, 20.0, 35.0, 210.0, 410.0, 660.0, 2889.0, 5153.9, 6371.0])

            # check boundary cases
            assert test2.layer_number_above(6371) == 128
            assert test2.layer_number_below(0) == 0

            # evaluate at cmb
            assert test2.evaluate_above(2889.0, 'p') == 13.6908
            assert test2.evaluate_below(2889.0, 'D') == 9.9145
            assert test2.depth_at_top(50) == 2393.5
            assert test2.depth_at_bottom(50) == 2443.0
            assert not test2.fix_discontinuity_depths()
Пример #3
0
    def test_read_velocity_model(self):
        for filename in ['iasp91.tvel', 'iasp91_w_comment.tvel', 'iasp91.nd',
                         'iasp91_w_comment.nd']:
            velocity_model = os.path.join(DATA, filename)
            test2 = VelocityModel.read_velocity_file(velocity_model)

            self.assertEqual(len(test2.layers), 129)
            self.assertEqual(len(test2), 129)

            self.assertEqual(test2.radius_of_planet, 6371.0)
            self.assertEqual(test2.moho_depth, 35)
            self.assertEqual(test2.cmb_depth, 2889.0)
            self.assertEqual(test2.iocb_depth, 5153.9)
            self.assertEqual(test2.min_radius, 0.0)
            self.assertEqual(test2.max_radius, 6371.0)

            self.assertEqual(test2.validate(), True)

            np.testing.assert_equal(
                test2.get_discontinuity_depths(),
                [0.0, 20.0, 35.0, 210.0, 410.0, 660.0, 2889.0, 5153.9, 6371.0])

            # check boundary cases
            self.assertEqual(test2.layer_number_above(6371), 128)
            self.assertEqual(test2.layer_number_below(0), 0)

            # evaluate at cmb
            self.assertEqual(test2.evaluate_above(2889.0, 'p'), 13.6908)
            self.assertEqual(test2.evaluate_below(2889.0, 'D'), 9.9145)
            self.assertEqual(test2.depth_at_top(50), 2393.5)
            self.assertEqual(test2.depth_at_bottom(50), 2443.0)
            self.assertEqual(test2.fix_discontinuity_depths(), False)
Пример #4
0
 def load_velocity_model(self):
     """
     Try to load a velocity model.
     """
     # Read the velocity model file.
     filename = self.input_filename
     if self.debug:
         print("filename =", filename)
     self.v_mod = VelocityModel.read_velocity_file(filename)
     if self.v_mod is None:
         raise IOError("Velocity model file not found: " + filename)
     # If model was read:
     if self.debug:
         print("Done reading velocity model.")
         print("Radius of model " + self.v_mod.model_name + " is " +
               str(self.v_mod.radius_of_planet))
     # if self.debug:
     #    print("velocity mode: " + self.v_mod)
     return self.v_mod
Пример #5
0
 def load_velocity_model(self):
     """
     Try to load a velocity model.
     """
     # Read the velocity model file.
     filename = self.input_filename
     if self.debug:
         print("filename =", filename)
     self.v_mod = VelocityModel.read_velocity_file(filename)
     if self.v_mod is None:
         raise IOError("Velocity model file not found: " + filename)
     # If model was read:
     if self.debug:
         print("Done reading velocity model.")
         print("Radius of model " + self.v_mod.model_name + " is " +
               str(self.v_mod.radius_of_planet))
     # if self.debug:
     #    print("velocity mode: " + self.v_mod)
     return self.v_mod