Issue with "build_taup_model"

Hi everyone,

I am trying build a homogeneous model that plots the ray paths by using the function build_taup_model ultimately to use plot_ray_paths by using a created tvel-file:

hsm P Model
hsm S Model
0.0000 1.4178 0.9040 .4500
10.0000 1.4178 0.9040 .4500
10.0000 1.4178 0.9040 .4500
20.0000 1.4178 0.9040 .4500
20.0000 1.4178 0.9040 .4500
30.0000 1.4178 0.9040 .4500
30.0000 1.4178 0.9040 .4500
40.0000 1.4178 0.9040 .4500
40.0000 1.4178 0.9040 .4500
50.0000 1.4178 0.9040 .4500
50.0000 1.4178 0.9040 .4500
60.0000 1.4178 0.9040 .4500
60.0000 1.4178 0.9040 .4500
70.0000 1.4178 0.9040 .4500
70.0000 1.4178 0.9040 .4500
80.0000 1.4178 0.9040 .4500
80.0000 1.4178 0.9040 .4500
90.0000 1.4178 0.9040 .4500
90.0000 1.4178 0.9040 .4500

The code I am using that calls the function is this:

from obspy.taup.taup_create import build_taup_model
filename = “C:/Users/AppData/Roaming/Python/Python39/site-packages/obspy/taup/data/hsm.tvel”
hsm_model = build_taup_model(filename)

When I run it I get the following error:

Building obspy.taup model for ‘C:/Users/AppData/Roaming/Python/Python39/site-packages/obspy/taup/data/hsm.tvel’ …
Traceback (most recent call last):
File “c:\Users\OneDrive\Desktop\Research\SMP\SMPGit\mechcanics-1\Mechanics\testrayp.py”, line 27, in
hsm_model = build_taup_model(filename)
File “C:\Users\AppData\Roaming\Python\Python39\site-packages\obspy\taup\taup_create.py”, line 177, in build_taup_model
mod_create.run()
File “C:\Users\AppData\Roaming\Python\Python39\site-packages\obspy\taup\taup_create.py”, line 117, in run
self.tau_model = self.create_tau_model(self.v_mod)
File “C:\Users\AppData\Roaming\Python\Python39\site-packages\obspy\taup\taup_create.py”, line 78, in create_tau_model
self.s_mod = SlownessModel(
File “C:\Users\AppData\Roaming\Python\Python39\site-packages\obspy\taup\slowness_model.py”, line 70, in init
self.create_sample()
File “C:\Users\AppData\Roaming\Python\Python39\site-packages\obspy\taup\slowness_model.py”, line 140, in create_sample
self.coarse_sample()
File “C:\Users\AppData\Roaming\Python\Python39\site-packages\obspy\taup\slowness_model.py”, line 733, in coarse_sample
curr_p_layer = create_from_vlayer(
File “C:\Users\AppData\Roaming\Python\Python39\site-packages\obspy\taup\slowness_layer.py”, line 330, in create_from_vlayer
if bot_depth[-1] == radius_of_planet and bot_vel[-1] == 0.0:
IndexError: index -1 is out of bounds for axis 0 with size 0

Any help on how to get round this? Or possibly an easier way to display the ray paths for a homogenous model?

Thanks!

You want a fully homogeneous model? Rays can never bend in such a model, the only raypath would be a straight line from source to receiver, or am I missing something here.

That is a great assumption, ultimately I need it as a visualization for comparison. Any help when it comes to the error?

Can’t really help much, as I don’t use this myself a lot and I don’t know this tvel format really. But as I said, I’m not surprised that Taup runs into problems with a homogeneous halfspace, rays can never come back up and - without knowing taup internals - it probably did not consider this possibility.