squirrel.model

Data model and content types handled by the Squirrel framework.

Squirrel uses flat content types to represent waveform, station, channel, response, event, and a few other objects. A common subset of the information in these objects is indexed in the database, currently: kind, codes, time interval and sampling rate. The Nut objects encapsulate this information together with information about where and how to get the associated bulk data.

Further content types are defined here to handle waveform orders, waveform promises, data coverage and sensor information.

exception CodesError[source]

Bases: SquirrelError

class Codes(**kwargs)[source]

Bases: SObject

Undocumented.

class CodesNSLCE(*args, safe_str=None, **kwargs)[source]

Bases: CodesNSLCEBase, Codes

Codes denominating a seismic channel (NSLC or NSLCE).

FDSN/SEED style NET.STA.LOC.CHA is accepted or NET.STA.LOC.CHA.EXTRA, where the EXTRA part in the latter form can be used to identify a custom processing applied to a channel.

as_dict()

Return a new dict which maps field names to their values.

class CodesNSL(*args, safe_str=None, **kwargs)[source]

Bases: CodesNSLBase, Codes

Codes denominating a seismic station (NSL).

NET.STA.LOC is accepted, slightly different from SEED/StationXML, where LOC is part of the channel. By setting location=’*’ is possible to get compatible behaviour in most cases.

as_dict()

Return a new dict which maps field names to their values.

class CodesX(name='', safe_str=None)[source]

Bases: CodesXBase, Codes

General purpose codes for anything other than channels or stations.

as_dict()

Return a new dict which maps field names to their values.

class Station(**kwargs)[source]

Bases: Location

A seismic station.

codes

CodesNSL

tmin

time_float (pyrocko.guts.Timestamp), optional

tmax

time_float (pyrocko.guts.Timestamp), optional

description

str, optional

class Channel(**kwargs)[source]

Bases: ChannelBase

A channel of a seismic station.

dip

float, optional

azimuth

float, optional

class Sensor(**kwargs)[source]

Bases: ChannelBase

Representation of a channel group.

channels

list of Channel objects, default: []

class Response(**kwargs)[source]

Bases: Object

The instrument response of a seismic station channel.

codes

CodesNSLCE

tmin

time_float (pyrocko.guts.Timestamp), optional

tmax

time_float (pyrocko.guts.Timestamp), optional

stages

list of ResponseStage objects, default: []

checkpoints

list of pyrocko.response.FrequencyResponseCheckpoint objects, default: []

deltat

float, optional

log

list of tuple of 3 str objects objects, default: []

class Nut(file_path=None, file_format=None, file_mtime=None, file_size=None, file_segment=None, file_element=None, kind_id=0, codes=CodesX(name=''), tmin_seconds=None, tmin_offset=0, tmax_seconds=None, tmax_offset=0, deltat=None, content=None, raw_content=None, tmin=None, tmax=None, values_nocheck=None)[source]

Bases: Object

Index entry referencing an elementary piece of content.

So-called nuts are used in Pyrocko’s Squirrel framework to hold common meta-information about individual pieces of waveforms, stations, channels, etc. together with the information where it was found or generated.

file_path

str, optional

file_format

str, optional

file_mtime

time_float (pyrocko.guts.Timestamp), optional

file_size

int, optional

file_segment

int, optional

file_element

int, optional

kind_id

int

codes

Codes

tmin_seconds

int, default: 0

tmin_offset

int, optional, default: 0

tmax_seconds

int, default: 0

tmax_offset

int, optional, default: 0

deltat

float, default: 0.0

content

pyrocko.guts.Any, optional

raw_content

dict of pyrocko.guts.Any objects, default: {}

class Coverage(**kwargs)[source]

Bases: Object

Information about times covered by a waveform or other time series data.

kind_id

int

Content type.

pattern

Codes

The codes pattern in the request, which caused this entry to match.

codes

Codes

NSLCE or NSL codes identifier of the time series.

deltat

float, optional

Sampling interval [s]

tmin

time_float (pyrocko.guts.Timestamp), optional

Global start time of time series.

tmax

time_float (pyrocko.guts.Timestamp), optional

Global end time of time series.

changes

list of tuple of 2 pyrocko.guts.Any objects objects, default: []

List of change points, with entries of the form (time, count), where a count of zero indicates start of a gap, a value of 1 start of normal data coverage and a higher value duplicate or redundant data coverage.

class WaveformPromise(**kwargs)[source]

Bases: Object

Information about a waveform potentially downloadable from a remote site.

In the Squirrel framework, waveform promises are used to permit download of selected waveforms from a remote site. They are typically generated by calls to update_waveform_promises(). Waveform promises are inserted and indexed in the database similar to normal waveforms. When processing a waveform query, e.g. from get_waveform(), and no local waveform is available for the queried time span, a matching promise can be resolved, i.e. an attempt is made to download the waveform from the remote site. The promise is removed after the download attempt (except when a network error occurs). This prevents Squirrel from making unnecessary queries for waveforms missing at the remote site.

codes

CodesNSLCE

tmin

time_float (pyrocko.guts.Timestamp)

tmax

time_float (pyrocko.guts.Timestamp)

deltat

float, optional

source_hash

str