Пример #1
0
def _stretch_wrapper(groupnames, fname, outkey, filter=None,
                     **kwargs):
    """
    Wrapper around `~yam.stretch.stretch()`

    :param groupname: group to load the correlations from
    :param fname: file to load correlations from
    :param fname_stretch: file for writing results
    :param outkey: key to write stretch results to
    :param filter: filter correlations before stretching
        (bandpass, tuple with min and max frequency)
    :param \*\*kwargs: all other kwargs are passed to
        `~yam.stretch.stretch()` function
    """
    with h5py.File(fname, 'r') as f:
        traces = [obspyh5.dataset2trace(f[g]) for g in groupnames]
    stream = obspy.Stream(traces)
    for tr in stream:
        tr.data = np.require(tr.data, float)
    if filter:
        _filter(stream, filter)
    stretchres = yam.stretch.stretch(stream, **kwargs)
    if stretchres is not None:
        stretchres['attrs']['key'] = outkey
        return stretchres
Пример #2
0
def _prep1(target_sr, tolerance_shift, interpolate_options,
           remove_response, inventory, remove_response_options, filter,
           tr):
    """Helper function for parallel preprocessing"""
    tr.data = tr.data.astype('float64')
    _downsample_and_shift(tr, target_sr=target_sr,
                          tolerance_shift=tolerance_shift,
                          interpolate_options=interpolate_options)
    if remove_response:
        tr.remove_response(inventory, **remove_response_options)
    if filter is not None:
        _filter(tr, filter)
    return tr