squirrel.pile
¶
- class Pile(squirrel=None)[source]¶
Bases:
object
pyrocko.pile.Pile
surrogate: waveform lookup, loading and caching.This class emulates most of the older
pyrocko.pile.Pile
methods by using calls to apyrocko.squirrel.base.Squirrel
instance behind the scenes.This interface can be used as a drop-in replacement for piles which are used in existing scripts and programs for efficient waveform data access. The Squirrel-based pile scales better for large datasets. Newer scripts should use Squirrel’s native methods to avoid the emulation overhead.
Note
Many methods in the original pile implementation lack documentation, as do here. Read the source, Luke!
- chopper(tmin=None, tmax=None, tinc=None, tpad=0.0, group_selector=None, trace_selector=None, want_incomplete=True, degap=True, maxgap=5, maxlap=None, keep_current_files_open=False, accessor_id='default', snap=(<built-in function round>, <built-in function round>), include_last=False, load_data=True, style=None)[source]¶
Get iterator for shifting window wise data extraction from waveform archive.
- Parameters
tmin – start time (default uses start time of available data)
tmax – end time (default uses end time of available data)
tinc – time increment (window shift time) (default uses
tmax-tmin
)tpad – padding time appended on either side of the data windows (window overlap is
2*tpad
)group_selector – ignored in squirrel-based pile
trace_selector – filter callback taking
pyrocko.trace.Trace
objectswant_incomplete – if set to
False
, gappy/incomplete traces are discarded from the resultsdegap – whether to try to connect traces and to remove gaps and overlaps
maxgap – maximum gap size in samples which is filled with interpolated samples when
degap
isTrue
maxlap – maximum overlap size in samples which is removed when
degap
isTrue
keep_current_files_open – whether to keep cached trace data in memory after the iterator has ended
accessor_id – if given, used as a key to identify different points of extraction for the decision of when to release cached trace data (should be used when data is alternately extracted from more than one region / selection)
snap – replaces Python’s
round()
function which is used to determine indices where to start and end the trace data arrayinclude_last – whether to include last sample
load_data – whether to load the waveform data. If set to
False
, traces with no data samples, but with correct meta-information are returnedstyle – set to
'batch'
to yield waveforms and information about the chopper state aspyrocko.pile.Batch
objects. By default lists ofpyrocko.trace.Trace
objects are yielded.
- Returns
iterator providing extracted waveforms for each extracted window. See
style
argument for details.
- iter_traces(load_data=False, return_abspath=False, group_selector=None, trace_selector=None)[source]¶
Iterate over all traces in pile.
- Parameters
load_data – whether to load the waveform data, by default empty traces are yielded
return_abspath – if
True
yield tuples containing absolute file path andpyrocko.trace.Trace
objectsgroup_selector – ignored in squirre-based pile
trace_selector – filter callback taking
pyrocko.trace.Trace
objects
- snuffle(**kwargs)[source]¶
Visualize it.
- Parameters
stations – list of pyrocko.model.Station objects or
None
events – list of pyrocko.model.Event objects or
None
markers – list of pyrocko.gui_util.Marker objects or
None
ntracks – float, number of tracks to be shown initially (default: 12)
follow – time interval (in seconds) for real time follow mode or
None
controls – bool, whether to show the main controls (default:
True
)opengl – bool, whether to use opengl (default:
False
)