Write waveforms into SeisComp Data Structure (SDS)

Hi all,
I would whant to extract multiple miniseed waveforms data in the seiscomp3 structure.
Is possible to do that?
best regards,

Sergio

Hi Sergio,

what exactly do you want to do?

Hi Sergio, you may want to try the SDS (Seiscomp Data Structure) client in ObsPy: obspy.clients.filesystem.sds — ObsPy Documentation (1.2.1.post0+1.g219b24d2ee.obspy.master)

Hallo, yes, I want to extract from seed files with multiple stations and channels stored on it, single channels and save them in SDS structure.

I suggest to iterate through your waveforms and write channel by channel. Here is some code to get you started:

from obspy import read
stream = read()

SDS = 'test_{channel}.mseed'
for tr in stream:
    fname = SDS.format(**tr.stats)
    tr.write(fname, 'MSEED')

You still need to change SDS to the correct string and create nonexistent directories.

I personally prefer do this task in MSMOD.

Hi @sergio59,

did you solve your problem? If yes, could you please post your solution and mark the question as resolved?

Thanks

Thanks to all for yours suggestions… I try to work with that and I will answer you.
Best regards to all

Sergio

Hello trichter,
sorry for my answer so much later, but older works has keep me busy.
Now I should works in other project that includes the reorder of the old data recorded.
I have this situation.
Few years ago we have extract mseed stations waves from SDS and stored in single file.
After that the annual records were deleted.
Big mistake!!
Now i whant to restore the waveforms data in SDS structure for reading by scolv program to set the right picks.
Also I would to insert blank data (or whatever they are) if I have more than one event in day.
Please, can you help me?

Best regards,
Sergio

here’s what you want to do…

  • read your data
  • for every trace in your streams:
    • make sure to split trace if it spans past any day boundaries
    • build appropriate filename the file should go in
    • make sure the directory exists, or create it and all parent directories not yet present
    • save the trace as miniseed to given file

In the last step you want to do it like this, to make sure you either start a new file or append to an already existing file:

with open(path, 'ab') as fh:
    tr.write(fh, format='MSEED')

Hi Tobias,
thanks for your answer.
I have made a short python script to rewrite waveform data and works well.
Thanks again.
Ciao,
Sergio