earthquake-selection


Nameearthquake-selection JSON
Version 1.0.0 PyPI version JSON
download
home_pageNone
SummaryA library for earthquake selection
upload_time2025-10-07 10:27:36
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT License Copyright (c) 2025 Muhammed Sural Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords earthquake seismology data-processing selection peer nga afad
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SelectionEarthquake

Deprem kayıtlarının karakteristik özelliklerinin bilgilerini farklı veri sağlayıcılardan (AFAD,PEER) çekip normalize eden, ardından belirlenen kriterlere göre puanlayan ve strateji tabanlı seçim yapan Python kütüphanesi.
Böylece araştırmacılar ve mühendisler, bina özelinde uygun deprem kayıtlarını hızlı ve güvenilir şekilde elde edebilir.

---

## 🚀 Özellikler

- 🌐 Çoklu veri sağlayıcı desteği (AFAD, PEER)
- 🔎 Esnek arama kriterleri (`magnitude`, `depth`, `distance`, `Vs30`, vb.)
- 🧩 Pipeline tabanlı mimari
- 📂 Çıktılar: CSV, XLSX, MiniSeed, Pandas DataFrame
- ⚡ Asenkron (async) sorgular ile hızlı veri çekme
- 🏆 Puanlama sistemi ve strateji tabanlı kayıt seçimi (örn. TBDY 2018’e göre seçim)
- 🧪 Test altyapısı (pytest) ve kolay genişletilebilir provider mimarisi

---

## 📦 Kurulum

```bash
# PyPI'den yükleme
pip install selection_earthquake

# Yerel geliştirme için
git clone https://github.com/kullanici/SelectionEarthquake.git
cd SelectionEarthquake
pip install -e .

```

## ⚡ Hızlı Başlangıç

```py
import asyncio
from selection_service.enums.Enums import DesignCode, ProviderName
from selection_service.core.Pipeline import EarthquakeAPI
from selection_service.processing.Selection import (SelectionConfig,
                                                    SearchCriteria,
                                                    TBDYSelectionStrategy,
                                                    TargetParameters)
from selection_service.core.LoggingConfig import setup_logging

setup_logging()

async def example_usage():
    # Seçim stratejisi oluşturma
    con = SelectionConfig(design_code=DesignCode.TBDY_2018,
                          num_records=22,
                          max_per_station=3,
                          max_per_event=3,
                          min_score=55)
    strategy = TBDYSelectionStrategy(config=con)

    #Arama kriterleri
    search_criteria = SearchCriteria(
        start_date="2000-01-01",
        end_date="2025-09-05",
        min_magnitude=7.0,
        max_magnitude=10.0,
        min_vs30=300,
        max_vs30=400
        # mechanisms=["StrikeSlip"]
        )
    
    # Hedef parametreler
    target_params = TargetParameters(
        magnitude=7.0,
        distance=30.0,
        vs30=400.0,
        pga=200,
        mechanism=["StrikeSlip"]
    )
    
    # API
    api = EarthquakeAPI(providerNames= [ProviderName.AFAD, 
                                   ProviderName.PEER],
                        strategies= [strategy])

    # Asenkron arama
    result = await api.run_async(criteria=search_criteria,
                                 target=target_params,
                                 strategy_name=strategy.get_name())
    
    # Senkron arama
    # result = api.run_sync(criteria=search_criteria,
    # target=target_params,
    # strategy_name=strategy.get_name())
    
    
    if result.success:
        print(result.value.selected_df[['PROVIDER','RSN','EVENT','YEAR','MAGNITUDE','STATION','VS30(m/s)','RRUP(km)','MECHANISM','PGA(cm2/sec)','PGV(cm/sec)','SCORE']].head(7))
        return result.value
    else:
        print(f"[ERROR]: {result.error}")
        return None
    
if __name__ == "__main__":
    df = asyncio.run(example_usage())
```

PROVIDER | RSN      | EVENT         | YEAR  | MAGNITUDE |           STATION            | VS30(m/s) | RRUP(km)   |  MECHANISM  | PGA(cm2/sec) | PGV(cm/sec) | SCORE  
---------|----------|---------------|------ |---------- |------------------------------|-----------|----------  | ----------- |-----------   |-----------  |-------------
PEER     |  900     |  Landers      |  1992 |    7.28   |  Yermo Fire Station          |    353.63 |  23.620000 |  StrikeSlip |  217.776277  |  40.263000  |  100.000000
PEER     |  3753    |  Landers      |  1992 |    7.28   |  Fun Valley                  |    388.63 |  25.020000 |  StrikeSlip |  206.125976  |  19.963000  |  100.000000
PEER     |  1615    |  Duzce, Turkey|  1999 |    7.14   |  Lamont 1062                 |    338.00 |  9.140000  |  StrikeSlip |  202.664229  |  14.630000  |  100.000000
PEER     |  881     |  Landers      |  1992 |    7.28   |  Morongo Valley Fire Station |    396.41 |  17.360000 |  StrikeSlip |  188.768206  |  24.317000  |  100.000000
PEER     |  1762    |  Hector Mine  |  1999 |    7.13   |  Amboy                       |    382.93 |  43.050000 |  StrikeSlip |  182.933249  |  23.776000  |  100.000000
AFAD     |  327943  |  17966        |  2023 |    7.70   |  DSİ, Musa Şahin Bulvarı     |    350.00 |  27.110381 |  StrikeSlip |  185.737903  |  29.642165  |  91.304348
AFAD     |  327943  |  17966        |  2023 |    7.70   |  DSİ, Musa Şahin Bulvarı     |    350.00 |  27.110381 |  StrikeSlip |  185.737903  |  29.642165  |  91.304348


## 🛠 Mimari

```bash
selection_service/
│
├── providers/          # Veri sağlayıcılar (AFAD, FDSN, PEER…)
├── core/               # Pipeline ve API
├── processing/         # SearchCriteria, Result, vs.
├── utility/            # Yardımcı fonksiyonlar
├── enums/              # ProviderName gibi enumlar
├── data/               # Kullanılan csv ve excel dosyaları

tests/              # pytest testleri

```

## 🤝 Provider Ekleme Adımları

- enums.Enums.ProviderName kısmına ismini ekle

- Yeni provider eklemek için providers/ altına python dosyasını aç.

- Provider sınıfı mutlaka IDataProvider'ı miras almalı.

- Provider a özel BaseColumnMapper sınıfını miras alan mapping sınıfını yaz ve ColumnMapperFactory e ekle

- ProviderFactory de create methoduna ekle

- Unit test yazmayı unutma.


## 📌 Yol Haritası

- [ ] Yeni provider: FDSN


## 📜 Lisans

MIT License

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "earthquake-selection",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "earthquake, seismology, data-processing, selection, peer, nga, afad",
    "author": null,
    "author_email": "Muhammed Sural <muhammedsural@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/79/9a/393adce310456ba23643113d337274969c91fe174f446183121419b42316/earthquake_selection-1.0.0.tar.gz",
    "platform": null,
    "description": "# SelectionEarthquake\n\nDeprem kay\u0131tlar\u0131n\u0131n karakteristik \u00f6zelliklerinin bilgilerini farkl\u0131 veri sa\u011flay\u0131c\u0131lardan (AFAD,PEER) \u00e7ekip normalize eden, ard\u0131ndan belirlenen kriterlere g\u00f6re puanlayan ve strateji tabanl\u0131 se\u00e7im yapan Python k\u00fct\u00fcphanesi.\nB\u00f6ylece ara\u015ft\u0131rmac\u0131lar ve m\u00fchendisler, bina \u00f6zelinde uygun deprem kay\u0131tlar\u0131n\u0131 h\u0131zl\u0131 ve g\u00fcvenilir \u015fekilde elde edebilir.\n\n---\n\n## \ud83d\ude80 \u00d6zellikler\n\n- \ud83c\udf10 \u00c7oklu veri sa\u011flay\u0131c\u0131 deste\u011fi (AFAD, PEER)\n- \ud83d\udd0e Esnek arama kriterleri (`magnitude`, `depth`, `distance`, `Vs30`, vb.)\n- \ud83e\udde9 Pipeline tabanl\u0131 mimari\n- \ud83d\udcc2 \u00c7\u0131kt\u0131lar: CSV, XLSX, MiniSeed, Pandas DataFrame\n- \u26a1 Asenkron (async) sorgular ile h\u0131zl\u0131 veri \u00e7ekme\n- \ud83c\udfc6 Puanlama sistemi ve strateji tabanl\u0131 kay\u0131t se\u00e7imi (\u00f6rn. TBDY 2018\u2019e g\u00f6re se\u00e7im)\n- \ud83e\uddea Test altyap\u0131s\u0131 (pytest) ve kolay geni\u015fletilebilir provider mimarisi\n\n---\n\n## \ud83d\udce6 Kurulum\n\n```bash\n# PyPI'den y\u00fckleme\npip install selection_earthquake\n\n# Yerel geli\u015ftirme i\u00e7in\ngit clone https://github.com/kullanici/SelectionEarthquake.git\ncd SelectionEarthquake\npip install -e .\n\n```\n\n## \u26a1 H\u0131zl\u0131 Ba\u015flang\u0131\u00e7\n\n```py\nimport asyncio\nfrom selection_service.enums.Enums import DesignCode, ProviderName\nfrom selection_service.core.Pipeline import EarthquakeAPI\nfrom selection_service.processing.Selection import (SelectionConfig,\n                                                    SearchCriteria,\n                                                    TBDYSelectionStrategy,\n                                                    TargetParameters)\nfrom selection_service.core.LoggingConfig import setup_logging\n\nsetup_logging()\n\nasync def example_usage():\n    # Se\u00e7im stratejisi olu\u015fturma\n    con = SelectionConfig(design_code=DesignCode.TBDY_2018,\n                          num_records=22,\n                          max_per_station=3,\n                          max_per_event=3,\n                          min_score=55)\n    strategy = TBDYSelectionStrategy(config=con)\n\n    #Arama kriterleri\n    search_criteria = SearchCriteria(\n        start_date=\"2000-01-01\",\n        end_date=\"2025-09-05\",\n        min_magnitude=7.0,\n        max_magnitude=10.0,\n        min_vs30=300,\n        max_vs30=400\n        # mechanisms=[\"StrikeSlip\"]\n        )\n    \n    # Hedef parametreler\n    target_params = TargetParameters(\n        magnitude=7.0,\n        distance=30.0,\n        vs30=400.0,\n        pga=200,\n        mechanism=[\"StrikeSlip\"]\n    )\n    \n    # API\n    api = EarthquakeAPI(providerNames= [ProviderName.AFAD, \n                                   ProviderName.PEER],\n                        strategies= [strategy])\n\n    # Asenkron arama\n    result = await api.run_async(criteria=search_criteria,\n                                 target=target_params,\n                                 strategy_name=strategy.get_name())\n    \n    # Senkron arama\n    # result = api.run_sync(criteria=search_criteria,\n    # target=target_params,\n    # strategy_name=strategy.get_name())\n    \n    \n    if result.success:\n        print(result.value.selected_df[['PROVIDER','RSN','EVENT','YEAR','MAGNITUDE','STATION','VS30(m/s)','RRUP(km)','MECHANISM','PGA(cm2/sec)','PGV(cm/sec)','SCORE']].head(7))\n        return result.value\n    else:\n        print(f\"[ERROR]: {result.error}\")\n        return None\n    \nif __name__ == \"__main__\":\n    df = asyncio.run(example_usage())\n```\n\nPROVIDER | RSN      | EVENT         | YEAR  | MAGNITUDE |           STATION            | VS30(m/s) | RRUP(km)   |  MECHANISM  | PGA(cm2/sec) | PGV(cm/sec) | SCORE  \n---------|----------|---------------|------ |---------- |------------------------------|-----------|----------  | ----------- |-----------   |-----------  |-------------\nPEER     |  900     |  Landers      |  1992 |    7.28   |  Yermo Fire Station          |    353.63 |  23.620000 |  StrikeSlip |  217.776277  |  40.263000  |  100.000000\nPEER     |  3753    |  Landers      |  1992 |    7.28   |  Fun Valley                  |    388.63 |  25.020000 |  StrikeSlip |  206.125976  |  19.963000  |  100.000000\nPEER     |  1615    |  Duzce, Turkey|  1999 |    7.14   |  Lamont 1062                 |    338.00 |  9.140000  |  StrikeSlip |  202.664229  |  14.630000  |  100.000000\nPEER     |  881     |  Landers      |  1992 |    7.28   |  Morongo Valley Fire Station |    396.41 |  17.360000 |  StrikeSlip |  188.768206  |  24.317000  |  100.000000\nPEER     |  1762    |  Hector Mine  |  1999 |    7.13   |  Amboy                       |    382.93 |  43.050000 |  StrikeSlip |  182.933249  |  23.776000  |  100.000000\nAFAD     |  327943  |  17966        |  2023 |    7.70   |  DS\u0130, Musa \u015eahin Bulvar\u0131     |    350.00 |  27.110381 |  StrikeSlip |  185.737903  |  29.642165  |  91.304348\nAFAD     |  327943  |  17966        |  2023 |    7.70   |  DS\u0130, Musa \u015eahin Bulvar\u0131     |    350.00 |  27.110381 |  StrikeSlip |  185.737903  |  29.642165  |  91.304348\n\n\n## \ud83d\udee0 Mimari\n\n```bash\nselection_service/\n\u2502\n\u251c\u2500\u2500 providers/          # Veri sa\u011flay\u0131c\u0131lar (AFAD, FDSN, PEER\u2026)\n\u251c\u2500\u2500 core/               # Pipeline ve API\n\u251c\u2500\u2500 processing/         # SearchCriteria, Result, vs.\n\u251c\u2500\u2500 utility/            # Yard\u0131mc\u0131 fonksiyonlar\n\u251c\u2500\u2500 enums/              # ProviderName gibi enumlar\n\u251c\u2500\u2500 data/               # Kullan\u0131lan csv ve excel dosyalar\u0131\n\ntests/              # pytest testleri\n\n```\n\n## \ud83e\udd1d Provider Ekleme Ad\u0131mlar\u0131\n\n- enums.Enums.ProviderName k\u0131sm\u0131na ismini ekle\n\n- Yeni provider eklemek i\u00e7in providers/ alt\u0131na python dosyas\u0131n\u0131 a\u00e7.\n\n- Provider s\u0131n\u0131f\u0131 mutlaka IDataProvider'\u0131 miras almal\u0131.\n\n- Provider a \u00f6zel BaseColumnMapper s\u0131n\u0131f\u0131n\u0131 miras alan mapping s\u0131n\u0131f\u0131n\u0131 yaz ve ColumnMapperFactory e ekle\n\n- ProviderFactory de create methoduna ekle\n\n- Unit test yazmay\u0131 unutma.\n\n\n## \ud83d\udccc Yol Haritas\u0131\n\n- [ ] Yeni provider: FDSN\n\n\n## \ud83d\udcdc Lisans\n\nMIT License\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2025 Muhammed Sural\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.\n        ",
    "summary": "A library for earthquake selection",
    "version": "1.0.0",
    "project_urls": {
        "Changelog": "https://github.com/muhammedsural/SELECTIONEARTHQUAKE/releases",
        "Documentation": "https://muhammedsural.github.io/SELECTIONEARTHQUAKE",
        "Homepage": "https://github.com/muhammedsural/SELECTIONEARTHQUAKE",
        "Issues": "https://github.com/muhammedsural/SELECTIONEARTHQUAKE/issues",
        "Repository": "https://github.com/muhammedsural/SELECTIONEARTHQUAKE"
    },
    "split_keywords": [
        "earthquake",
        " seismology",
        " data-processing",
        " selection",
        " peer",
        " nga",
        " afad"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cd84bc27ee58e9a27c6360808e5a8d3c8ad761ae5d7099f0e1218cb47a8a773e",
                "md5": "14552f64d544ba0ca650e28244569695",
                "sha256": "f3e9d2cf0ff6595adf42da3eae5998cf1ea941467828acca150a327d3c21bd8a"
            },
            "downloads": -1,
            "filename": "earthquake_selection-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "14552f64d544ba0ca650e28244569695",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 1679847,
            "upload_time": "2025-10-07T10:27:35",
            "upload_time_iso_8601": "2025-10-07T10:27:35.094351Z",
            "url": "https://files.pythonhosted.org/packages/cd/84/bc27ee58e9a27c6360808e5a8d3c8ad761ae5d7099f0e1218cb47a8a773e/earthquake_selection-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "799a393adce310456ba23643113d337274969c91fe174f446183121419b42316",
                "md5": "2f97f9f98a55dcc021f845fc5452b465",
                "sha256": "130296128fcecd02dc442f2d0a5de0045371daf5f13e5704acd48b2982f096dd"
            },
            "downloads": -1,
            "filename": "earthquake_selection-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2f97f9f98a55dcc021f845fc5452b465",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 1657329,
            "upload_time": "2025-10-07T10:27:36",
            "upload_time_iso_8601": "2025-10-07T10:27:36.918132Z",
            "url": "https://files.pythonhosted.org/packages/79/9a/393adce310456ba23643113d337274969c91fe174f446183121419b42316/earthquake_selection-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-07 10:27:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "muhammedsural",
    "github_project": "SELECTIONEARTHQUAKE",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "earthquake-selection"
}
        
Elapsed time: 1.90496s