예제 #1
0
def get_waveforms():
    events = get_events()
    client = ArcClient()
    wforms = Stream()
    for event in events:
        t = event.preferred_origin().time
        args = seed_id.split('.') + [t + 5 * 60, t + 14 * 60]
        wforms.extend(client.getWaveform(*args))
    wforms.decimate(int(round(wforms[0].stats.sampling_rate)) // 5,
                    no_filter=True)
    wforms.write(wavname, wavformat)
예제 #2
0
fig = plt.figure(1, figsize=(12, 12))
plt.subplots_adjust(hspace=0.001)
for idx, chan in enumerate(chans):
    st = Stream()
    for s in range(1, 9):

        if debug:
            print('On ' + str(s) + ' ' + chan)
        st += read(string + str(s) + '/' + chan + '.D/XX*')

    stime = UTCDateTime('2017-05-03T01:10:00.0')
    etime = UTCDateTime('2017-05-03T02:10:00.0')
    st.trim(starttime=stime, endtime=etime)

    nsHF, psHF, fHF = selfnoise(st)
    st.decimate(5)

    st.decimate(2)

    st.decimate(5)

    print(st)
    ns, ps, f = selfnoise(st)

    #st.plot()
    if chan == 'HHE':
        sts2chan = 'BH2'
    elif chan == 'HHN':
        sts2chan = 'BH1'
    elif chan == 'HHZ':
        sts2chan = 'BH0'
예제 #3
0
#st= read(curfile)
#if idx == 0:
#ppsd = PPSD(st[0].stats, paz)
#ppsd.add(st)
#ppsd.save_npz(st[0].id + 'PDF.npz')

debug = True
string = 'newdata/output_raw/2017/XX/FF'

pazNEW = corn_freq_2_paz(4.9, .96)
pazNEW['sensitivity'] = 75900.

chans = ['HHZ', 'HHE', 'HHN']
for idx, chan in enumerate(chans):
    st = Stream()
    for s in range(1, 9):

        if debug:
            print('On ' + str(s) + ' ' + chan)
        st += read(string + str(s) + '/' + chan + '.D/XX*')

    stime = UTCDateTime('2017-05-03T01:10:00.0')
    etime = UTCDateTime('2017-05-04T01:10:00.0')
    st.trim(starttime=stime, endtime=etime)
    st.decimate(4)
    st.decimate(2)
    print(st)
    ppsd = PPSD(st[0].stats, pazNEW)
    ppsd.add(st)
    ppsd.save_npz(st[0].id + 'PDF.npz')
예제 #4
0
# Create a stream just with winds that overlap SP data
st_windoverlap = Stream()
for tr in st_SP:
    stime = tr.stats[
        'starttime'] + 2.  # strip out first two seconds with transient
    etime = tr.stats['endtime']
    st_temp = read(windsdatafile, starttime=stime,
                   endtime=etime).select(channel='VWS')
    st_windoverlap += st_temp

st_windoverlap = st_windoverlap.merge().split()
# (st_windoverlap+st_SP).plot(method='full', equal_scale=False)
# One more plot with original
# (st_windoverlap+st_SP_IR).plot(method='full', equal_scale=False)
st_windoverlap.decimate(15)  #reduce sampling to 30 seconds
# (st_windoverlap+st_SP).plot(method='full', equal_scale=False)
print(st_windoverlap)

# Test comparison
# Initiate figure instance and clear csv file for output
fig = plt.figure()
csvfile = 'WS_SPviking_rms.csv'
with open(csvfile, 'w') as f:  # This should empty the file and add headers
    writer = csv.writer(f)
    writer.writerow(["RMS wind speed", "RMS SP Viking output"])

for tr in tqdm(st_windoverlap):
    stime = tr.stats['starttime']
    etime = tr.stats['endtime']
    st_SPtemp = st_SP.copy().trim(starttime=stime, endtime=etime)
예제 #5
0
ctime = stime
st = Stream()

#while ctime <= etime:
#    string = '/tr1/telemetry_days/IU_' + sta + '/' + str(ctime.year) + '/' + \
#                str(ctime.year) + '_' + str(ctime.julday).zfill(3) + '/*'
#    st += read(string + chans + '_LH*')
#    st += read(string + presloc + '_LDO*')
#    ctime += 24.*60.*60.
st = read('cordata')
#st += client.get_waveforms(net, sta, "00","LH*", stime, etime)
#st += client.get_waveforms(net, sta, "30","LDO", stime, etime)
st.detrend('constant')
st.merge(fill_value=0)
st.decimate(5)
st.decimate(2)
st.decimate(6)
st.decimate(6)
# Convert to velocity
st.attach_response(inv)

# We now have the data and the metadata so we should rotate it and do particle motion

st.rotate(method="->ZNE", inventory=inv)
st.select(channel="LH*").remove_response(output='ACC')
st.filter('bandpass', freqmin=0.03 / 1000., freqmax=0.04 / 1000.)
st.taper(0.05)
if debug:
    print(st)