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")
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={})]
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
Built Distribution
File details
Details for the file fast_hypo_client-0.1.3.tar.gz
.
File metadata
- Download URL: fast_hypo_client-0.1.3.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9aa0346173eb9f294301a53acddd9291ff084c48457f16f2388c23ecc5885121 |
|
MD5 | a21b27d19d1b42c2d4c1b6017ca384fa |
|
BLAKE2b-256 | 4b0a61b057e645629e9b8cf0aed578579979d95d3e0b87ef3a1453443f2ba6d2 |
File details
Details for the file fast_hypo_client-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: fast_hypo_client-0.1.3-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b23336aee4a2ab8059025c37c303dbafbaf7634bb7f50b7e262fdfba90762f3a |
|
MD5 | c10b7efd8ed8c4026e9f03e965dc313f |
|
BLAKE2b-256 | 19c2e870c28997d4c96403da2502c822f23fabe760b1e449ef2f54d4ea56ecd5 |