This is not a question about an error or a problem but more about best practices. I have day-long miniseed files that consist of 14 stations sitting in separate folders for each year.
At the moment, I can process this data with a script like the one below reading each day-long file one by one and adding the previously calculated PPSD values.
import os from obspy import read, read_inventory from obspy.io.xseed import Parser from obspy.signal import PPSD files = os.listdir() wf = [i for i in files if i.endswith(".mseed")] wf = sorted(wf) stas = ["STA1", "STA2", "STA3"] chas = ["BHZ", "BHN", "BHE"] for f in wf: st = read(f) for sta in stas: for cha in chas: try: tr = st.select(id=".."+sta+".."+cha) inv = read_inventory(".".join([sta,cha,"RESP"])) ppsd = PPSD(tr.stats, metadata=inv) ppsd.add(st) if os.path.exists(sta+"."+cha+".npz"): print("Found old psd...adding to the current one...") ppsd.add_npz(sta+"."+cha+".npz") ppsd.save_npz(sta+"."+cha+".npz") except: print("There was a problem processing the channel", sta, cha, f)
What is the best way to calculate the PPSD for the whole year of data for each station? Probably there are better ways to make it more efficient.