Skip to main content

API Client for Earthquake Location

Installation

pip install fast-hypo-client

Usage

from datetime import datetime
import requests

from fast_hypo_client.models import VelocityLayer1D, VelocityModel1D, PhaseReading, StationLatLng, PhaseDescriptorP, FirstMotion, LocationRequestNLLoc
from fast_hypo_client.client import Client
from fast_hypo_client.api.non_lin_loc import locate_nlloc_locate_nlloc_post

velocity_model = VelocityModel1D(
    layers=[
        VelocityLayer1D(
            depth_km=0.0,
            vp_top=4.0,
            vs_top=2.38,
            rho_top=2.7,
            vp_grad=0.0,
            vs_grad=0.0,
            rho_grad=0.0,
        ),
        VelocityLayer1D(
            depth_km=2.0,
            vp_top=6.0,
            vs_top=3.57,
            rho_top=2.7,
            vp_grad=0.0,
            vs_grad=0.0,
            rho_grad=0.0,
        ),
        VelocityLayer1D(
            depth_km=10.0,
            vp_top=6.3,
            vs_top=3.75,
            rho_top=2.7,
            vp_grad=0.0,
            vs_grad=0.0,
            rho_grad=0.0,
        ),
    ]
)

stations = [
    StationLatLng(
        code="SBF",
        latitude=43.8635,
        longitude=7.43483,
        elevation_km=0.847,
        depth_km=0.0,
    ),
    StationLatLng(
        code="CEPP",
        latitude=43.9163,
        longitude=7.7465,
        elevation_km=1.08,
        depth_km=0.0,
    ),
    StationLatLng(
        code="MVIF",
        latitude=43.8965,
        longitude=7.1525,
        elevation_km=1.48,
        depth_km=0.0,
    ),
    StationLatLng(
        code="IMI",
        latitude=43.9105,
        longitude=7.89317,
        elevation_km=0.84,
        depth_km=0.0,
    ),
]

events = [
    [
        PhaseReading(
            station_name="SBF",
            p_phase_descriptor=PhaseDescriptorP.P,
            p_arrival=datetime.fromisoformat("1995-04-21T08:03:00.260"),
        ),
        PhaseReading(
            station_name="CEPP",
            p_phase_descriptor=PhaseDescriptorP.P,
            p_first_motion=FirstMotion.UP,
            p_arrival=datetime.fromisoformat("1995-04-21T08:03:01.140"),
        ),
        PhaseReading(
            station_name="MVIF",
            p_phase_descriptor=PhaseDescriptorP.P,
            p_weight=0,
            p_arrival=datetime.fromisoformat("1995-04-21T08:03:03.580"),
            s_arrival=datetime.fromisoformat("1995-04-21T08:03:08.680"),
        ),
        PhaseReading(
            station_name="IMI",
            p_phase_descriptor=PhaseDescriptorP.P,
            p_weight=0,
            p_arrival=datetime.fromisoformat("1995-04-21T08:03:02.770"),
        ),
    ]
]

request = LocationRequestNLLoc(
    events=events,
    stations=stations,
    velocity_model=velocity_model,
)

client = Client(base_url="https://fast-hypo.fly.dev")

response = locate_nlloc_locate_nlloc_post.sync_detailed(client=client, json_body=request)
print(response.parsed)

# [Origin(latitude=43.882196, longitude=7.550554, depth_m=11976.562, uncertainty=HorizontalUncertainty(max_horizontal_uncertainty_m=25324.4, min_horizontal_uncertainty_m=15945.2, azimuth_max_horizontal_uncertainty_deg=163.321, additional_properties={}), additional_properties={})]

Metadata

Release files for fast-hypo-client 0.1.3

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

Source distribution (sdist)

Source distribution for fast-hypo-client 0.1.3
File Size Uploaded Provenance
fast_hypo_client-0.1.3.tar.gz 9.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fast-hypo-client 0.1.3
File Interpreter ABI Platform
fast_hypo_client-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 25.7 kB

Release files / fast_hypo_client-0.1.3.tar.gz

Download URL fast_hypo_client-0.1.3.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9aa0346173eb9f294301a53acddd9291ff084c48457f16f2388c23ecc5885121
BLAKE2b-256 checksum
How to use checksums
4b0a61b057e645629e9b8cf0aed578579979d95d3e0b87ef3a1453443f2ba6d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / fast_hypo_client-0.1.3-py3-none-any.whl

Download URL fast_hypo_client-0.1.3-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b23336aee4a2ab8059025c37c303dbafbaf7634bb7f50b7e262fdfba90762f3a
BLAKE2b-256 checksum
How to use checksums
19c2e870c28997d4c96403da2502c822f23fabe760b1e449ef2f54d4ea56ecd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Security for fast-hypo-client 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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