← pakdata
Earthquakes M>=4 in and around Pakistan, 1973-2025 (USGS ComCat)
9,124 rowstarget: mag
US Public Domain (USGS-authored data)snapshot 2026.11
Source: U.S. Geological Survey (ANSS Comprehensive Earthquake Catalog, ComCat, FDSN event API)
Get it: pakdata (Python) · Hugging Face · Kaggle · CSV
Load it
pip install pakdata
from pakdata import load_pak_earthquakes
X, y = load_pak_earthquakes(return_X_y=True)
More ways (pandas, Polars, DuckDB, PyTorch, R, Excel, JavaScript): usage guide.
Data card
.. _pak_earthquakes_dataset:
Earthquakes M>=4 in and around Pakistan, 1973-2025 (USGS ComCat)
------------------------------------------------------------------
**Data Set Characteristics:**
:Number of Instances: 9124 earthquakes (one row per event)
:Number of Attributes: 16 (features) + target; 26 columns in ``frame``
:Default target: ``mag`` (earthquake magnitude, dimensionless; scale given by ``mag_type``)
:Time coverage: 1973-01-01 to 2025-12-31 (UTC); events per decade: 1970s 630, 1980s 1152,
1990s 1436, 2000s 2360, 2010s 2118, 2020s (2020-2025) 1428
:Geographic coverage: rectangle lat 23.5-37.2 N, lon 60.8-77.9 E (Pakistan's bounding box).
It also contains parts of Afghanistan, Iran, India, Tajikistan and China. By the USGS
``place`` string: Afghanistan 5850, Pakistan 2175, India 519, Tajikistan 339, Iran 99,
China 43, Uzbekistan 3, Turkmenistan 1, unassigned 95.
:Source: U.S. Geological Survey, ANSS Comprehensive Earthquake Catalog (ComCat),
FDSN event web service https://earthquake.usgs.gov/fdsnws/event/1/
:License: US Public Domain. "USGS-authored or produced data and information are considered
to be in the U.S. Public Domain" (https://www.usgs.gov/information-policies-and-instructions/copyrights-and-credits).
USGS asks for credit (https://www.usgs.gov/information-policies-and-instructions/acknowledging-or-crediting-usgs).
:Snapshot: 2026.11 (retrieved 2026-11-29)
**Columns:**
- ``event_id``: ComCat event id (identifier, excluded from features)
- ``time`` (UTC, ISO 8601): origin time (excluded from features; parsed as datetime). To
join with the daily ``date`` of pak_weather or pak_air_quality (Pakistan days), convert
first: ``time.dt.tz_convert("Asia/Karachi").dt.tz_localize(None).dt.normalize()``
- ``year``, ``month``: from ``time`` (UTC)
- ``latitude``, ``longitude`` (decimal degrees): epicentre
- ``depth_km`` (km): hypocentre depth. Many shallow events are fixed at 10 km or 33 km by
the location algorithm rather than measured
- ``mag``: preferred magnitude (TARGET). Range 4.0-7.7, median 4.4
- ``mag_type``: magnitude scale: mb 8556, mwc 206, mww 131, mw 113, mwb 60, ms 34, mwr 21, mblg 2, ml 1
- ``nst``: number of seismic stations used to locate the event (missing 58.6%)
- ``gap_deg`` (degrees): largest azimuthal gap between stations (missing 42.1%)
- ``dmin_deg`` (degrees): distance to the nearest station (missing 67.5%)
- ``rms_s`` (seconds): RMS travel-time residual (missing 8.1%)
- ``horizontal_error_km`` (km): horizontal location uncertainty (missing 70.7%)
- ``depth_error_km`` (km): depth uncertainty (missing 40.5%)
- ``mag_error``: magnitude uncertainty (missing 67.7%; excluded from features)
- ``mag_nst``: number of stations used for the magnitude (missing 14.2%; excluded from features)
- ``status``: review status (all ``reviewed``; excluded)
- ``net``: contributing network (``us`` for 9122 events, ``iscgem``/``iscgemsup`` for 2; excluded)
- ``location_source``, ``mag_source``: agency that provided the location / magnitude (excluded)
- ``place``: USGS text description, e.g. "21 km NNE of Muzaffar?b?d, Pakistan" (excluded)
- ``country``: country parsed from the end of ``place`` (empty when not assignable, see caveats)
- ``in_pakistan`` (bool): ``country == "Pakistan"`` (2175 events). Based only on the USGS text
- ``nearest_city``: nearest of Karachi, Lahore, Islamabad, Peshawar, Quetta, Gilgit, Muzaffarabad
- ``distance_km`` (km): great-circle (haversine) distance from the epicentre to ``nearest_city``
``frame`` contains every column; ``data`` (X) leaves out the excluded ones listed above and the target.
**How it was built:** ``scripts/build_pak_earthquakes.py`` asks the ComCat FDSN ``query``
endpoint (``format=csv``, the bounding box above, ``minmagnitude=4.0``) for one calendar year
at a time, 1973-2025 (each year is far below the 20000-row API limit; 9128 events in total,
which matches the API ``count`` endpoint). It keeps only ``type == "earthquake"``: 4 events
labelled "nuclear explosion" (nuclear tests at Pokhran, India and Chagai, Pakistan) are
dropped. It renames columns to snake_case with units, parses ``country`` from ``place``, works
out ``nearest_city``/``distance_km`` from fixed city-centre coordinates, and sorts by ``time``.
No values were imputed or changed.
**Caveats and known biases:**
- The catalogue is not homogeneous. Detection gets better over time (the rise in counts after
2000 comes mostly from better networks, not more earthquakes), and the M4 completeness
threshold changes over the years and by region.
- Magnitudes mix scales: most events are body-wave ``mb``, and large ones have moment
magnitudes (``mw*``). ``mag_type`` and the station counts (``nst``) are therefore
indirect clues about size: bigger earthquakes are recorded by more stations and get Mw.
They are kept as features (they are not computed from ``mag``) but they carry most of the
predictive signal. Cross-validated R^2 for ``mag``: about 0.62 with all features, 0.51
without ``mag_type``, and 0.15 with location and time only. Earthquake size really is hard to
predict.
- ``mag_error`` and ``mag_nst`` come from the magnitude calculation itself, so they are
excluded from X.
- ``country`` comes only from the USGS ``place`` text. That text names the nearest populated
place, not the country the epicentre is legally in, and USGS does not take a position on
disputed borders. Kashmir strings ("northwestern Kashmir", etc.) and multi-country
"border region" strings are left empty (95 events, 1.0%). ``in_pakistan`` is False for
these, so it is not an exact legal or geographic boundary test. For example, the 2005
Kashmir earthquake is labelled "21 km NNE of Muzaffar?b?d, Pakistan".
- Non-ASCII letters in place names (e.g. a-macron) appear as ``?`` in the USGS CSV output
(3785 rows). They are kept exactly as delivered.
- Aftershock sequences (e.g. after 2005-10-08 and 2013-09-24) make events dependent on each
other in space and time. Random train/test splits will overstate skill, so prefer
splitting by time.
- Depths fixed at standard values (10 or 33 km) show up as spikes in the distribution.
**Notable events (all present):** 2005-10-08 Kashmir M7.6 (mwc, nearest city Muzaffarabad);
2013-09-24 Awaran, Balochistan M7.7; 2011-01-18 Dalbandin M7.2; 1997-02-27 Harnai M7.1;
2015-10-26 Hindu Kush M7.5; 2013-04-16 Saravan/Khash, Iran M7.7.
**Suggested tasks:**
1. Regression (beginner): predict ``mag`` from location, depth and station-geometry
features. Compare LinearRegression with RandomForest, then refit without ``mag_type``
and ``nst`` to see how much signal comes from how the event was recorded rather than from
the physics.
2. Regression: predict ``depth_km`` (``load_pak_earthquakes(target="depth_km")``) from
latitude and longitude. The deep Hindu Kush subduction zone (up to ~400 km) is easy to
learn (R^2 about 0.8).
3. Clustering: run DBSCAN or KMeans on (latitude, longitude, depth_km) to find seismic zones
(Hindu Kush, Pamir, Chaman fault, Makran, Himalayan front), then look at the clusters on a map.
4. Time series: count events per month for ``in_pakistan`` and plot the 2005 aftershock
decay. Fit Omori's law, or study the Gutenberg-Richter magnitude-frequency relation
(b-value) after 2000.
**Citation / attribution:**
Earthquake catalog data courtesy of the U.S. Geological Survey. Source: U.S. Geological
Survey, ANSS Comprehensive Earthquake Catalog (ComCat), https://earthquake.usgs.gov/fdsnws/event/1/
(retrieved 2026-11-29). Visit the USGS at https://usgs.gov.
Cite
Earthquake catalog data courtesy of the U.S. Geological Survey. Source: U.S. Geological Survey, ANSS Comprehensive Earthquake Catalog (ComCat), https://earthquake.usgs.gov/fdsnws/event/1/ (retrieved 2026-11-29). Visit the USGS at https://usgs.gov.
Packaged by pakdata, DOI 10.5281/zenodo.24662545.