Skip to main content

equake

equake is a Python library to intuitively access and handle earthquake data.

This library retrieves earthquake data from the USGS earthquake database and allows you to apply various filters to customise your search.

Benefits

  • This library is a convenient wrapper of the USGS Earthquake API, meaning you can communicate with its key functionality in an object-oriented, Pythonic way.
  • Plenty of very thorough validation is provided to ensure robustness.
  • The abstraction means you can focus on the more important details of your program rather than actually preparing the query string to send a request, for example.
  • Both kilometres and miles are supported.
  • The code has been rigorously tested for Python 3.7 and above, and major bugs have been fixed.
  • The library has been documented fully, with the documentation inside the code.
  • There are no third-party dependencies at all, not even the widely used requests library. This makes installation of the library very easy and error-free.

Installation

Pip can be used to easily install this library.

pip install equake

Note: This library supports Python 3.7 and above. Slightly older versions might work, but they have not been tested, so this is not guaranteed. Python 2 is incompatible.

Getting Started

For full details, consult the code documentation.

The main modules available are filt and quake

filt handles the filter functionality, allowing you to create filters to search for earthquakes.

quake allows you to count/get earthquakes from the API, and also holds the Earthquake class.

Create a Filter

To search for earthquakes, you first must create a filter in the filt module.

The overarching filter object is EarthquakeFilter, which consists of sub-filters.

  • TimeFilter - filter earthquakes by time of the event, and time updated.
  • LocationFilter - filter earthquakes by location (Rectangle/Circle).
  • DepthFilter - filter earthquakes by depth.
  • MagnitudeFilter - filter earthquakes by magnitude.
  • IntensityFilter - filter earthquakes by maximum intensity.
  • PAGER Level - filter earthquakes by severity of damage.
  • Minimum reports - filter earthquakes by minimum number of reports from the public.

For example, to create a filter for earthquakes with a depth between 100 and 200 kilometres, a magnitude between 5 and 7, a PAGER level of 'orange', and 100 minimum reports, the following code would be used:

from equake import filt

earthquake_filter = filt.EarthquakeFilter(
    filt.DepthFilter(100, 200),
    filt.MagnitudeFilter(5, 7),
    pager_level="orange",
    min_reports=100
)

For more complex use cases, see the examples folder and the documentation.

Count or Get Earthquakes

Once you have a filter, you can count/get earthquakes by using the quake module.

To count/get the number of earthquakes in a simple way, this is the code you would use.

from equake import filt, quake

earthquake_filter = filt.EarthquakeFilter() # Just for example purposes.
earthquake_count = quake.count(earthquake_filter)
earthquakes = quake.get(earthquake_filter)

Again, for more complex use cases, see the examples folder and the documentation.

Metadata

Release files for equake 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for equake 0.0.1
File Size Uploaded
equake-0.0.1.tar.gz 16.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for equake 0.0.1
File Interpreter ABI Platform
equake-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 32.8 kB

Release files / equake-0.0.1.tar.gz

Download URL equake-0.0.1.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c963ca438e814613664ccdcb792aa4826506afaae8770291dba084852d082539
BLAKE2b-256 checksum
How to use checksums
9158348918fe36b3bb51b320966807e10b748c000b0ed1c7d812c4b775aae0dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.1

Release files / equake-0.0.1-py3-none-any.whl

Download URL equake-0.0.1-py3-none-any.whl
Size 16.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
973cb57828ff3d826523079079fc9ec9d4ac8a92efe3e06f92c154d8f11459ae
BLAKE2b-256 checksum
How to use checksums
96cf5560f8eab37a152b39b91931650f0a77be218254f0f11a99e88a3e982163
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.1

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page