Client¶
ingv_shakemap.client ¶
An async client for the INGV event catalogue and the ShakeMap grids.
Give it your httpx.AsyncClient and timeouts, proxies and pooling stay
yours; give it none and it opens (and closes) its own. Network errors and
429/5xx are retried retries times with exponential backoff.
To route every request through your own HTTP layer (a shared retry policy,
a cache, a rate limiter), pass send: an async (method, url, **kwargs)
-> httpx.Response. The client then uses it for every call and does no
retrying of its own.
What the services answer, and what you get back:
- no events in the window: the FDSN service says 204, you get
[]; - an event with no ShakeMap (small or too recent): 404, you get
None; - anything else that is not a success raises :class:
IngvError, so an unreachable catalogue never looks like a quiet week.
IngvClient ¶
The INGV FDSN event service and the ShakeMap grids.
events
async
¶
events(start: datetime, end: datetime, *, bbox: BBox = ITALY, min_magnitude: float | None = None, max_depth_km: float | None = None, limit: int | None = None, updated_after: datetime | None = None) -> list[Event]
The earthquakes in bbox between start and end, newest first.
With updated_after, only those created or revised after it.
product
async
¶
product(event_id: str | int, name: str) -> bytes | None
One file of an event's ShakeMap, raw; None if INGV published none.
name is grid.xml, uncertainty.xml, info.json,
stationlist.json or any other file of the map's products.
shakemap_xml
async
¶
shakemap_xml(event_id: str | int) -> bytes | None
The raw grid.xml of an event; None if INGV published no ShakeMap.
shakemap
async
¶
shakemap(event_id: str | int) -> ShakeGrid | None
The ShakeMap of an event, parsed in a thread; None if there is none.
uncertainty
async
¶
uncertainty(event_id: str | int) -> ShakeGrid | None
The map's uncertainty (STDPGA in ln g, STDPGV, STDMMI...) as a grid.
Low near the stations, high where the map is the model alone.
info
async
¶
info(event_id: str | int) -> ShakeMapInfo | None
The map's info.json: its version and status for a few kB, not 12 MB.
stations
async
¶
stations(event_id: str | int) -> list[Station] | None
The stations behind the map, with what they recorded.