From the ppsd.plot_temporal() I can extract the PSD values of a central period bin as follows:
psds = ppsd.extract_psd_values(period=10)
I can also save the PSD values as follows:
fname = station + “.” + “txt”
np.savetxt(fname, np.c_[psds[0]])
I have been able to get the corresponding times this as follows:
time = ppsd.times_processed
Then I get the corresponding times as timestamp objects as follow:
fname = “time” + station + “.” + “txt”
And I save them in a file:
np.savetxt(fname, np.c_[psds[0]])
I tried converting these timestamp objects to hours using ObsPy UTCdatetime() as follows:
from obspy.core import UTCDateTime
psd_time = np.genfromtxt(“time_BRDL.txt”)
for i in psd_time:
time = UTCDateTime(i)
time.hour
The problem is that only one object is converted, and a single value is returned in this way. I also tried using Pandas and python datetime() function. All have the same issue that only one object can be processed at a time. Could anybody suggest me anyway for doing this using ObsPy or any other python way?