tr-deprem 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tr_deprem-0.1.0/CHANGELOG.md +36 -0
- tr_deprem-0.1.0/CITATION.cff +20 -0
- tr_deprem-0.1.0/LICENSE +21 -0
- tr_deprem-0.1.0/MANIFEST.in +10 -0
- tr_deprem-0.1.0/PKG-INFO +325 -0
- tr_deprem-0.1.0/README.md +286 -0
- tr_deprem-0.1.0/pyproject.toml +128 -0
- tr_deprem-0.1.0/setup.cfg +4 -0
- tr_deprem-0.1.0/src/tr_deprem/__init__.py +74 -0
- tr_deprem-0.1.0/src/tr_deprem/__main__.py +7 -0
- tr_deprem-0.1.0/src/tr_deprem/_iller.py +351 -0
- tr_deprem-0.1.0/src/tr_deprem/_version.py +3 -0
- tr_deprem-0.1.0/src/tr_deprem/cli.py +352 -0
- tr_deprem-0.1.0/src/tr_deprem/client.py +293 -0
- tr_deprem-0.1.0/src/tr_deprem/errors.py +28 -0
- tr_deprem-0.1.0/src/tr_deprem/export.py +103 -0
- tr_deprem-0.1.0/src/tr_deprem/filters.py +147 -0
- tr_deprem-0.1.0/src/tr_deprem/geo.py +270 -0
- tr_deprem-0.1.0/src/tr_deprem/http.py +141 -0
- tr_deprem-0.1.0/src/tr_deprem/models.py +110 -0
- tr_deprem-0.1.0/src/tr_deprem/py.typed +0 -0
- tr_deprem-0.1.0/src/tr_deprem/sources/__init__.py +43 -0
- tr_deprem-0.1.0/src/tr_deprem/sources/afad.py +107 -0
- tr_deprem-0.1.0/src/tr_deprem/sources/base.py +102 -0
- tr_deprem-0.1.0/src/tr_deprem/sources/fdsn.py +193 -0
- tr_deprem-0.1.0/src/tr_deprem/sources/kandilli.py +144 -0
- tr_deprem-0.1.0/src/tr_deprem/stats.py +165 -0
- tr_deprem-0.1.0/src/tr_deprem/timeutil.py +138 -0
- tr_deprem-0.1.0/src/tr_deprem.egg-info/PKG-INFO +325 -0
- tr_deprem-0.1.0/src/tr_deprem.egg-info/SOURCES.txt +48 -0
- tr_deprem-0.1.0/src/tr_deprem.egg-info/dependency_links.txt +1 -0
- tr_deprem-0.1.0/src/tr_deprem.egg-info/entry_points.txt +2 -0
- tr_deprem-0.1.0/src/tr_deprem.egg-info/requires.txt +9 -0
- tr_deprem-0.1.0/src/tr_deprem.egg-info/top_level.txt +1 -0
- tr_deprem-0.1.0/tests/conftest.py +49 -0
- tr_deprem-0.1.0/tests/fixtures/afad.json +6 -0
- tr_deprem-0.1.0/tests/fixtures/emsc.json +20 -0
- tr_deprem-0.1.0/tests/fixtures/fdsn.txt +4 -0
- tr_deprem-0.1.0/tests/fixtures/kandilli_lst0.html +24 -0
- tr_deprem-0.1.0/tests/fixtures/usgs.geojson +5 -0
- tr_deprem-0.1.0/tests/test_cli.py +226 -0
- tr_deprem-0.1.0/tests/test_client.py +222 -0
- tr_deprem-0.1.0/tests/test_export.py +59 -0
- tr_deprem-0.1.0/tests/test_filters_dedup.py +144 -0
- tr_deprem-0.1.0/tests/test_geo.py +81 -0
- tr_deprem-0.1.0/tests/test_http.py +143 -0
- tr_deprem-0.1.0/tests/test_parsers.py +236 -0
- tr_deprem-0.1.0/tests/test_stats.py +120 -0
- tr_deprem-0.1.0/tests/test_timeutil.py +56 -0
- tr_deprem-0.1.0/tools/build_iller.py +247 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.1.0] - 2026-11-08
|
|
8
|
+
### Added
|
|
9
|
+
- **One client, four sources** (`DepremClient`): AFAD event API, Kandilli Observatory
|
|
10
|
+
(KOERI) latest-earthquakes list, USGS FDSN and EMSC/SeismicPortal FDSN, queried
|
|
11
|
+
concurrently. A failing source is reported in `client.errors` instead of failing the call.
|
|
12
|
+
- **Common `Earthquake` record**: UTC and Türkiye time, latitude, longitude, depth,
|
|
13
|
+
magnitude and type, Turkish location text, province/district when the source names
|
|
14
|
+
them, source, event id, event URL and revision status.
|
|
15
|
+
- **Filters**: time range (ISO dates or `24h`/`7g`-style durations), magnitude, depth,
|
|
16
|
+
bounding box, radius around a point, and province (`il`) by any spelling or plate code.
|
|
17
|
+
- **Cross-source de-duplication**: reports within ±60 s and ±30 km are merged and the
|
|
18
|
+
preferred source is kept (AFAD > Kandilli > EMSC > USGS by default); the others are
|
|
19
|
+
listed in `also_reported_by`.
|
|
20
|
+
- **Province lookup**: bundled centroids and ~500 m simplified outlines of the 81
|
|
21
|
+
provinces derived from Natural Earth (public domain), 29 KB in total;
|
|
22
|
+
point-in-polygon `il_bul`, `nearest_il` with offshore distance, Turkish/ASCII
|
|
23
|
+
normalisation and common aliases (Afyon, Maraş, Urfa, Antep, İçel ...).
|
|
24
|
+
- **Statistics**: counts per magnitude bin, Gutenberg-Richter b-value by Aki's maximum
|
|
25
|
+
likelihood with Utsu's binning correction and Shi & Bolt standard error, magnitude of
|
|
26
|
+
completeness by maximum curvature, and a one-call `summary`.
|
|
27
|
+
- **Outputs**: dataclasses, GeoJSON, JSON, CSV and (with the `pandas` extra) a DataFrame.
|
|
28
|
+
- **CLI `tr-deprem`**: `son` (latest, Turkish table), `ara` (search, `--istatistik`),
|
|
29
|
+
`izle` (poll and print new events; Ctrl-C stops), with `--json`, `--csv`,
|
|
30
|
+
`--geojson`; English aliases `latest`, `search`, `watch`.
|
|
31
|
+
- **Polite networking** on the standard library only: timeouts, retries with exponential
|
|
32
|
+
backoff (honouring `Retry-After`), gzip, response-size cap and a generic
|
|
33
|
+
`tr-deprem/<version>` User-Agent.
|
|
34
|
+
|
|
35
|
+
[Unreleased]: https://github.com/YusufEminoglu/tr_deprem_sdk/compare/v0.1.0...HEAD
|
|
36
|
+
[0.1.0]: https://github.com/YusufEminoglu/tr_deprem_sdk/releases/tag/v0.1.0
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use this software, please cite it as below."
|
|
3
|
+
authors:
|
|
4
|
+
- family-names: "Eminoğlu"
|
|
5
|
+
given-names: "Yusuf"
|
|
6
|
+
email: "yusufeminoglu@gmail.com"
|
|
7
|
+
orcid: "https://orcid.org/0009-0005-6000-2934"
|
|
8
|
+
title: "tr-deprem"
|
|
9
|
+
version: "0.1.0"
|
|
10
|
+
date-released: "2026-11-08"
|
|
11
|
+
license: "MIT"
|
|
12
|
+
repository-code: "https://github.com/YusufEminoglu/tr_deprem_sdk"
|
|
13
|
+
url: "https://pypi.org/project/tr-deprem/"
|
|
14
|
+
keywords:
|
|
15
|
+
- earthquake
|
|
16
|
+
- seismology
|
|
17
|
+
- Türkiye
|
|
18
|
+
- AFAD
|
|
19
|
+
- Kandilli
|
|
20
|
+
abstract: "Python client for Turkish earthquake data: AFAD, Kandilli Observatory (KOERI), USGS and EMSC through one interface, with cross-source de-duplication, province lookup, Gutenberg-Richter statistics and a Turkish command-line tool."
|
tr_deprem-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yusuf Eminoğlu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
include LICENSE
|
|
2
|
+
include README.md
|
|
3
|
+
include CHANGELOG.md
|
|
4
|
+
include CITATION.cff
|
|
5
|
+
include pyproject.toml
|
|
6
|
+
include src/tr_deprem/py.typed
|
|
7
|
+
recursive-include tests *.py
|
|
8
|
+
recursive-include tests/fixtures *
|
|
9
|
+
recursive-include tools *.py
|
|
10
|
+
global-exclude __pycache__ *.py[cod]
|
tr_deprem-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tr-deprem
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Turkish earthquake data in Python: one client for AFAD, Kandilli (KOERI), USGS and EMSC with de-duplication, province lookup, b-value statistics and a Turkish CLI.
|
|
5
|
+
Author-email: Yusuf Eminoğlu <yusufeminoglu@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/YusufEminoglu/tr_deprem_sdk
|
|
8
|
+
Project-URL: Repository, https://github.com/YusufEminoglu/tr_deprem_sdk
|
|
9
|
+
Project-URL: Issues, https://github.com/YusufEminoglu/tr_deprem_sdk/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/YusufEminoglu/tr_deprem_sdk/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: earthquake,deprem,seismology,turkey,turkiye,afad,kandilli,koeri,usgs,emsc,fdsn,gutenberg-richter,b-value,geojson,gis
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Environment :: Console
|
|
21
|
+
Classifier: Natural Language :: Turkish
|
|
22
|
+
Classifier: Natural Language :: English
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
25
|
+
Classifier: Intended Audience :: Science/Research
|
|
26
|
+
Classifier: Intended Audience :: Developers
|
|
27
|
+
Classifier: Typing :: Typed
|
|
28
|
+
Requires-Python: >=3.9
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Provides-Extra: pandas
|
|
32
|
+
Requires-Dist: pandas>=1.3.0; extra == "pandas"
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
37
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+
<div align="center">
|
|
41
|
+
|
|
42
|
+
# tr-deprem
|
|
43
|
+
|
|
44
|
+
[](https://pypi.org/project/tr-deprem/)
|
|
45
|
+
[](https://pypi.org/project/tr-deprem/)
|
|
46
|
+
[](https://github.com/YusufEminoglu/tr_deprem_sdk/actions/workflows/ci.yml)
|
|
47
|
+
[](https://github.com/YusufEminoglu/tr_deprem_sdk/blob/main/LICENSE)
|
|
48
|
+
[](https://docs.astral.sh/ruff/)
|
|
49
|
+
[](#development--geliştirme)
|
|
50
|
+
[](https://pypi.org/project/tr-deprem/)
|
|
51
|
+
|
|
52
|
+
**Türkiye deprem verisi için Python istemcisi: AFAD, Kandilli, USGS ve EMSC tek arayüzde.**
|
|
53
|
+
**Turkish earthquake data in Python: AFAD, Kandilli, USGS and EMSC through one interface.**
|
|
54
|
+
|
|
55
|
+
[Türkçe](#türkçe) • [English](#english) • [PyPI](https://pypi.org/project/tr-deprem/) • [Issues](https://github.com/YusufEminoglu/tr_deprem_sdk/issues)
|
|
56
|
+
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
> **Uyarı / Disclaimer:** `tr-deprem` resmi bir deprem uyarı veya erken uyarı sistemi
|
|
60
|
+
> **değildir**. Veriler kaynaklardan gecikmeli gelir ve sonradan revize edilebilir. Resmi
|
|
61
|
+
> bilgi ve afet durumunda talimatlar için [AFAD](https://www.afad.gov.tr/) ve
|
|
62
|
+
> [Kandilli Rasathanesi](http://www.koeri.boun.edu.tr/) duyurularını izleyin.
|
|
63
|
+
> *This is not an official warning or early-warning system. Data arrive with a delay and
|
|
64
|
+
> may be revised. Follow AFAD and Kandilli Observatory for official information.*
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Türkçe
|
|
69
|
+
|
|
70
|
+
### Neler yapar?
|
|
71
|
+
|
|
72
|
+
- **Dört kaynak, tek istemci:** AFAD olay servisi, Kandilli Rasathanesi (KOERI) son
|
|
73
|
+
depremler listesi, USGS ve EMSC (SeismicPortal) FDSN servisleri aynı anda sorgulanır.
|
|
74
|
+
- **Ortak kayıt:** Her deprem bir `Earthquake` nesnesidir: UTC ve TSİ zamanı, enlem,
|
|
75
|
+
boylam, derinlik, büyüklük ve türü (ML, Mw, MD, mb), Türkçe yer adı, il/ilçe, kaynak,
|
|
76
|
+
olay kimliği ve bağlantısı.
|
|
77
|
+
- **Tekrarları birleştirme:** Aynı deprem farklı kaynaklarda ±60 sn ve ±30 km içinde
|
|
78
|
+
ise tek kayıt kalır (varsayılan tercih: AFAD > Kandilli > EMSC > USGS); diğerleri
|
|
79
|
+
`also_reported_by` alanında listelenir.
|
|
80
|
+
- **Filtreler:** zaman aralığı (`2026-11-01`, `7g`, `24s`), büyüklük, derinlik, kutu
|
|
81
|
+
(bbox), bir nokta çevresinde yarıçap ve **il** (her yazımla veya plaka koduyla:
|
|
82
|
+
`"Muğla"`, `"MUGLA"`, `48`).
|
|
83
|
+
- **İl bulma:** 81 ilin sadeleştirilmiş sınırları ve ağırlık merkezleri pakete gömülüdür
|
|
84
|
+
(29 KB, Natural Earth, kamu malı). USGS/EMSC depremleri de Türkçe il adıyla gösterilir.
|
|
85
|
+
- **İstatistik:** büyüklük sınıflarına göre sayılar, Gutenberg-Richter **b-değeri**
|
|
86
|
+
(Aki en çok olabilirlik), tamamlılık büyüklüğü **Mc** (maksimum eğrilik).
|
|
87
|
+
- **Çıktılar:** Python nesneleri, GeoJSON, JSON, CSV, pandas DataFrame (isteğe bağlı).
|
|
88
|
+
- **Komut satırı:** `tr-deprem son | ara | izle`.
|
|
89
|
+
- **Bağımlılık yok:** yalnızca Python standart kütüphanesi; zaman aşımı, yeniden deneme
|
|
90
|
+
ve geri çekilme (backoff) her istekte vardır.
|
|
91
|
+
|
|
92
|
+
### Kurulum
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
pip install tr-deprem
|
|
96
|
+
|
|
97
|
+
# pandas DataFrame çıktısı için
|
|
98
|
+
pip install "tr-deprem[pandas]"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Python 3.9 ve üzeri gerekir.
|
|
102
|
+
|
|
103
|
+
### Hızlı başlangıç
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
import tr_deprem
|
|
107
|
+
|
|
108
|
+
# Son 24 saat, AFAD + Kandilli, tekrarlar birleştirilmiş, en yeni önce
|
|
109
|
+
for d in tr_deprem.son(min_magnitude=3):
|
|
110
|
+
print(d.time_tr, d.magnitude, d.magnitude_type, d.location, d.source)
|
|
111
|
+
|
|
112
|
+
# Ayrıntılı arama: dört kaynak, Malatya, son 7 gün, M >= 2.5
|
|
113
|
+
istemci = tr_deprem.DepremClient("tumu")
|
|
114
|
+
depremler = istemci.ara("7g", il="Malatya", min_magnitude=2.5)
|
|
115
|
+
print(istemci.errors) # erişilemeyen kaynak varsa burada görünür
|
|
116
|
+
|
|
117
|
+
# Bir noktanın çevresi (enlem, boylam) ve yarıçap (km)
|
|
118
|
+
yakin = istemci.ara("2026-11-01", center=(38.35, 38.31), radius_km=50)
|
|
119
|
+
|
|
120
|
+
# İstatistik
|
|
121
|
+
gr = tr_deprem.b_value(depremler) # Mc otomatik; az veri varsa ValueError
|
|
122
|
+
print(gr) # örn. "b = 1.02 ± 0.05, a = 4.31, Mc = 2.5, N = 61"
|
|
123
|
+
print(tr_deprem.magnitude_bins(depremler)) # örn. {2.0: 48, 3.0: 12, 4.0: 1}
|
|
124
|
+
|
|
125
|
+
# İl bulma
|
|
126
|
+
print(tr_deprem.nearest_il(39.52, 28.92)) # Balıkesir
|
|
127
|
+
print(depremler[0].konum()) # örn. ('Malatya', 'Battalgazi', None)
|
|
128
|
+
|
|
129
|
+
# Çıktılar
|
|
130
|
+
geojson = tr_deprem.to_geojson(depremler)
|
|
131
|
+
with open("depremler.csv", "w", encoding="utf-8-sig", newline="") as f: # Excel için BOM
|
|
132
|
+
tr_deprem.to_csv(depremler, f)
|
|
133
|
+
df = tr_deprem.to_dataframe(depremler) # pip install "tr-deprem[pandas]"
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Komut satırı
|
|
137
|
+
|
|
138
|
+
```console
|
|
139
|
+
$ tr-deprem son -n 6
|
|
140
|
+
Tarih / Saat (TSİ) Büy. Tip Der.km Enlem Boylam Yer Kaynak
|
|
141
|
+
------------------- ---- --- ------ ------- ------- ---------------------- --------
|
|
142
|
+
2026-11-08 22:42:04 1.7 ML 6.7 38.3320 38.8005 CANAKCI-KALE (MALATYA) Kandilli
|
|
143
|
+
2026-11-08 22:23:02 3.3 ML 7.0 39.5192 28.9182 Dursunbey (Balıkesir) AFAD +1
|
|
144
|
+
2026-11-08 22:14:46 1.2 ML 7.0 39.0905 33.1950 Kulu (Konya) AFAD
|
|
145
|
+
2026-11-08 21:51:34 1.5 ML 7.0 37.2708 28.5025 Menteşe (Muğla) AFAD +1
|
|
146
|
+
2026-11-08 21:29:26 1.0 ML 6.6 39.1462 28.2457 Sındırgı (Balıkesir) AFAD
|
|
147
|
+
2026-11-08 21:15:06 2.0 ML 11.1 38.2143 38.5225 Battalgazi (Malatya) AFAD +1
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`AFAD +1`: aynı deprem bir başka kaynakta da var (birleştirildi). `--ayri` ile
|
|
151
|
+
birleştirmeden gösterilir.
|
|
152
|
+
|
|
153
|
+
```console
|
|
154
|
+
$ tr-deprem son -k tumu -m 3 --saat 72 -n 5
|
|
155
|
+
Tarih / Saat (TSİ) Büy. Tip Der.km Enlem Boylam Yer Kaynak
|
|
156
|
+
------------------- ---- --- ------ ------- ------- --------------------- -------
|
|
157
|
+
2026-11-08 22:23:02 3.3 ML 7.0 39.5192 28.9182 Dursunbey (Balıkesir) AFAD +2
|
|
158
|
+
2026-11-08 19:49:19 3.2 ML 7.8 37.8925 35.2612 Yahyalı (Kayseri) AFAD +2
|
|
159
|
+
2026-11-08 14:01:20 3.2 ML 7.0 37.6422 35.3672 Aladağ (Adana) AFAD +2
|
|
160
|
+
2026-11-07 13:42:52 3.3 ML 10.8 40.5937 42.0227 Oltu (Erzurum) AFAD +2
|
|
161
|
+
2026-11-07 02:45:21 3.4 ML 6.9 34.5025 25.0347 Akdeniz AFAD
|
|
162
|
+
|
|
163
|
+
$ tr-deprem ara -k afad -b 10g --il Balıkesir --istatistik
|
|
164
|
+
Deprem sayısı: 82
|
|
165
|
+
Kaynaklara göre: AFAD: 82
|
|
166
|
+
Büyüklük aralığı: 0.8 - 3.3
|
|
167
|
+
Derinlik aralığı: 5.3 - 15.6 km
|
|
168
|
+
Büyüklük dağılımı:
|
|
169
|
+
0.0- 0.9 7 ###
|
|
170
|
+
1.0- 1.9 73 ##############################
|
|
171
|
+
2.0- 2.9 1 #
|
|
172
|
+
3.0- 3.9 1 #
|
|
173
|
+
Gutenberg-Richter (Aki MLE): b = 1.51 ± 0.23, Mc = 1.2 (maks. eğrilik), N(M≥Mc) = 54
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Diğer örnekler:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
tr-deprem ara -b 2026-11-01 -e "2026-11-05 12:00" -m 4 --json # saatler TSİ
|
|
180
|
+
tr-deprem ara -k tumu -b 7g --merkez Malatya --yaricap 100 --csv > malatya.csv
|
|
181
|
+
tr-deprem ara -k usgs,emsc -b 30g --bbox 26,36,30,40 --geojson > ege.geojson
|
|
182
|
+
tr-deprem izle -m 3 --aralik 60 # her 60 sn'de yeni M≥3 depremleri yazar; Ctrl-C ile durur
|
|
183
|
+
tr-deprem izle -k tumu --il İzmir --json # satır başına bir JSON kaydı
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
| Komut | Açıklama | Önemli seçenekler |
|
|
187
|
+
|---|---|---|
|
|
188
|
+
| `son` | Son depremler (tablo) | `--saat 24`, `-n 20`, `-m`, `--il`, `-k` |
|
|
189
|
+
| `ara` | Arama | `-b/-e` (TSİ), `-m/--max-mag`, `--bbox`, `--merkez` + `--yaricap`, `--il`, `--min/max-derinlik`, `--istatistik` |
|
|
190
|
+
| `izle` | Yeni depremleri yazdır | `--aralik 60`, `-m`, `--il`, `--ilk`, `--en-fazla` |
|
|
191
|
+
|
|
192
|
+
Ortak seçenekler: `-k/--kaynak afad,kandilli,usgs,emsc|tumu` (varsayılan `afad,kandilli`),
|
|
193
|
+
`--json | --csv | --geojson`, `--ayri`, `--zaman-asimi 15`.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## English
|
|
198
|
+
|
|
199
|
+
### What it does
|
|
200
|
+
|
|
201
|
+
`tr-deprem` is a dependency-free Python client for earthquakes in and around Türkiye.
|
|
202
|
+
|
|
203
|
+
- Queries **AFAD**, **Kandilli Observatory (KOERI)**, **USGS** and **EMSC** concurrently
|
|
204
|
+
and returns one list of `Earthquake` dataclasses (UTC + Türkiye time, lat, lon,
|
|
205
|
+
depth, magnitude + type, Turkish location text, province/district, source, id, URL).
|
|
206
|
+
- **De-duplicates** the same event across sources (±60 s, ±30 km), keeping the preferred
|
|
207
|
+
source (AFAD > Kandilli > EMSC > USGS by default) and recording the others.
|
|
208
|
+
- **Filters** by time, magnitude, depth, bounding box, radius around a point and
|
|
209
|
+
province (`il`, any spelling or plate code).
|
|
210
|
+
- **Province lookup** for any epicentre using a bundled 29 KB table of the 81 provinces
|
|
211
|
+
(centroids and ~500 m simplified outlines from public-domain Natural Earth).
|
|
212
|
+
- **Statistics**: counts per magnitude bin, Gutenberg-Richter b-value (Aki 1965 maximum
|
|
213
|
+
likelihood with Utsu's binning correction, Shi & Bolt 1982 error) and magnitude of
|
|
214
|
+
completeness by maximum curvature (Wiemer & Wyss 2000).
|
|
215
|
+
- **Outputs**: dataclasses, GeoJSON, JSON, CSV, pandas DataFrame (optional extra).
|
|
216
|
+
- **CLI** `tr-deprem` with Turkish commands and English aliases (`latest`, `search`, `watch`).
|
|
217
|
+
|
|
218
|
+
### Install
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
pip install tr-deprem
|
|
222
|
+
pip install "tr-deprem[pandas]" # DataFrame output
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Quickstart
|
|
226
|
+
|
|
227
|
+
```python
|
|
228
|
+
from tr_deprem import DepremClient, b_value, to_geojson
|
|
229
|
+
|
|
230
|
+
client = DepremClient(["afad", "kandilli", "usgs", "emsc"], timeout=10, retries=2)
|
|
231
|
+
|
|
232
|
+
latest = client.latest(hours=6, min_magnitude=2) # newest first
|
|
233
|
+
week = client.search("7d", il="Malatya") # province filter
|
|
234
|
+
box = client.search("2026-11-01", "2026-11-08", bbox=(26, 36, 30, 40), min_magnitude=3)
|
|
235
|
+
near = client.search("30d", center=(38.35, 38.31), radius_km=50)
|
|
236
|
+
|
|
237
|
+
for eq in latest:
|
|
238
|
+
print(eq.time.isoformat(), eq.time_tr.strftime("%H:%M"), eq.magnitude,
|
|
239
|
+
eq.location_tr, eq.source, eq.also_reported_by)
|
|
240
|
+
|
|
241
|
+
print(client.errors) # {"kandilli": "..."} if a source was unreachable
|
|
242
|
+
print(b_value(week)) # b = ..., a = ..., Mc = ..., N = ...
|
|
243
|
+
geojson = to_geojson(week)
|
|
244
|
+
|
|
245
|
+
for eq in client.watch(interval=60, min_magnitude=3): # generator; Ctrl-C to stop
|
|
246
|
+
print("new:", eq.magnitude, eq.location_tr)
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Times you pass in Python may be `datetime`, `date`, ISO strings or durations such as
|
|
250
|
+
`"24h"`, `"7d"`, `"30min"`; **naive values are UTC** in the Python API and **Türkiye time**
|
|
251
|
+
in the CLI.
|
|
252
|
+
|
|
253
|
+
### Command line
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
tr-deprem latest -n 10 # same as "son"
|
|
257
|
+
tr-deprem search --start 7d --province Izmir --min-mag 2 --json
|
|
258
|
+
tr-deprem search --source all --center 38.35,38.31 --radius 50 --stats
|
|
259
|
+
tr-deprem watch --min-mag 4 --interval 30
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Data sources / Veri kaynakları
|
|
265
|
+
|
|
266
|
+
| Source | Endpoint | Format | Time zone | Notes |
|
|
267
|
+
|---|---|---|---|---|
|
|
268
|
+
| AFAD | `https://deprem.afad.gov.tr/apiv2/event/filter` | JSON (numbers as strings) | UTC | Supports time, magnitude, depth, bbox, radius filters. In November 2026 the public API returned only about the **last 10-11 days** of events (older ranges come back empty); use USGS/EMSC for history. |
|
|
269
|
+
| Kandilli (KOERI RETMC) | `http://www.koeri.boun.edu.tr/scripts/lst0.asp` | fixed-width text in HTML, windows-1254 | **Türkiye local time** | Only the latest 500 events; no query API, all filters local. Preferred magnitude Mw > ML > MD. |
|
|
270
|
+
| USGS | `https://earthquake.usgs.gov/fdsnws/event/1/query` | GeoJSON | UTC (epoch ms) | Global; Türkiye box used when no spatial filter is given. |
|
|
271
|
+
| EMSC | `https://www.seismicportal.eu/fdsnws/event/1/query` | GeoJSON | UTC | Global; same default box. |
|
|
272
|
+
|
|
273
|
+
All four endpoints and their formats were checked against the live services on
|
|
274
|
+
2026-11-08. The parsers match fields by name (with fallbacks) and Kandilli lines by
|
|
275
|
+
pattern rather than column offsets, accept UTF-8 or windows-1254, and skip malformed
|
|
276
|
+
records instead of failing. The FDSN parser also understands the pipe-separated
|
|
277
|
+
`format=text` reply.
|
|
278
|
+
|
|
279
|
+
**Attribution / Atıf.** When you publish data obtained with this package, credit the
|
|
280
|
+
original source:
|
|
281
|
+
|
|
282
|
+
- **AFAD** - T.C. İçişleri Bakanlığı Afet ve Acil Durum Yönetimi Başkanlığı, Deprem Dairesi.
|
|
283
|
+
- **Kandilli** - Boğaziçi Üniversitesi Kandilli Rasathanesi ve Deprem Araştırma Enstitüsü,
|
|
284
|
+
Bölgesel Deprem-Tsunami İzleme ve Değerlendirme Merkezi. Their site states that the
|
|
285
|
+
data may be used **with attribution** and **not for commercial purposes** without the
|
|
286
|
+
university's written permission.
|
|
287
|
+
- **USGS** - U.S. Geological Survey Earthquake Hazards Program (public domain).
|
|
288
|
+
- **EMSC** - European-Mediterranean Seismological Centre, SeismicPortal; follow EMSC's
|
|
289
|
+
terms of use and acknowledge EMSC.
|
|
290
|
+
- **Province outlines** - derived from [Natural Earth](https://www.naturalearthdata.com/)
|
|
291
|
+
(public domain) by [`tools/build_iller.py`](tools/build_iller.py).
|
|
292
|
+
|
|
293
|
+
The library identifies itself with the generic User-Agent `tr-deprem/<version>`, uses
|
|
294
|
+
timeouts and limited retries with backoff, and does not poll faster than you ask. Please
|
|
295
|
+
keep polling intervals reasonable (the CLI default is 60 s).
|
|
296
|
+
|
|
297
|
+
### Accuracy notes
|
|
298
|
+
|
|
299
|
+
- **Province lookup** uses outlines simplified to ~500 m. On 808 onshore AFAD events
|
|
300
|
+
(late Oct - early Nov 2026) it agreed with AFAD's own province label for 91 % of
|
|
301
|
+
them; differences cluster near borders and where AFAD names the nearest settlement's
|
|
302
|
+
province. When a source names the province (AFAD, Kandilli), that name is used.
|
|
303
|
+
- **De-duplication** uses fixed tolerances (±60 s, ±30 km by default, both adjustable).
|
|
304
|
+
Different networks can place the same small event more than 30 km apart, and two
|
|
305
|
+
real events close in time and space from different sources may be merged.
|
|
306
|
+
- **b-values** from short or small catalogues are unstable; check `n` and `b_error`.
|
|
307
|
+
|
|
308
|
+
## Development / Geliştirme
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
git clone https://github.com/YusufEminoglu/tr_deprem_sdk
|
|
312
|
+
cd tr_deprem_sdk
|
|
313
|
+
pip install -e ".[dev,pandas]"
|
|
314
|
+
python -m pytest --cov=tr_deprem # tests use saved fixtures, no network
|
|
315
|
+
python -m ruff check . && python -m ruff format --check src tests tools
|
|
316
|
+
python -m mypy src
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
## Citation
|
|
320
|
+
|
|
321
|
+
See [`CITATION.cff`](CITATION.cff).
|
|
322
|
+
|
|
323
|
+
## License
|
|
324
|
+
|
|
325
|
+
MIT © Yusuf Eminoğlu. Data remain subject to their providers' terms (see above).
|