Read miniseed files and change the header

Hi everyone,

I have one month of seismic data in miniseed format where the station name of the miniseed is wrong. I want to know if obspy has some solution to read all the data (the complete month) and change the station name. I don’t want to do it individually. So Thanks in advance if someone can help me.

Esteban

Esteban;
Si tiene Antelope puede utilizar el programa fix_miniseed

Saludos;
Javier Pacheco

Hi Esteban,

can ObsPy still read the MiniSEED files? If yes, you could to something like this:

>>> import glob
>>> import obspy
>>> for filename in glob.iglob("*.mseed"):
... st = obspy.read(filename)
... for tr in st:
... tr.stats.station = "ABC"
... st.write(filename + "-fixed", format="mseed")

Cheers!

Lion

Hi Lion,

Lion Krischer [04.11.2013 21:27]:

>>> import glob
>>> import obspy
>>> for filename in glob.iglob("*.mseed"):
... st = obspy.read(filename)
... for tr in st:
... tr.stats.station = "ABC"
... st.write(filename + "-fixed", format="mseed")

This is about as easy as it can get. Great!

AFAICS, however, the mseed records are re-encoded from intermediate trace objects. This is probably not a problem for most users, but might be an issue for data centers.

Is there a way in obspy to access (and modify) the raw mseed records? Access to fields like station code etc. or time doesn't even require decoding of the data part and could be done on the otherwise unmodified raw record directly.

Cheers
Joachim

Hi Joachim,

AFAICS, however, the mseed records are re-encoded from intermediate trace objects. This is probably not a problem for most users, but might be an issue for data centers.

Yes that is correct. Things like timing and data quality flags and most additional blockettes will be lost.

Is there a way in obspy to access (and modify) the raw mseed records? Access to fields like station code etc. or time doesn't even require decoding of the data part and could be done on the otherwise unmodified raw record directly.

No not yet. The problem is that this would essentially require ObsPy to create one Trace object per MiniSEED record making it very slow and memory intensive. We talked about doing this nonetheless as there are applications benifiting from it but so far demand has not been high enough.

ObsPy has a function to shift the time of MiniSEED files without touching anything else:
http://docs.obspy.org/packages/autogen/obspy.mseed.util.shiftTimeOfFile.html

This is probably the most common correction one wants to do. It would be trivial to implement something similar for changing the network code, station code or other attributes.

Cheers!

Lion

If you only need to change header values, this utility from IRIS in seed is very fast and easy to use:

https://seiscode.iris.washington.edu/projects/msmod

-Renate

Renate’s suggestion looks like the best, but I’ll also mention the older PASSCAL program ‘fixhdr’, which we use for batch modifying miniSEED headers for long-term active-source datasets.

http://www.passcal.nmt.edu/content/software-resources

-Mark

Esteban;

Que tal ? Oiga necesito que me envíe una tabla con nombre de estación, digitalizador (marca, numero serial), sensor (marca, numero serial), localización, deployment date, decomission date, para todas las estaciones de Nicoya que quedaron funcionando y ahora son parte de la red del OVSICORI.
Estoy tratando de arreglar la base de datos de respuestas de instrumento en el Antelope y me estoy encontrando con barbaridades que necesito corregir. Usted le había dado a Christian una lista, pero tengo la impresión de que hay errores en ellos, o que Christian introdujo errores a la hora de meterlos a la base de datos.

Gracias;