pyrocko.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.

Classes

Channel(**kwargs)

A channel of a seismic station.

ChannelBase(**kwargs)

Undocumented.

Codes(**kwargs)

Undocumented.

CodesNSL(*args[, safe_str])

Codes denominating a seismic station (NSL).

CodesNSLBase(network, station, location)

CodesNSLCE(*args[, safe_str])

Codes denominating a seismic channel (NSLC or NSLCE).

CodesNSLCEBase(network, station, location, ...)

CodesX([name, safe_str])

General purpose codes for anything other than channels or stations.

CodesXBase(name)

Coverage(**kwargs)

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

Event(**kwargs)

A seismic event.

Nut([file_path, file_format, file_mtime, ...])

Index entry referencing an elementary piece of content.

QuantityType(...)

Choice of observational or technical quantity.

Response(**kwargs)

The instrument response of a seismic station channel.

ResponseStage(**kwargs)

Representation of a response stage.

Sensor(**kwargs)

Representation of a channel group.

Station(**kwargs)

A seismic station.

WaveformOrder(**kwargs)

Waveform request information.

WaveformPromise(**kwargs)

Information about a waveform potentially downloadable from a remote site.

class Codes(**kwargs)[source]

Bases: SObject

Undocumented.

class CodesNSLCEBase(network, station, location, channel, extra)

Bases: tuple

channel

Alias for field number 3

extra

Alias for field number 4

location

Alias for field number 2

network

Alias for field number 0

station

Alias for field number 1

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 CodesNSLBase(network, station, location)

Bases: tuple

location

Alias for field number 2

network

Alias for field number 0

station

Alias for field number 1

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 CodesXBase(name)

Bases: tuple

name

Alias for field number 0

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

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

tmax

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

description

str, optional

get_pyrocko_station()[source]

Get station as a classic Pyrocko station object.

Returns:

Converted station object.

Return type:

pyrocko.model.station.Station

class ChannelBase(**kwargs)[source]

Bases: Location

Undocumented.

codes

CodesNSLCE

tmin

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

tmax

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

deltat

float, 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 QuantityType(...) str[source]

Bases: StringChoice

Choice of observational or technical quantity.

SI units are used for all quantities, where applicable.

class ResponseStage(**kwargs)[source]

Bases: Object

Representation of a response stage.

Components of a seismic recording system are represented as a sequence of response stages, e.g. sensor, pre-amplifier, digitizer, digital downsampling.

input_quantity

str (QuantityType), optional

input_sample_rate

float, optional

output_quantity

str (QuantityType), optional

output_sample_rate

float, optional

elements

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

log

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

class Response(**kwargs)[source]

Bases: Object

The instrument response of a seismic station channel.

codes

CodesNSLCE

tmin

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

tmax

pyrocko.util.get_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 Event(**kwargs)[source]

Bases: Object

A seismic event.

name

str, optional

time

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

duration

float, optional

lat

float

lon

float

depth

float, optional

magnitude

float, optional

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_waveforms(), 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

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

tmax

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

deltat

float, optional

source_hash

str

class WaveformOrder(**kwargs)[source]

Bases: Object

Waveform request information.

source_id

str

codes

CodesNSLCE

deltat

float

tmin

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

tmax

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

gaps

list of tuple of 2 pyrocko.util.get_time_float (pyrocko.guts.Timestamp) objects objects, default: []

time_created

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

anxious

float (pyrocko.guts.Duration), default: 600.0

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

pyrocko.util.get_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

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

Global start time of time series.

tmax

pyrocko.util.get_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.