Skip to main content

A client library for accessing Fast-Hypo

Project description

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

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.2.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: fast_hypo_client-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 e69f8f29cb3f257176b0924b58b122ed7786c3adcba35b2c432b960e06359061
MD5 396aa852b8c19a1794888d08d77e6f78
BLAKE2b-256 6a6097ff36a65a351a1ee88ce4e9ae9e245afa5621a3b0f11b9264428b3e6cd9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fast_hypo_client-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bf8ed61983cdf59d9c51043e45cd08c3ee268917b54cedc4f3f3f0c1f833833d
MD5 7a6f6e5cfbbc88232411a4818918fb64
BLAKE2b-256 ba2993c9f16818ad6f3d6cb10a83ee09c3256b9eb8f9d9fed8fd85bf999c904a

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