pyrocko.squirrel.client.catalog

Squirrel online earthquake catalog client.

Functions

get_catalog(name)

Get online catalog client by name.

Classes

CatalogSource(catalog[, query_args])

Squirrel data-source to transparently access online earthquake catalogs.

Link(tmin, tmax, tmodified[, nevents, ...])

Chain link representing a locally mirrored time span of a CatalogSource's remote catalog (internal use).

Exceptions

NoSuchCatalog

Raised when an unknown catalog name is requested, see get_catalog().

Bases: object

Chain link representing a locally mirrored time span of a CatalogSource’s remote catalog (internal use).

exception NoSuchCatalog[source]

Bases: Exception

Raised when an unknown catalog name is requested, see get_catalog().

get_catalog(name)[source]

Get online catalog client by name.

Parameters:

name (str) – Catalog name, one of 'geofon', 'gcmt', 'isc' or 'usgs'.

Raises:

NoSuchCatalog – If name is not one of the known catalogs.

class CatalogSource(catalog, query_args=None, **kwargs)[source]

Bases: Source

Squirrel data-source to transparently access online earthquake catalogs.

The catalog source maintains and synchronizes a partial copy of the online catalog, e.g. of all events above a certain magnitude. The time span for which the local copy of the catalog should be up-to date is maintained automatically be Squirrel. Data is loaded and updated in chunks as needed in a just-in-time fashion. Data validity can optionally expire after a given period of time and new data can be treated to be preliminary. In both cases information will be refreshed as needed.

♦ catalog

str

Catalog name.

♦ query_args

dict of str objects, optional

Common arguments, which are appended to all queries, e.g. to constrain location, depth or magnitude ranges.

♦ expires

float (pyrocko.guts.Duration), optional

Expiration time [s]. Information older than this will be refreshed, i.e. queried again.

♦ anxious

float (pyrocko.guts.Duration), optional

Anxiety period [s]. Information will be treated as preliminary if it was younger than this at the time of its retrieval. Preliminary information is refreshed on each query relevant to it.

♦ cache_path

str (pyrocko.has_paths.Path), optional

Directory path where the partial local copy of the catalog is kept. By default the Squirrel environment’s cache directory is used.

get_cache_path()[source]

Get path to this source’s on-disk cache directory.

Return type:

str

describe()[source]

Get short identifying description of the source.

Return type:

str

setup(squirrel, check=True, upgrade=False)[source]

Set up cache directory and add already-downloaded local events to the squirrel.

See setup() for the parameters.

make_hash()[source]

Compute hash identifying this source’s configuration.

Used to distinguish between differently-configured CatalogSource instances pointing at the same catalog when choosing on-disk cache locations.

Return type:

str

get_hash()[source]

Get hash identifying this source’s configuration (see make_hash()).

Return type:

str

update_event_inventory(squirrel, constraint=None)[source]

Query and cache events for a given constraint, refreshing any locally mirrored time spans found outdated (see expires/anxious).

Parameters:
  • squirrel (Squirrel) – Squirrel instance the source is attached to.

  • constraint (Constraint) – Selection of times to be brought up to date. Required; if its tmin/ tmax are unset, the current data holdings’ time span is used instead.

query_args_typed()[source]

Get query_args with known numeric keys (magnitude, latitude, longitude and depth ranges) converted from str to float.

Return type:

dict