How to set discontinuities in the model read by TauPyModel?

Hi there,

I’m trying to use TauPyModel to read in a self-customized model file in format of npz. Then I’d like to calculate the traveltimes of phases like PmP and Pn. But I encounter a problem that in npz file there’s no word to declare the specific depth for the Moho discontinuity as the nd file. It seems that fix_discontinuity_depths() could be used to set the specific discontinuities, but there’s no clear document that I can follow. Could you help me with this? Thanks in advance!

Example code:
from obspy.taup.taup_create import build_taup_model
from obspy.taup import TauPyModel

build_taup_model(“self.tvel”, output_folder=“./”) ## self.tvel is a readable and self-customized velocity file, and this command is used to convert the velocity file from tvel format into npz format.

First 10 lines in self.tvel look like:
Modified IASPEI91 model
layered crust model
0.000 4.6290 2.6590 2.2513
2.000 4.6290 2.6590 2.2513
2.000 5.0840 2.9130 2.3969
4.000 5.0840 2.9130 2.3969
4.000 5.3960 3.0830 2.4967
6.000 5.3960 3.0830 2.4967
6.000 5.6520 3.2170 2.5786
8.000 5.6520 3.2170 2.5786

model = TauPyModel(“Layers.npz”)
model.model.moho_depth = 50.0 ## I use this to set the Moho discontinuity, but it doesn’t work…
model.model.s_mod.v_mod.fix_discontinuity_depths() ## It seems this command could help me reset the Moho discontinuity, but I don’t know how to deal with it.

I don’t know these file formats for the models and never used that much, but maybe this helps? Not sure if thats the model file format type you mean though…

Thanks Megies! You’re right, and I just find that we can customize a velocity model in format of nd, where we can declare specific depths for the Moho, CMB and IOCB discontinuities using words like mantle, outer-core and inner-core. Then, use the command build_taup_model(“self.nd”, output_folder=“./”) to convert it in into npz format. It works!

1 Like