Skip to main content

A client library for accessing Fast-Hypo

Project description

API Client for Earthquake Location

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")

locate_nlloc_locate_nlloc_post.sync_detailed(client=client, json_body=request)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fast_hypo_client-0.1.1.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

fast_hypo_client-0.1.1-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file fast_hypo_client-0.1.1.tar.gz.

File metadata

  • Download URL: fast_hypo_client-0.1.1.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for fast_hypo_client-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b55df5108f9e95fc23a08e2d6b9ff25aee836296f69e9b9f02f7a1eabf57ec13
MD5 159add03d3e2fc337b28e8c7e36207bb
BLAKE2b-256 5aa48068a143bb079290432c61769e884947379aab86d4132c89f5e784b85127

See more details on using hashes here.

File details

Details for the file fast_hypo_client-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fast_hypo_client-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4893e989825f788f6a08e22e1e6ca6306807e855339268ead8f036e166d0f4f7
MD5 12697dfe8e89c56aab88fd4e85e821f3
BLAKE2b-256 5dd558ec16015113609632c314c99ec5009809745121e6d3661046ab8e0299a5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page