Skip to main content

taup_python

Access to the TauP Toolkit from Python via an HTTP server.

The problem is that lots of seismologists like writing Python scripts, but calling a Java library from Python seems somewhere between hard and impossible. But interaction doesn't require direct interoperation. The basic idea of this solution (or bandaid) is that this python library will spin up an instance of taup web, and then use that to answer many queries via http, avoiding the startup time of Java.

You will also need to have an instance of the TauP Toolkit installed. This can be done manually by downloading from Zenodo or from Homebrew via

brew tap crotwell/crotwell
brew trust --formula crotwell/crotwell/taup 
brew install taup

The Python classes representing each tool's query parameters are based off off the command line arguments of the same name. For example, this Python code:

import taup

with taup.TauPServer() as taupserver:
    timeParams = taup.TimeQuery()
    timeParams.phase(["P", "S"])
    timeParams.mod('ak135')
    timeParams.degree(35)
    timeResult = timeParams.calc(taupserver)
    print("Phase  Depth   Dist   Time")
    for a in timeResult.arrivals:
        print(f"{a.phase}      {a.sourcedepth}     {a.distdeg}   {a.time}")

roughly corresponds to this command line:

bin/taup time --ph P,S --mod ak135 --deg 35 --json

Note that if you have many calculations in a loop, you want to have the loop on the inside of the with taup.TauPServer() as taupserver: line so that the server is only started up once.

See example_times.py and others in the examples directory for more detailed examples.

Documentation available at readthedocs for TauP-python

Metadata

Release files for taup 3.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for taup 3.2.1
File Size Uploaded
taup-3.2.1.tar.gz 188.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for taup 3.2.1
File Interpreter ABI Platform
taup-3.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 274.5 kB

Release files / taup-3.2.1.tar.gz

Download URL taup-3.2.1.tar.gz
Size 188.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5fdfcbe9ff323f93ea20a891e1dbea70a754da9e28a16a97e94258233f40f74c
BLAKE2b-256 checksum
How to use checksums
40eeab260bb80f6a5d46dec2b1520f71517aeb7647508174ddcf0412fba42b25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.18.0 {"ci":null,"cpu":"arm64","distro":{"name":"macOS","version":"26.6.2"},"implementation":{"name":"CPython","version":"3.11.15"},"installer":{"name":"hatch","version":"1.18.0"},"openssl_version":"OpenSSL 3.6.3 9 Jun 2026","python":"3.11.15","system":{"name":"Darwin","release":"25.6.0"}} HTTPX2/2.5.0

Release files / taup-3.2.1-py3-none-any.whl

Download URL taup-3.2.1-py3-none-any.whl
Size 86.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4f98f248f4e143bde98106cf8cab61dcfdc0f010fb5befc0c71e989f724a24c
BLAKE2b-256 checksum
How to use checksums
4141b6a233a44a53026c78ef7483150885933fd12f215ea26f37de1622f5b8cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.18.0 {"ci":null,"cpu":"arm64","distro":{"name":"macOS","version":"26.6.2"},"implementation":{"name":"CPython","version":"3.11.15"},"installer":{"name":"hatch","version":"1.18.0"},"openssl_version":"OpenSSL 3.6.3 9 Jun 2026","python":"3.11.15","system":{"name":"Darwin","release":"25.6.0"}} HTTPX2/2.5.0

Release history Release notifications | RSS feed

This release

3.2.1 This release

2 release files

3.2.0

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page