st = read('RAW/*', debug_headers=True) k = len(st) i = 0 while i < k: tr = st[i] print(tr.id, tr.stats.starttime.year, tr.stats.starttime.julday) ### differential Volcity to Accerletion diftr = obspy.core.trace.Trace.differentiate(tr) ### Pole and Zero chn = tr.stats.channel sta = tr.stats.station Ps = "PZs/" + "*" + sta + "*" + "HHZ" + "*" HH_paz = glob.glob(Ps) pz.attach_paz(diftr, HH_paz[0]) paz = dict(diftr.stats.paz) ### power spectrum density ppsd = PPSD(diftr.stats, paz, ppsd_length=3600.0, overlap=0.95) ppsd.add(diftr) [t, amp] = ppsd.get_mode() ### Output ts = str(tr.stats.starttime.year) + "." + str(tr.stats.starttime.julday) txt = sta + "." + chn + "." + ts + ".txt" with open(txt, mode="w") as f: for j in range(len(t)): f.write("%e %6.2f\n" % (t[j], amp[j])) i += 1
cMHdata = "datafiles/CRUI3.SP.mseed" cMHmeta = "datafiles/CRUI3.xml" cEHdata = "datafiles/CRUI1-2.mseed" cEHmeta = "datafiles/CRUI1.xml" #first get cruise ppsd info print("Working on cruise data") stMHc = read(cMHdata) invMHc = read_inventory(cMHmeta) stMHc_sel = stMHc.select(channel='MHW') trc = stMHc_sel[0] ppsdMHc = PPSD(trc.stats, metadata=invMHc, ppsd_length=600.0, skip_on_gaps=True, period_limits=(0.02, 100.0), db_bins=(-200, -50, 1.)) ppsdMHc.add(stMHc_sel) (cMHpd, cMHpsd) = ppsdMHc.get_mode() stEHc = read(cEHdata) invEHc = read_inventory(cEHmeta) stEHc_sel = stEHc.select(channel='EHW') trc = stEHc_sel[0] ppsdEHc = PPSD(trc.stats, metadata=invEHc, ppsd_length=200.0, skip_on_gaps=True, period_limits=(0.02, 100.0), db_bins=(-200, -50, 1.)) ppsdEHc.add(stEHc_sel) (cEHpd, cEHpsd) = ppsdEHc.get_mode() # For reference, earth low and high noise models (nlnmpd, nlnmpsd) = get_nlnm() (nhnmpd, nhnmpsd) = get_nhnm() # channels = ['EHU', 'EHV', 'EHW']