Skip to main content

A library to intuitively access and handle earthquake data

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

equake-0.0.1.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

equake-0.0.1-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file equake-0.0.1.tar.gz.

File metadata

  • Download URL: equake-0.0.1.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.1

File hashes

Hashes for equake-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c963ca438e814613664ccdcb792aa4826506afaae8770291dba084852d082539
MD5 ffda1fca1c8f0a79571b3b3c6f3a2ea2
BLAKE2b-256 9158348918fe36b3bb51b320966807e10b748c000b0ed1c7d812c4b775aae0dc

See more details on using hashes here.

File details

Details for the file equake-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: equake-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.1

File hashes

Hashes for equake-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 973cb57828ff3d826523079079fc9ec9d4ac8a92efe3e06f92c154d8f11459ae
MD5 864671c0df32ed0c6e9dbeca30da4bbc
BLAKE2b-256 96cf5560f8eab37a152b39b91931650f0a77be218254f0f11a99e88a3e982163

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page