Hi all,
I have a large MSEED dataset where I just need to change some header information for each file. I’m aware that I can read in only the header as to:
st = read(mseed_file, headonly=True)
After I changed my header specifics, is there a way to write this header and attach it to the actual data? Or do I indeed have to read the whole file, change the header, and then write it?
Basically, I am looking for an MSEED equivalence of (if I understand correctly):
sac.write(filename, headonly=True)
Thanks for a quick hint!
John
Hi John,
I can see how this would be interesting but even in a simplistic form it would require some significant engineering effort. Also ObsPy’s MiniSEED reading is not fully lossless as some blockettes and flags of the fixed headers are not read by default.
Have a look at this function:
It shifts times at the record header level without eve touching the actual data and a similar approach can be used to modify other parts of the headers.
Cheers!
Lion
I have a large MSEED dataset where I just need to change some header information for each file.
If you are willing to consider non-ObsPy solutions you might see if msmod
will make the modifications you need:
https://seiscode.iris.washington.edu/projects/msmod/
Not part of ObsPy but if Python is a requirement you should have a look at mseedlite.py by Andres Heinloo. It is shipped as part of SeisComP 3 but can be installed independently as there is practically no dependency on anything but Python standard packages. No proper documentation but you can contact me or Andres for help if needed.
See https://github.com/SeisComP3/seiscomp3/blob/master/src/utils/libs/python/seiscomp/mseedlite.py
If Python is not a requirement, then the solution proposed by Chad is the way to go.
Cheers
Joachim