# http://pyrocko.org - GPLv3 # # The Pyrocko Developers, 21st Century # ---|P------/S----------~Lg----------
self.mtime = None self.files = []
pile.Pile.__init__(self)
self._tinc = tinc self._tpad = tpad self._storepath = storepath self._blocks = {}
if basepile is None: basepile = pile.Pile()
self.set_basepile(basepile)
for iblock in self._blocks.keys(): self._clearblock() self._blocks = {}
self.clear() self._base = basepile
return self._base
self.clear() self._tinc = tinc self._tpad = tpad
self.clear() self._storepath = storepath
self, tmin=None, tmax=None, tinc=None, tpad=0., *args, **kwargs):
if tmin is None: tmin = self.base.tmin+tpad
if tmax is None: tmax = self.base.tmax-tpad
self._update_range(tmin, tmax)
return pile.Pile.chopper(self, tmin, tmax, tinc, tpad, *args, **kwargs)
return traces
imin = int(math.floor(tmin / self._tinc)) imax = int(math.floor(tmax / self._tinc)+1)
todo = [] for i in range(imin, imax): wmin = i * self._tinc wmax = (i+1) * self._tinc mtime = util.gmctime(self._base.get_newest_mtime(wmin, wmax)) if i not in self._blocks or self._blocks[i].mtime != mtime: if i not in self._blocks: self._blocks[i] = ShadowBlock()
todo.append(i) self._blocks[i].mtime = mtime else: if todo: self._process_blocks(todo[0], todo[-1]+1) todo = [] if todo: self._process_blocks(todo[0], todo[-1]+1)
pmin = imin * self._tinc pmax = imax * self._tinc
iblock = imin for traces in self._base.chopper(pmin, pmax, self._tinc, self._tpad): tmin = iblock*self._tinc tmax = (iblock+1)*self._tinc traces = self.process(iblock, tmin, tmax, traces) if self._tpad != 0.0: for trace in traces: trace.chop(tmin, tmax, inplace=True) self._clearblock(iblock) self._insert(iblock, traces) iblock += 1
if traces: if self._storepath is not None: fns = io.save( traces, self._storepath, format='mseed', additional={'iblock': iblock})
self.load_files(fns, fileformat='mseed', show_progress=False) else: file = pile.MemTracesFile(None, traces) self.add_file(file)
for file in self._blocks[iblock].files: self.remove_file(file) |