Commit defa2c04 authored by Semih Demir's avatar Semih Demir
Browse files

create spectogram

parent 60672973
from obspy import read
import logging
from obspy import Stream
import os
import time
import pyasdf
from dug_seis.processing.dug_trigger import dug_trigger
from dug_seis.processing.event_processing import event_processing
import re
from obspy.signal import PPSD
from obspy import read
from obspy.io.xseed import Parser
asdf_folder = '/Users/sem/Documents/dug-seis-test/raw/merge/merge13_single' # 'raw' # Location of .h5 file
stations = [i - 1 for i in [19]]
stations.sort()
new_files = sorted([f for f in os.listdir(asdf_folder) if f.endswith('.h5') ]) # generates a list of the .asdf files in asdf_folder
print(new_files)
current_file = new_files.pop(0)
sta = Stream()
ds = pyasdf.ASDFDataSet(asdf_folder + '/' + current_file, mode='r')
wf_list = ds.waveforms.list()
for k in stations:
sta += ds.waveforms[wf_list[k]].raw_recording
print(sta[0])
# sta[0].decimate(factor=16, strict_length=False)
sta[0].resample(500, window='hanning', no_filter=True, strict_length=False)
# sta[0].spectrogram(log=True,wlen=sta[0].stats.sampling_rate/90,per_lap=0.99,show=True,dbscale=False)
st = read("https://examples.obspy.org/BW.KW1..EHZ.D.2011.037")
koek=1
inv = ['1']
ppsd = PPSD(sta[0].stats, metadata=inv)
ppsd.add(sta)
# ppsd.plot()
ppsd.plot_spectrogram()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment