Skip to content

PyEarthquake is a Python wrapper for USGS Earthquake Catalog API that manages data querying and result processing.

License

Notifications You must be signed in to change notification settings

shenjianan97/PyQuakes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyQuakes

PyQuakes is a Python wrapper for USGS Earthquake Catalog API that manages data querying and result processing. PyEarthquake also integrates Bing Map API to manage geolocation of events.

Features of PyQuakes

  • Handles the HTTP requests, and the HTTP error. Only needs to focus on setting parameters and data processing.
  • Supports setting the query parameters
  • Supports searching with multiple time periods with easy-to-understand time format.
  • Supports searching with multiple locations with pre-defined location classes.
  • Provides geocoding functionality so that users are able to search the location without finding the coordinates.
  • Supports filtering, sorting and organizing the result.

Getting Started

Follow the instructions of Bing Map to get your own key and copy your Bing Map Key in key.txt file under src foler.

How to use

The EarthquakeQuery class has to be imported to use the API.

Import other classes if you would like to search by time and location or set other parameters.

Example

To use geocode API, please specify the path of the key file first:

EarthquakeQuery.set_geocode_key_path("filepath")

A typical usage to search a collection of results is:

from pyquakes import GeoRectangle, EarthquakeQuery, TimeFrame
import datetime

query = EarthquakeQuery()
query.set_time([TimeFrame(datetime(2010, 1, 1), datetime(2015, 1, 1))])
query.set_max_depth(1.0)
result = query.search()

A typical usage to search a specific earthquake by its event id is:

from pyquakes import EarthquakeQuery

event_id = "usc000lvb5"
result = EarthquakeQuery.search_by_event_id(event_id)

For more examples, please refer to the client folder. Several use cases are contained in the clinet folder with example codes. See the function without original suffix.

About

PyEarthquake is a Python wrapper for USGS Earthquake Catalog API that manages data querying and result processing.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages