Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taup fix for models with no discontinuities #3244

Merged
merged 3 commits into from Jan 19, 2023

Conversation

johnrudge
Copy link
Member

@johnrudge johnrudge commented Dec 19, 2022

What does this PR do?

This PR fixes the issue described by @dylanmikesell and @kaspervanwijk in the comments of #3070, namely the failure to build a tau model when there are no discontinuities present. With this PR, the one layer model example now works:

from obspy.taup import TauPyModel
from obspy.taup.taup_create import build_taup_model
build_taup_model('1_layer_model.tvel')
model = TauPyModel("1_layer_model")
arrivals = model.get_ray_paths(distance_in_degree=160.0, source_depth_in_km=0.0)
print(arrivals)
Building obspy.taup model for '1_layer_model.tvel' ...
filename = 1_layer_model.tvel
Done reading velocity model.
Radius of model  is 6371.0
Using parameters provided in TauP_config.ini (or defaults if not) to call SlownessModel...
Parameters are:
taup.create.min_delta_p = 0.1 sec / radian
taup.create.max_delta_p = 11.0 sec / radian
taup.create.max_depth_interval = 115.0 kilometers
taup.create.max_range_interval = 0.04363323129985824 degrees
taup.create.max_interp_error = 0.05 seconds
taup.create.allow_inner_core_s = True
Slow model  224 P layers,382 S layers
Done calculating Tau branches.
Done Saving /home/john/Documents/students/stuart/obspy/obspy/taup/data/1_layer_model.npz
Method run is done, but not necessarily successful.
10 arrivals
	P phase arrival at 2023.939 seconds
	PP phase arrival at 2642.064 seconds
	PP phase arrival at 3148.690 seconds
	S phase arrival at 3514.964 seconds
	PS phase arrival at 3796.746 seconds
	SP phase arrival at 3796.746 seconds
	PS phase arrival at 4417.046 seconds
	SP phase arrival at 4417.046 seconds
	SS phase arrival at 4588.459 seconds
	SS phase arrival at 5468.313 seconds

These arrivals agree with the java version.

Why was it initiated? Any relevant Issues?

See #3070.

PR Checklist

  • Correct base branch selected? master for new features, maintenance_... for bug fixes
  • This PR is not directly related to an existing issue (which has no PR yet).
  • While the PR is still work-in-progress, the no_ci label can be added to skip CI builds
  • If the PR is making changes to documentation, docs pages can be built automatically.
    Just add the build_docs tag to this PR.
    Docs will be served at docs.obspy.org/pr/{branch_name} (do not use master branch).
    Please post a link to the relevant piece of documentation.
  • If all tests including network modules (e.g. clients.fdsn) should be tested for the PR,
    just add the test_network tag to this PR.
  • All tests still pass.
  • Any new features or fixed regressions are covered via new tests.
  • Any new or changed features are fully documented.
  • Significant changes have been added to CHANGELOG.txt .
  • First time contributors have added your name to CONTRIBUTORS.txt .
  • If the changes affect any plotting functions you have checked that the plots
    from all the CI builds look correct. Add the "upload_plots" tag so that plotting
    outputs are attached as artifacts.
  • New modules, add the module to CODEOWNERS with your github handle
  • Add the ready for review tag when you are ready for the PR to be reviewed.

@johnrudge johnrudge marked this pull request as draft December 19, 2022 12:21
@johnrudge johnrudge changed the base branch from maintenance_1.4.x to master December 19, 2022 12:22
@johnrudge johnrudge changed the base branch from master to maintenance_1.4.x December 19, 2022 12:26
@johnrudge johnrudge marked this pull request as ready for review December 19, 2022 12:59
@johnrudge johnrudge added .taup ready for review PRs that are ready to be reviewed to get marked ready to merge labels Dec 19, 2022
@johnrudge johnrudge changed the title Taup fix for models with discontinuities Taup fix for models with no discontinuities Dec 19, 2022
@johnrudge johnrudge force-pushed the taup_homogeneous_fix branch 2 times, most recently from 91f018d to 3a96a39 Compare January 18, 2023 09:15
@johnrudge
Copy link
Member Author

@megies, I dropped one extra change into this PR because I noticed that taup_create is broken with the new pathlib changes you made (there's a print statement that expects a string as self.filename).

@megies
Copy link
Member

megies commented Jan 19, 2023

rebased and force pushed. thanks @johnrudge

@megies megies merged commit ea99178 into maintenance_1.4.x Jan 19, 2023
@megies megies deleted the taup_homogeneous_fix branch January 19, 2023 11:50
@megies megies added this to the 1.4.1 milestone Jan 19, 2023
@megies megies removed the ready for review PRs that are ready to be reviewed to get marked ready to merge label Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants