Skip to Content
cwa
Guides

Earthquakes

Felt earthquake reports, local intensities and epicentral distances.

cwa.earthquakes returns the CWA’s felt earthquake reports, with magnitude, epicenter, depth and local intensities.

import cwa

quake = cwa.earthquakes.latest()

if quake:
    print(quake.occurred_at, quake.epicenter_description)
    print(f"M{quake.magnitude}, {quake.depth_km} km deep, max intensity {quake.maximum_intensity}")
MethodReturns
latest()The newest report, or None if there is none
recent(limit=20)Recent reports, newest first, at most limit

Results include both kinds of report:

ReportMeaningnumber
Significant felt earthquakeLarger or more widely felt, with an official numberReport number
Local felt earthquakeSmaller, felt only locallyNone

Earthquake fields

FieldMeaning
occurred_atWhen it happened
magnitude, magnitude_scaleMagnitude and its scale as the CWA writes it, such as 芮氏規模 (local magnitude)
depth_kmFocal depth (km)
epicenterEpicenter coordinates
epicenter_descriptionWhere the epicenter is, in the CWA’s Chinese wording
maximum_intensityThe highest intensity anywhere in Taiwan
intensitiesEvery intensity listed in the report
report_urlThe CWA report page, or None

Intensity at a place

level = quake.intensity_at("臺北市")

intensity_at() accepts a county, township or name and returns only an intensity the report explicitly lists for that place. If the report does not list it, the result is None; the SDK never substitutes the county’s intensity for a township.

Intensities are IntensityLevel values. They compare by size, and str() gives the CWA label:

from cwa import IntensityLevel

if level is not None and level >= IntensityLevel.FIVE_WEAK:
    print(f"Intensity {level}, take care")  # Intensity 5弱, take care

Epicentral distance

distance_to() returns the horizontal distance from a place to the epicenter in km, not counting depth. The place can be a name, township or coordinates:

print(quake.distance_to("臺北市信義區"))

English reports

Pass language="en" to latest() or recent() to read the English reports. Place names map to the same County members:

report = cwa.earthquakes.latest(language="en")