Пример #1
0
    def _make_stats(net=None,
                    sta=None,
                    stime=None,
                    dt=None,
                    slow=None,
                    baz=None,
                    wvtype=None,
                    channel=None,
                    taxis=None):
        """
        Updates the ``stats`` dictionary from an obspy ``Trace`` object.

        Args:
            net (str): Network name
            sta (str): Station name
            stime (:class:`~obspy.core.UTCDateTime`): Start time of trace
            dt (float): Sampling distance in seconds
            slow (float): Slowness value (s/km)
            baz (float): Back-azimuth value (degrees)
            wvtype (str): Wave type ('P', 'SV', or 'SH')
            channel (str): Channel name
            taxis (:class:`~numpy.ndarray`): Time axis in seconds

        Returns:
            (:class:`~obspy.core.Trace`):
                tr: Trace with updated stats

        """

        stats = AttribDict()
        stats.baz = baz
        stats.slow = slow
        stats.station = sta
        stats.network = net
        stats.starttime = stime
        stats.delta = dt
        stats.channel = channel
        stats.wvtype = wvtype
        stats.taxis = taxis

        return stats
Пример #2
0
# Update the Obspy structure for plots, from the data read
statsx.update({'npts': length})
statsx.update({'sampling_rate': sampling_rate})
statsx.update({'starttime': starttime})

#______________________________________________________________________________
# Generate the SEGYs
for i in range(1, 4):
    statsx.update({'channel': 'BH' + str(i)})
    statsx = AttribDict()
    statsx.textual_file_header = 'SEISBERRY SEGY, SINGLE TRACE COMPONENT' + str(
        i)
    statsx.binary_file_header = SEGYBinaryFileHeader()
    statsx.binary_file_header.trace_sorting_code = 5
    statsx.delta = sampleinterval
    data = np.require(data, dtype=np.float32)  #handle format conversion
    Xt = Trace(data=data[0:length, i],
               header=statsx)  # cut the trace, add headers

    #Xt_filt = Xt.copy()
    #Xt_filt.filter('lowpass', freq=50, corners=2, zerophase=True)
    stream = Stream(traces=[Xt])
    #stream = Stream(traces=[Xt_filt])

    # SEGY writing, limited to 32767 samples
    outsegy = os.path.join(segydir,
                           filename_date[0:8] + "-comp" + str(i) + '.sgy')

    print("Stream object before writing...")
    print(stream)