Source code for pyrocko.squirrel.client.base

# http://pyrocko.org - GPLv3
#
# The Pyrocko Developers, 21st Century
# ---|P------/S----------~Lg----------

from __future__ import absolute_import, print_function

from pyrocko.guts import Object, Timestamp


[docs]class Constraint(Object): tmin = Timestamp.T(optional=True) tmax = Timestamp.T(optional=True)
[docs] def contains(self, constraint): ''' Check if the constraint completely includes a more restrictive one. ''' if self.tmin is not None and constraint.tmin is not None: b1 = self.tmin <= constraint.tmin elif self.tmin is None: b1 = True else: b1 = False if self.tmax is not None and constraint.tmax is not None: b2 = constraint.tmax <= self.tmax elif self.tmax is None: b2 = True else: b2 = False return b1 and b2
[docs] def expand(self, constraint): ''' Widen constraint to include another given constraint. ''' if constraint.tmin is None or self.tmin is None: self.tmin = None else: self.tmin = min(constraint.tmin, self.tmin) if constraint.tmax is None or self.tmax is None: self.tmax = None else: self.tmax = max(constraint.tmax, self.tmax)
[docs]class Source(Object):
[docs] def update_channel_inventory(self, squirrel, constraint): ''' Let local inventory be up-to-date with remote for a given constraint. ''' pass
[docs] def update_event_inventory(self, squirrel, constraint): ''' Let local inventory be up-to-date with remote for a given constraint. ''' pass
[docs] def update_waveform_promises(self, squirrel, constraint): ''' Let local inventory be up-to-date with remote for a given constraint. ''' pass
__all__ = [ 'Source', 'Constraint', ]