pyrocko.squirrel.client.base

Base class for Squirrel remote data clients.

Classes

Constraint(**kwargs)

Used by some data-sources to grow or join locally mirrored data selections.

Source(*args, **kwargs)

Base class for Squirrel data-sources.

SourceInfo(**kwargs)

Summary information about a data source.

class Constraint(**kwargs)[source]

Bases: Object

Used by some data-sources to grow or join locally mirrored data selections.

Squirrel data-sources typically try to mirror only a subset of the remotely available data. This subset may need to be grown or updated when data from other time intervals or from locations outside the initially requested region is requested. This class helps in the involved bookeeping.

The current implementation only supports a time interval selection with a single time span but more sophisticated constraints, including e.g. location boxes could be thought of.

♦ tmin

pyrocko.util.get_time_float (pyrocko.guts.Timestamp), optional

Start time of constrained interval, or None for an open start.

♦ tmax

pyrocko.util.get_time_float (pyrocko.guts.Timestamp), optional

End time of constrained interval, or None for an open end.

♦ codes

list of pyrocko.model.codes.CodesNSLCE objects, optional

Codes patterns of channels the constraint applies to, or None for no restriction.

contains(constraint)[source]

Check if the constraint completely includes a more restrictive one.

Parameters:

constraint (Constraint) – Other constraint.

expand(constraint)[source]

Widen constraint to include another given constraint.

Parameters:

constraint (Constraint) – Other constraint.

Update is done in-place.

class Source(*args, **kwargs)[source]

Bases: HasPaths

Base class for Squirrel data-sources.

Data-sources can be attached to a Squirrel instance to allow transparent access to remote (or otherwise generated) resources, e.g. through FDSN web services (FDSNSource) or online event catalogs (CatalogSource).

Derived classes implement the details of querying, caching, updating and bookkeeping of the accessed data.

update_channel_inventory(squirrel, constraint)[source]

Let local inventory be up-to-date with remote for a given constraint.

update_event_inventory(squirrel, constraint)[source]

Let local inventory be up-to-date with remote for a given constraint.

update_waveform_promises(squirrel, constraint)[source]

Let local inventory be up-to-date with remote for a given constraint.

remove_waveform_promises(squirrel, from_database='selection')[source]

Remove waveform promises from live selection or global database.

Parameters:

from_database – Remove from live selection 'selection' or global database 'global'.

update_response_inventory(squirrel, constraint)[source]

Let local inventory be up-to-date with remote for a given constraint.

describe()[source]

Get short description of the source, for use as its id in info().

get_cache_path()[source]

Get path to the source’s on-disk cache directory, if any.

Return type:

str or None

info()[source]

Get summary information about the source.

Return type:

SourceInfo

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

Set up the source so it is ready to be used with a squirrel instance (internal use, see add_source()).

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

  • check (bool) – If True, check file modification times of already indexed local files (slow). If False, use Squirrel’s fast --optimistic mode instead.

  • upgrade (bool) – If True, automatically migrate any FDSN waveform archives found using an outdated on-disk storage layout.

class SourceInfo(**kwargs)[source]

Bases: Object

Summary information about a data source.

♦ source

Source

The described source.

♦ id

str

Short identifying description of the source (see Source.describe()).

♦ cache_path

str, optional

Path to the source’s on-disk cache directory, if any.