Skip to main content

An async INGV Centro Nazionale Terremoti (Earthquakes) QuakeML client library.

Project description

python-quakeml-ingv-centro-nazionale-terremoti-client

Build Status codecov PyPi Version

This library provides convenient async access to the INGV Centro Nazionale Terremoti (Earthquakes) QuakeML feeds.

Examples

Retrieve all events from the last 24 hours (default timeframe):

import asyncio
from aiohttp import ClientSession
from aio_quakeml_ingv_centro_nazionale_terremoti_client import IngvCentroNazionaleTerremotiQuakeMLFeed
async def main() -> None:
    async with ClientSession() as websession:    
        # Home Coordinates: Latitude: 43.7, Longitude: 11.2
        feed = IngvCentroNazionaleTerremotiQuakeMLFeed(websession, 
                                                       (43.7, 11.2))
        status, entries = await feed.update()
        print(status)
        if entries:
            for entry in entries:
                print(f"- ID: {entry.external_id} - Magnitude: {entry.magnitude.mag} - Distance: {entry.distance_to_home:.2f}")
asyncio.get_event_loop().run_until_complete(main())

Retrieve all events from the last 24 hours (default timeframe) and within a radius of 100km around the provided home coordinates:

import asyncio
from aiohttp import ClientSession
from aio_quakeml_ingv_centro_nazionale_terremoti_client import IngvCentroNazionaleTerremotiQuakeMLFeed
async def main() -> None:
    async with ClientSession() as websession:    
        # Home Coordinates: Latitude: 43.7, Longitude: 11.2
        # Filter radius: 100 km
        feed = IngvCentroNazionaleTerremotiQuakeMLFeed(websession, 
                                                       (43.7, 11.2),
                                                       filter_radius=100)
        status, entries = await feed.update()
        print(status)
        if entries:
            for entry in entries:
                print(f"- ID: {entry.external_id} - Magnitude: {entry.magnitude.mag} - Distance: {entry.distance_to_home:.2f}")
asyncio.get_event_loop().run_until_complete(main())

Retrieve all events from the last 24 hours (default timeframe), within a radius of 100km around the provided home coordinates, and with a magnitude of 2.0 or higher:

import asyncio
from aiohttp import ClientSession
from aio_quakeml_ingv_centro_nazionale_terremoti_client import IngvCentroNazionaleTerremotiQuakeMLFeed
async def main() -> None:
    async with ClientSession() as websession:    
        # Home Coordinates: Latitude: 43.7, Longitude: 11.2
        # Filter radius: 100 km
        # Filter minimum magnitude: 2.0
        feed = IngvCentroNazionaleTerremotiQuakeMLFeed(websession, 
                                                       (43.7, 11.2),
                                                       filter_radius=100,
                                                       filter_minimum_magnitude=2.0)
        status, entries = await feed.update()
        print(status)
        if entries:
            for entry in entries:
                print(f"- ID: {entry.external_id} - Magnitude: {entry.magnitude.mag} - Distance: {entry.distance_to_home:.2f}")
asyncio.get_event_loop().run_until_complete(main())

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

Built Distribution

File details

Details for the file aio_quakeml_ingv_centro_nazionale_terremoti_client-0.4.tar.gz.

File metadata

File hashes

Hashes for aio_quakeml_ingv_centro_nazionale_terremoti_client-0.4.tar.gz
Algorithm Hash digest
SHA256 74677fee7ecec347e0d92d78f5406fe79e560677f6e3ff4cf8a38e6a4b9af713
MD5 1e5f29e41914831705ad7dd33c4285fd
BLAKE2b-256 69cfe2efe8c297719dd39520360bc4321fc8d16675caccc423ebd645703c8113

See more details on using hashes here.

File details

Details for the file aio_quakeml_ingv_centro_nazionale_terremoti_client-0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for aio_quakeml_ingv_centro_nazionale_terremoti_client-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dc5dae542531d80b1bb223fcb88b17f4a6018bfe9b6bc06adbc60cabde0a722f
MD5 82e7a130f3d00c2ceb1bd0a6df5de3f2
BLAKE2b-256 36090e1c8f84d506d0e2b60f6027d24ee695f9d04e9678d7051a5e97329f0b46

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