# http://pyrocko.org - GPLv3 # # The Pyrocko Developers, 21st Century # ---|P------/S----------~Lg----------
Tuple, List
'undefined', 'waveform', 'station', 'channel', 'response', 'event', 'waveform_promise']
UNDEFINED, WAVEFORM, STATION, CHANNEL, RESPONSE, EVENT, WAVEFORM_PROMISE) = range(len(g_content_kinds))
return [g_content_kinds[kind_id] for kind_id in kind_ids]
else:
else:
else:
else:
else:
else:
else:
else:
if x is None: return '...'.ljust(17) else: return util.time_to_str(x)
else:
# 0 <= x < tscale_edges[1]: 0 # tscale_edges[1] <= x < tscale_edges[2]: 1 # ... # tscale_edges[len(tscale_edges)-1] <= x: len(tscale_edges)
''' Information about a waveform potentially available at a remote site. '''
def codes(self): return ( self.agency, self.network, self.station, self.location, self.channel, self.extra)
def time_span(self): return (self.tmin, self.tmax)
def client(self): return self.source_id.split(':')[1]
return '%s:%s %s [%s - %s]' % ( self.client, site, '.'.join(self.codes), util.time_to_str(self.tmin), util.time_to_str(self.tmax))
raise InvalidWaveform( 'waveform with zero data samples')
raise InvalidWaveform( 'incorrect sampling interval - waveform: %g s, ' 'meta-data: %g s' % ( tr.deltat, self.deltat))
raise InvalidWaveform('waveform has NaN values')
len(orders), '.'.join(codes[0]), '.'.join(codes[-1]))
else: return '%i orders, %s' % ( len(orders), '.'.join(codes[0]))
''' A seismic station. '''
def codes(self): return ( self.agency, self.network, self.station, self.location if self.location is not None else '*')
def time_span(self): return (self.tmin, self.tmax)
from pyrocko import model return model.Station( network=self.network, station=self.station, location=self.location if self.location is not None else '*', lat=self.lat, lon=self.lon, elevation=self.elevation, depth=self.depth)
'*', self.network, self.station, self.location if self.location is not None else '*', self.lat, self.lon, self.elevation, self.depth)
''' A channel of a seismic station. '''
def codes(self): return ( self.agency, self.network, self.station, self.location, self.channel)
def time_span(self): return (self.tmin, self.tmax)
from pyrocko import model return model.Channel( name=self.channel, azimuth=self.azimuth, dip=self.dip)
self.channel, self.network, self.station, self.location, self.lat, self.lon, self.elevation, self.depth)
'*', self.channel, self.azimuth, self.dip)
''' The instrument response of a seismic station channel. '''
''' A seismic event. '''
from pyrocko import model model.Event( name=self.name, time=self.time, lat=self.lat, lon=self.lon, depth=self.depth, magnitude=self.magnitude, duration=self.duration)
def time_span(self): return (self.time, self.time)
''' 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. '''
self, file_path=None, file_format=None, file_mtime=None, file_size=None, file_segment=None, file_element=None, kind_id=0, codes='', tmin_seconds=None, tmin_offset=0, tmax_seconds=None, tmax_offset=0, deltat=None, content=None, tmin=None, tmax=None, values_nocheck=None):
self.file_size, self.file_segment, self.file_element, self.kind_id, self.codes, self.tmin_seconds, self.tmin_offset, self.tmax_seconds, self.tmax_offset, self.deltat) = values_nocheck
else:
self.equality_values == other.equality_values)
return ehash(','.join(str(x) for x in self.key))
return not (self == other)
!= (self.file_mtime, self.file_size)
def dkey(self):
def key(self): self.file_path, self.file_segment, self.file_element, self.file_mtime)
def equality_values(self): self.file_segment, self.file_element, self.kind_id, self.codes, self.tmin_seconds, self.tmin_offset, self.tmax_seconds, self.tmax_offset, self.deltat)
def tmin(self):
def tmax(self):
def kscale(self): return 0
def waveform_kwargs(self): self.codes.split(separator)
agency=agency, network=network, station=station, location=location, channel=channel, extra=extra, tmin=self.tmin, tmax=self.tmax, deltat=self.deltat)
def waveform_promise_kwargs(self): self.codes.split(separator)
agency=agency, network=network, station=station, location=location, channel=channel, tmin=self.tmin, tmax=self.tmax, deltat=self.deltat)
def station_kwargs(self): agency=agency, network=network, station=station, location=location if location != '*' else None, tmin=tmin_or_none(self.tmin), tmax=tmax_or_none(self.tmax))
def channel_kwargs(self): = self.codes.split(separator)
agency=agency, network=network, station=station, location=location, channel=channel, tmin=tmin_or_none(self.tmin), tmax=tmax_or_none(self.tmax), deltat=self.deltat)
def event_kwargs(self): name=self.codes, time=self.tmin, duration=(self.tmax - self.tmin) or None)
def trace_kwargs(self): self.codes.split(separator)
network=network, station=station, location=location, channel=channel, tmin=self.tmin, tmax=self.tmax-self.deltat, deltat=self.deltat)
def dummy_trace(self):
def codes_tuple(self):
def summary(self): if self.tmin == self.tmax: ts = util.time_to_str(self.tmin) else: ts = '%s - %s' % ( util.time_to_str(self.tmin), util.time_to_str(self.tmax))
return ' '.join(( ('%s,' % to_kind(self.kind_id)).ljust(9), ('%s,' % '.'.join(self.codes.split(separator))).ljust(18), ts))
agency='', network='', station='', location='', channel='', extra='', **kwargs):
(agency, network, station, location, channel, extra))
kind_id=WAVEFORM, codes=codes, **kwargs)
agency='', network='', station='', location='', channel='', extra='', **kwargs):
(agency, network, station, location, channel, extra))
kind_id=WAVEFORM_PROMISE, codes=codes, **kwargs)
agency='', network='', station='', location='', **kwargs):
kind_id=STATION, codes=codes, **kwargs)
agency='', network='', station='', location='', channel='', **kwargs):
kind_id=CHANNEL, codes=codes, **kwargs)
kind_id=EVENT, codes=codes, **kwargs)
by_ansl = {} for nut in nuts: if nut.kind_id != CHANNEL: continue
ansl = nut.codes[:4]
if ansl not in by_ansl: by_ansl[ansl] = {}
group = by_ansl[ansl]
k = nut.codes[4][:-1], nut.deltat, nut.tmin, nut.tmax
if k not in group: group[k] = set()
group.add(nut.codes[4])
return by_ansl
def tmin(self): return self.nut.tmin
def tmax(self): return self.nut.tmax
def deltat(self): return self.nut.deltat
def nslc_id(self):
def network(self): return self.nslc_id[0]
def station(self):
def location(self): return self.nslc_id[2]
def channel(self): return self.nslc_id[3]
return not (tmax < self.nut.tmin or self.nut.tmax < tmin)
'to_kind', 'to_kinds', 'to_kind_id', 'to_kind_ids', 'Content', 'WaveformPromise', 'Station', 'Channel', 'Nut', ] |