pisces.query.waveforms

pisces.query.waveforms#

Query-building functions for getting waveforms.

Based on the outputs of filter_stations().

Example#

from obspy import UTCDateTime
from .stations import filter_stations
from pisces.fdsn import stream

now = UTCDateTime.now().timestamp

query = session.query(Affiliation, Site, Sitechan, Wfdisc)
query = filter_stations(query, net='IU', chan='BH[ENZ]', region=(W, E, S, N))

stquery = filter_waveforms(query, times=(now - 86400, None))
st = stream(stquery, tolerance=0.05, headonly=False)

iquery = filter_responses(query, ...)
inv = inventory(iquery, ...)

query = session.query(Event, Origin, Netmag)
query = filter_events(query, region=(W, E, S, N), times=(lastweek, now), depth=(15, None))
query = filter_magnitudes(query, mb=(None, 4.0))
cat = catalog(query, ...)

q = filter_waveforms(...)
# Availability and extent operate on filtered queries in pisces.fdsn.stream.

Data-header/quality indicators are D, R, Q, and M. STATUS is one of OPEN, RESTRICTED, or PARTIAL.

pisces.query.waveforms.filter_waveforms(query, net=None, sta=None, chan=None, times=None, wfid=None, recordlength=86400, clip=None, affiliation=None)[source]#

Request Wfdisc rows.

Parameters:
querysqlalchemy.orm.Query

Query whose session is used to build the returned Wfdisc query.

net, sta, chanstr, optional

Network, station, and channel patterns. * and ? wildcards and comma-separated patterns are supported. net requires affiliation.

timestuple of (time, endtime)

Values accepted by obspy.UTCDateTime.

wfiditerable of int, optional

Not implemented.

recordlengthint, optional

Typical Wfdisc record length in seconds (default: 86400). A falsey value disables the record-length buffer.

clipstr, optional

One of {"c", "n"}. Not implemented; Wfdisc clip flags are not filtered.

affiliationmapped table class, optional

Affiliation table used for network and epoch-overlap filtering. Required when net is specified. Without it, station/channel/time filtering still works.

Returns:
sqlalchemy.orm.Query

Query returning filtered Wfdisc rows.

Notes

Location filtering is not supported by this CSS Wfdisc query.