Skip to main content

A library for earthquake selection

Project description

SelectionEarthquake

Deprem kayitlarini AFAD ve PEER gibi veri saglayicilardan cekip ortak kolona normalize eden, arama kriterlerine gore puanlayan ve TBDY 2018 odakli kayit secimi yapan Python kutuphanesi.

Paket ve Import Adi

Paket kurulum adi:

pip install earthquake-selection

Python import paketi:

import selection_service

Yerel gelistirme kurulumu:

git clone https://github.com/muhammedsural/SelectionEarthquake.git
cd SelectionEarthquake
pip install -e ".[dev]"

Ozellikler

  • Coklu veri saglayici destegi: AFAD, PEER
  • Ortak SearchCriteria modeli ve provider bazli kriter donusumu
  • Pipeline tabanli sorgu, birlestirme, puanlama ve secim akisi
  • TBDY 2018 icin Gaussian tabanli secim stratejisi
  • Kriter bazli skor kirilimi: SCORE_BREAKDOWN
  • Her kayit icin secim/eleme aciklamasi: SELECTION_STATUS, SELECTION_REASON
  • CSV, JSON rapor ve Pandas DataFrame ciktilari
  • AFAD icin waveform indirme destegi
  • Pytest tabanli test altyapisi

Hizli Baslangic

from selection_service.core.EarthquakeApi import EarthquakeAPI
from selection_service.enums.Enums import DesignCode, ProviderName
from selection_service.processing.Selection import (
    ScoringWeights,
    SearchCriteria,
    SelectionConfig,
    TBDYSelectionStrategy,
)

config = SelectionConfig(
    design_code=DesignCode.TBDY_2018,
    num_records=11,
    max_per_station=3,
    max_per_event=3,
    min_score=55,
)
strategy = TBDYSelectionStrategy(config=config)

criteria = SearchCriteria(
    start_date="2000-01-01",
    end_date="2025-09-05",
    min_magnitude=7.0,
    max_magnitude=8.0,
    min_vs30=300,
    max_vs30=400,
    mechanisms=["StrikeSlip"],
    weights=ScoringWeights.from_preset("tbdy_2018_record_selection"),
)

api = EarthquakeAPI(
    provider_names=[ProviderName.PEER],
    strategies=[strategy],
    use_cache=True,
)

result = api.run_sync(criteria=criteria, strategy_name=strategy.get_name())

if result.success:
    selected = result.value.selected_df
    report = result.value.report
    print(selected[["PROVIDER", "RSN", "EVENT", "MAGNITUDE", "SCORE", "SELECTION_REASON"]].head())
    print(report["selection_summary"])
else:
    print(result.error)

Komut Satiri Ornegi

Kurulumdan sonra uc uca arama, secim, CSV ve JSON rapor uretimi:

earthquake-selection-example --providers peer --num-records 11 --report-path selection_report.json --selected-csv selected_records.csv

AFAD ile waveform indirme akisini da baslatmak icin:

earthquake-selection-example --providers afad --download-waveforms --export-type mseed

AFAD API ag baglantisi gerektirir. PEER veri seti lokal flatfile ile calisir ve waveform indirme desteklemez; download adiminda desteklenmeyen provider atlanir.

Scoring Presetleri

Hazir agirlik setleri ScoringWeights.from_preset(...) ile secilir:

  • balanced: Varsayilan dengeli agirliklar.
  • tbdy_2018_record_selection: Magnitude, mesafe, Vs30 ve mekanizmayi one cikarir.
  • site_response: Vs30, sure ve siddet olcutlerine daha fazla agirlik verir.

Preset aciklamalari:

from selection_service.processing.Selection import ScoringWeights

print(ScoringWeights.preset_descriptions())

Rapor Izlenebilirligi

PipelineResult.report asagidaki ek alanlari icerir:

  • selection_summary: Secilen/reddedilen kayit sayilari ve eleme gerekceleri.
  • score_breakdown: Secilen kayitlar icin kriter bazli hedef, deger, agirlik ve katki.

scored_df tum kayitlar icin su kolonlari tasir:

  • SCORE_BREAKDOWN
  • SELECTION_STATUS
  • SELECTION_REASON

Mimari

selection_service/
  core/        Pipeline, API facade, config, error types
  services/    Query, provider registry, waveform download orchestration
  providers/   AFAD, PEER, cache, provider interfaces
  processing/  SearchCriteria, selection strategy, mappers, Result
  utility/     Data file loading helpers
  data/        Packaged CSV/XLSX data
tests/         pytest suite
examples/      Usage examples

Test

pytest

Pytest ayarlari tek kaynak olarak pyproject.toml icindedir.

Yol Haritasi

  • FDSN provider entegrasyonunu tamamla veya v2 kapsaminda ayri tut.
  • Eurocode stratejisini gercek kurallarla doldur veya deneysel olarak etiketle.
  • Rapor ciktilarini HTML/PDF formatina genislet.

Lisans

MIT License

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

earthquake_selection-1.2.0.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

earthquake_selection-1.2.0-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

Details for the file earthquake_selection-1.2.0.tar.gz.

File metadata

  • Download URL: earthquake_selection-1.2.0.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for earthquake_selection-1.2.0.tar.gz
Algorithm Hash digest
SHA256 cf3227ad1a9d7083176fac61ddc172fa40ed894ba2549bbed8e55f050cd54d9c
MD5 292e4d14b02ac181ba39523cd3a8792b
BLAKE2b-256 951f14f3a1679ec0ca2e81653922405984484e630af2f10099a7a9365a7ec5d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for earthquake_selection-1.2.0.tar.gz:

Publisher: deploy.yml on muhammedsural/SelectionEarthquake

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file earthquake_selection-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for earthquake_selection-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f651acbc2de5f9910a5fefc30da53cfdd206cd5992027333403c98f306f6703
MD5 f18ed2fb8a777277ff17ada8752d6bc9
BLAKE2b-256 33882eb82f9334d61476699b4efa0a0a29fc02f51d9d13b1343f76f082e70eb1

See more details on using hashes here.

Provenance

The following attestation bundles were made for earthquake_selection-1.2.0-py3-none-any.whl:

Publisher: deploy.yml on muhammedsural/SelectionEarthquake

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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