Read waveform data

“Sa taong may hiya, salita’y panunumpa”
-Emilio Jacinto (Mga Aral ng Katipunan sa Kartilya)

Hi Christian

You have a small error in your code, try replacing the line
“wav_f = read(”.jul", starttime=t1, endtime=t2)"
with
“wav_f = read(”.%d" % (jul), starttime=t1, endtime=t2)"

(Note though that this is not strictly equivalent to your first version of the code as the year is now included in the first wildcard character)

regP

Hey CJ,

great to hear of your groups adaption of ObsPy :slight_smile:

The culprit in your example is this line:

wav_f = read("*.jul*", starttime=t1, endtime=t2)

This will pass the string "*.jul*" to the read() method. You'll have to
interpolate your julian day variable into the string for it to work:

read("*.%i*" % jul, ...)

This will pass "*.1*", *.121*" for whatever is in jul to the read
function. Depending on your files you may have to zero-pad your numbers.
Read up on Python string formatting for how to do that.

Cheers!

Lion