obspy.taup.slowness_model.SlownessModel.find_depth_from_layers

SlownessModel.find_depth_from_layers(p, top_critical_layer, bot_critical_layer, is_p_wave)[source]

Find depth corresponding to a slowness p between two velocity layers.

Here, slowness is defined as (radius_of_planet-depth) / velocity, and sometimes called ray parameter. Both the top and the bottom velocity layers are included. We also check to see if the slowness is less than the bottom slowness of these layers but greater than the top slowness of the next deeper layer. This corresponds to a total reflection. In this case a check needs to be made to see if this is an S wave reflecting off of a fluid layer, use P velocity below in this case. We assume that slowness is monotonic within these layers and therefore there is only one depth with the given slowness. This means we return the first depth that we find.

Parameters:
  • p (float) – Slowness (aka ray parameter) to find, in s/km.

  • top_critical_layer (int) – Top layer number to search.

  • bot_critical_layer (int) – Bottom layer number to search.

  • is_p_wave (bool) – True if P wave or False for S wave.

Returns:

Depth (in km) corresponding to the desired slowness.

Return type:

float

Raises:

SlownessModelError – If top_critical_layer > bot_critical_layer because there are no layers to search, or if there is an increase in slowness, i.e., a negative velocity gradient, that just balances the decrease in slowness due to the spherical planet, or if the ray parameter p is not contained within the specified layer range.